我正在尝试使用 LibXL。我可以从工作表中提取数据,但需要一个函数将带有 Excel 行和列索引的字符串转换为 startRow、endRow、startCol、endCol 即
"A1:B3" 进入 startRow = 0, endRow = 2, startCol = 0, endCol = 1(LibXL 使用基于 0 的索引)
我已经尝试了我能想到的一切。该库没有附带任何使用此函数的示例,并且文档非常稀少。我究竟做错了什么?
这是我的代码:
int main()
{
const char range[] = "B2:C3";
int i, ret, rowFirst=0, rowLast=0, colFirst=0, colLast=0;
BookHandle book;
SheetHandle sheet;
book = xlCreateBook();
ret = xlBookLoad(book, "/home/jason/Downloads/panel.xls");
sheet = xlBookGetSheet(book, 0);
ret = xlSheetGetNamedRange(sheet, &range[0], &rowFirst, &rowLast, &colFirst, &colLast);
printf("ret from xlSheet...Range = %d\n", ret);
printf("%s\n", xlBookErrorMessage(book));
printf("rowLast = %d\n", rowLast);
printf("rowLast = %d\n", rowLast);
printf("colFirst = %d\n", colFirst);
printf("colLast = %d\n", colLast);
return 0;
}