有时会出现Excel导出问题

我有一个问题,我正在导入循环表格到Excel。

我的代码是这样的:

#WINAPI #Excel SysExcelApplication excel; SysExcelWorkbooks books; SysExcelWorkbook book; SysExcelWorksheets sheets; SysExcelWorksheet sheet; SysExcelCells cells; SysExcelCell cell; SysExcelRange columns; while select myTable { cell = sheet.cells().item(row, col); cell.value(myTable.FieldI); sheet.columns().autoFit(); col++; cell = sheet.cells().item(row, col); cell.value(myTable.FieldII); sheet.columns().autoFit(); col++; row++; col=1; } // when the cycle end save my file 

但有时我给错误看起来像消息debugging

variables赋值中的参数types错误ErrorMessege

要么

提供的参数数量与方法接受的参数数量不同

但奇怪的是,如果我试图againg重新启动导出我不会得到错误。 我有这个问题

我有相同的代码和相同的数据。 当我生成文件时,excle行是完美的。 在这些情况中有50%有这个问题。

创build的行less了1700。 它依赖于什么? 我有很多行? 或其他?

我分享在网上find的相同的问题有些问题 ,我试图使用,但没有解决我的问题:我添加更多的信息不是我的问题更改设置

谢谢你的build议,

请享用

是的,当开发任何导出Excel有这个问题,当多行。 如果有几行,它是完美的。

对于这种情况下总是更改CSV导出的Excel导出。 导出csv文件的代码永远不会失败,并工作完美!

在这里我留下一个例子来导出5行的CSV文件。

码:

 static void ExportCSV(Args _args) { Commaio file; container lineCSV; #File str DatosLinea[500]; int _i; str filename; Dialog dialog; DialogField dialogFileName; ; dialog = new Dialog("Path CSV"); dialogFileName = dialog.addField(ExtendedTypeStr("FilenameSave"),"Path File:"); if (dialog.run()) { filename = dialogFileName.value(); } if (!filename) { return; } file = new Commaio((filename), 'W'); //Path + file name.csv file.outFieldDelimiter(';'); if( !file || file.status() != IO_Status::Ok) { throw error("File Cannot be opened"); } DatosLinea[1] = "Col 1"; DatosLinea[2] = "Col 2"; DatosLinea[3] = "Col 3"; DatosLinea[4] = "Col 4"; DatosLinea[5] = "Col 5"; _i = 1; lineCSV = conNull(); while(_i <= 5){ lineCSV += DatosLinea[_i]; _i += 1; } file.write(lineCSV); info("Export end"); }