@@ -23,18 +23,9 @@ Write_ampl_xl(AmplExports *ae, TableInfo *TI){
2323void
2424funcadd (AmplExports *ae){
2525
26- /* description of handlers */
27-
28- static char info[] = " amplxl\n "
29- " Table handler for .xlsx and .xlsm files:\n "
30- " one or two strings (an optional 'amplxl' and the file name,\n "
31- " ending in \" .xlsx\" or \" .xlsm\" ) expected before \" :[...]\" ." ;
32-
3326 /* Inform AMPL about the .example handlers */
3427
35- add_table_handler (Read_ampl_xl, Write_ampl_xl, info, 0 , 0 );
36-
37-
28+ add_table_handler (Read_ampl_xl, Write_ampl_xl, const_cast <char *>(doc.c_str ()), 0 , 0 );
3829};
3930
4031
@@ -86,7 +77,7 @@ ExcelManager::ExcelManager(){
8677 has_range = false ;
8778 break_mode = false ;
8879 verbose = 0 ;
89- write = " drop " ;
80+ write = " delete " ;
9081 backup = true ;
9182 is2D = false ;
9283 isReader = true ;
@@ -330,8 +321,8 @@ ExcelManager::prepare(){
330321
331322 option_string = arg_string.substr (write_op.size ());
332323
333- if (option_string == " drop " ){
334- write = " drop " ;
324+ if (option_string == " delete " ){
325+ write = " delete " ;
335326 }
336327 else if (option_string == " append" ){
337328 write = " append" ;
@@ -403,7 +394,7 @@ ExcelManager::prepare(){
403394 // we create the non existing file with the declared name
404395 if (inout == " OUT" ){
405396
406- write = " drop " ;
397+ write = " delete " ;
407398 msg = " Declared file does not exist. Creating file " ;
408399 msg += excel_path;
409400 msg += " with sheet " ;
@@ -471,7 +462,7 @@ ExcelManager::manage_workbook(){
471462 result = myunzip (excel_path, excel_iner_file, temp_folder);
472463
473464 if (result){
474- msg = " cannot extract workbook" ;
465+ msg = " Cannot extract workbook. Is the file open in another application? " ;
475466 logger.log (msg, LOG_ERROR );
476467 return 1 ;
477468 }
@@ -482,7 +473,7 @@ ExcelManager::manage_workbook(){
482473 result = parse_workbook ();
483474
484475 if (result){
485- msg = " cannot parse workbook" ;
476+ msg = " Cannot parse workbook" ;
486477 logger.log (msg, LOG_ERROR );
487478 return 1 ;
488479 }
@@ -501,13 +492,13 @@ ExcelManager::manage_workbook(){
501492 }
502493
503494 if (result){
504- msg = " cannot parse range" ;
495+ msg = " Cannot parse range" ;
505496 logger.log (msg, LOG_ERROR );
506497 return 1 ;
507498 }
508499 }
509500
510- msg = " Table type: " + tableType;
501+ msg = " Table type: " + numeric_to_string ( tableType) ;
511502 logger.log (msg, LOG_DEBUG );
512503
513504 // ~ sheet_rel = sheet_rel_map[range_sheet];
@@ -1463,7 +1454,7 @@ ExcelWriteManager::manage_data(){
14631454
14641455 if (inout == " OUT" ){
14651456
1466- if (write == " drop " ){
1457+ if (write == " delete " ){
14671458
14681459 // At this point we have an estimate of the table dimensions.
14691460 // However, due to the dynamic nature of data, this estimate may not be correct.
@@ -2567,7 +2558,7 @@ int
25672558ExcelWriteManager::delete_data (pugi::xml_node parent){
25682559
25692560 int include_header = 0 ;
2570- if (write == std::string (" drop " )){
2561+ if (write == std::string (" delete " )){
25712562 include_header = 1 ;
25722563 }
25732564
@@ -4138,7 +4129,7 @@ ExcelWriteManager::manage_data2D(){
41384129
41394130 if (inout == " OUT" ){
41404131
4141- if (write == " drop " ){
4132+ if (write == " delete " ){
41424133
41434134 result = write_data_out_2D (node, first_row, last_row, first_col, last_col);
41444135 }
@@ -4149,7 +4140,7 @@ ExcelWriteManager::manage_data2D(){
41494140 }
41504141 }
41514142 else if (inout == " INOUT" ){
4152- if (write == " drop " ){
4143+ if (write == " delete " ){
41534144
41544145 result = write_data_inout_2D (node, first_row, last_row, first_col, last_col);
41554146 }
@@ -4420,7 +4411,7 @@ ExcelManager::parse_header_2D_reader(
44204411 xl_col_map[xl_col_name] = iter_col;
44214412 header.push_back (xl_col_name);
44224413
4423- msg = " Found column header " + xl_col_name;
4414+ msg = " Found column header ' " + xl_col_name + " ' " ;
44244415 logger.log (msg, LOG_DEBUG );
44254416 }
44264417 else if (tableType != TABLE_SHEET ){
@@ -4504,7 +4495,7 @@ ExcelManager::parse_data2D(
45044495 if (found){
45054496 // more than 1 column not mapped
45064497 msg = " Found more than one candidate for key row in 2D table. At least "
4507- + h_set + " and " + ampl_col_name + " are not found ." ;
4498+ + h_set + " and " + ampl_col_name + " are not key columns ." ;
45084499 logger.log (msg, LOG_ERROR );
45094500 return 1 ;
45104501 }
0 commit comments