We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Empty rows from XLS are not properly created when exporting to CSV

Hi,
I’m trying to export an XLS file to CSV format, but the empty rows from the XLS are represented as empty lines in CSV, when they should have been a list of commas.

This is a sample code:

Workbook book = new Workbook(new FileInputStream("C:\\temp\\test.xls"), new LoadOptions(LoadFormat.EXCEL_97_TO_2003));
BufferedOutputStream writer = new BufferedOutputStream(new FileOutputStream("C:\\temp\\saved_from_aspose.csv", true), 2048);

for (int i = 0; i < book.getWorksheets().getCount(); i++) {
	book.getWorksheets().setActiveSheetIndex(i);
	book.save(writer, SaveFormat.CSV);
}
writer.close();

We are using Aspose.Cells for Java, version 7.1.0.
The export works as expected on version 2.4.3.

Please advise.
Thank you!

@Asentinel,

Thanks for the sample code segment and details.

Please try our latest version/fix: Aspose.Cells for Java v19.2.x (you may download it from Downloads section).

If you still find the issue with v19.2, please attach your template file and output CSV (you may zip the files prior attaching) to show the issue, we will check it soon. Also attach your expected output file. This may help us to evaluate your issue precisely to consequently figure it out soon.

PS. since you are using older version of the product, so we cannot evaluate your issue using your older version. Neither we can include fixes to older versions. The fixes are based on latest APIs set.

@Amjad_Sahi

Thanks for the quick reply.
Yes, the problem exists also in 19.2 version. I have attached a very simple sample file CSV issue.zip (6.8 KB)

@Asentinel,
We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSJAVA-42845 - Empty rows from XLS are not properly created when exporting to CSV

@Asentinel,

Please try our latest version/fix: Aspose.Cells for Java v19.2.6:

aspose-cells-19.2.6.zip (6.4 MB)

From v19.2.6, we have provided a new property for this requirement:

TxtSaveOptions.KeepSeparatorsForBlankRow

For your case, please set this property as true.

Let us know your feedback.

The issues you have found earlier (filed as CELLSJAVA-42845) have been fixed in Aspose.Cells for Java 19.3. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi