谢谢浪哥。 1的v建议只适用固定行及一张工作表的场景。 对于动态行、列、动态(多个)工作表的工作簿的就不适用了。 4的建议我测试了没成功。下面是我的测试代码。 打印销售订单的脚本定义,将下面的代码全部复制并保存. 接着点新增 int 1_grid() { string grid; grid = 'grid1'; gui_create_grid('ScrollBox_Grid', grid, 0, 0, 0, 400); gui_hide('MG_Item'); gui_hide('MG_Sum'); gui_set_h(grid, 380); gui_set_w(grid, 1320); string sql; int a, b, c, d, e, f; sql = 'select top 5 * from res'; db_run_query_thr(sql); b = db_field_count() + 1; c = db_row_count() + 3; grid_set_col_num(grid, b); grid_set_row_num(grid, c); for (a = 0; a <= c; a++) { grid_clear_row(grid, a); } db_go_head(); for (a = 1; a < b; a++) { grid_set_col_name(grid, a, db_field_name(a - 1)); grid_set_v_ext(grid, a, 0, db_field_name(a - 1)); } db_go_head(); for (d = 1; d < c; d++) { for (a = 1; a < b; a++) { grid_set_v_ext(grid, a, d, db_res(a - 1)); } db_next(); } return 1; } int create_voucher() { gui_create_speedbutton('Panel_Func', 'g1', 800, 3, 92, 28, '表1', 'call_csp.voucher.BA.1_grid'); return 1; }; int func_show() { return 1; }; int cell_change() { if (change_col == 'parent_res_id') { dbg(change_col); } return 1; }; |