#include #include #include int main (int argc, char *argv[]) { xlsxioreader file; xlsxioreadersheet sheet; int row, col; char *val; int flag = 0; if (argc < 2) { printf("usage %s file.xlsx [ sheet [ flag ]]\n", argv[0]); exit(1); } printf("+ libxlsxio version: %s\n", xlsxioread_get_version_string()); printf("+ xlsxioread_open(%s)\n", argv[1]); file = xlsxioread_open(argv[1]); if (!file) { printf("Cannot read %s\n", argv[1]); exit(2); } if (argc > 3) { flag = atoi(argv[3]); printf("+ flag = %d\n", flag); } if (argc > 2) { printf("+ xlsxioread_sheet_open(%s)\n", argv[2]); sheet = xlsxioread_sheet_open(file, argv[2], flag); } else { printf("+ xlsxioread_sheet_open()\n"); sheet = xlsxioread_sheet_open(file, argv[2], flag); } if (!sheet) { printf("Cannot open sheet\n"); exit(3); } while (xlsxioread_sheet_next_row(sheet)) { while ((val = xlsxioread_sheet_next_cell(sheet))) { row = xlsxioread_sheet_last_row_index(sheet); col = xlsxioread_sheet_last_column_index(sheet); printf("\t %2d %c: %s\n", row+1, 'A'+col-1, val); xlsxioread_free(val); } } printf("+ xlsxioread_close()\n"); xlsxioread_close(file); }