int test() { return 1; }; int main() { string myfile; myfile = select_file_to_open("Excel文件", "xlsx|*.xlsx"); if (myfile == "") {break;} if (xls_open_book(myfile) == "0") { msg("open again"); } xls_select_sheet_by_id(1); xls_sheet_to_dbio_abs(); xls_close_book(); { int row, col, trow, tcol; db_go_head(); trow = db_row_count(); tcol = db_field_count(); dbg_clear(); //清理不想要的空行 for (row = 0; row < trow; row++) { if (db_res(0) == "" && db_res(4) == "") { db_del_row(row); row--; trow--; } } //清理不想的空列 for (col = 6; col <= tcol; col++) { dbg(db_cell(col, 1)); if (db_cell(col, 1) == "") {db_drop_field(db_field_name(col));} } db_go_head(); for (row = 0; row < trow; row++) { for (col = 0; col < tcol; col++) { string xx; dbg("Row:" + row + ";Col:" + col + "Val:" + db_cell(col, row)); } db_next(); } db_show(); } return 1; }; |