|
| | |
| 変数化 | |
| | |
|
char n[10];
int lp;
for(lp=0;lp<2;lp++){
MakeCellArea(n,lp,1);
System::String^ carea2 = gcnew System::String(n);
MakeCellArea(n,lp+1,1);
System::String^ carea3 = gcnew System::String(n);
xlRange = (Range^)ws->Range[carea2, carea3];
・
・
・// 処理
・
・
System::Runtime::InteropServices::Marshal::ReleaseComObject(xlRange);
}
// out -> A1
void MakeCellArea(char *out,int row,int col)
{
int len;
if((col-1)/26==0){
sprintf(out,"%c",'A'+(col-1));
}
else {
sprintf(out,"%c%c",'A'+((col-1)/26-1),'A'+((col-1)%26));
}
len=strlen(out);
sprintf(&out[len],"%d",row);
}
// out -> A:A
void MakeCellArea2(char *out,int row,int col)
{
int len;
if((row-1)/26==0){
sprintf(out,"%c",'A'+(row-1));
}
else {
sprintf(out,"%c%c",'A'+((row-1)/26-1),'A'+((row-1)%26));
}
strcat(out,":");
len=strlen(out);
if((col-1)/26==0){
sprintf(&out[len],"%c",'A'+(col-1));
}
else {
sprintf(&out[len],"%c%c",'A'+((col-1)/26-1),'A'+((col-1)%26));
}
}
// out -> A1:A1
void MakeCellArea3(char *out,int row,int col)
{
int len;
if((col-1)/26==0){
sprintf(out,"%c",'A'+(col-1));
}
else {
sprintf(out,"%c%c",'A'+((col-1)/26-1),'A'+((col-1)%26));
}
len=strlen(out);
sprintf(&out[len],"%d:",row);
len=strlen(out);
if((col2-1)/26==0){
sprintf(&out[len],"%c",'A'+(col2-1));
}
else {
sprintf(&out[len],"%c%c",'A'+((col2-1)/26-1),'A'+((col2-1)%26));
}
len=strlen(out);
sprintf(&out[len],"%d",row2);
}
| |
| | |
|