Free Support Forum - aspose.com

Line return in csv file does not intepret well in Notepad

Hi,

I use the Aspose Library to write to csv file. (attached.)

I try to open the file in Notepad and it apears no line break are generated and all lines are squeezed together. If I open it using Wordpad, I got the clear format with line by line content.

Furthur research shows that, line break in Apose.cells libray is one char \n, instead of traditional \r\n.

Is this a bug?

Thanks!
-Ying

Hi,

Well, I think it (Aspose.Cells) works in the same way as MS Excel regarding csv file format. The generated file's display by Aspose.Cells is same as MS Excel's saved csv file (manually) when opening the file into Notepad.

Could you try the attached version and let us know if you still find any difference.

Thank you.

Hi,

We are using the java version - aspose.cells.jar. - Sorry, I should have mention this earlier.

I believe the way you handle the return line is different from Excel, that’s why it causes the problem for our application.

A easy way to test:
1. open the attached file in Notepad - you see the line char is messes up.
2. open the same file using Ms Excel then save as csv format, then open this new csv file using Notepad again - you will see all the lines are shown correctly.

-Ying


Hi Ying,

Ok, now we found the difference and you are right for the csv files generated by Aspose.Cells for Java.

We will look into it and get back to you soon.

Thank you.

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

Please try the attached latest version. We have fixed your mentioned issue.

Thank You & Best Regards,

Hi,

Thanks for the quick fix. It works!

Is this an official build that we can ship it with our product?

Best regards,

-Ying

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

Well, you can use the fix (Aspose.Cells for Java 2.1.0.11) as an official release. It is an intermediate kind of version which is provided as a fix against some bugs. Normally, a bug fix version is posted in the support forums. You can use this fix for your requirements; it will behave like an official release. It is to be noted here, our next official release would include all the functionality of the previous fixes (including all the intermediate versions till the next official release).

Thank You & Best Regards,

Hi,

We found a new problem with your fix.

The following function:

this.workbook.open(stream, com.aspose.cells.FileFormatType.CSV);

used to work with the old build now throw "NULL Pointer" Exception.

Please look into the issue ASAP.

Thanks and best regards,

-Ying

Hi,

Well, I could you not reproduce the issue you have mentioned with the new version/fix that we provided to you.

I tested the following code with a template file, and it works fine.

Sample code:

FileInputStream istream=new FileInputStream("e:\\files\\myfile.csv");

workbook = new Workbook();
this.workbook.open(istream,FileFormatType.CSV);
Worksheet worksheet = workbook.getWorksheets().getSheet(0);
Cells cells = worksheet.getCells();
Cell cell = cells.getCell("A1");
cell.setValue("hCells");
cell = cells.getCell("B1");
cell.setValue("h2nd Cells");

cell = cells.getCell("A2");
cell.setValue("hWords");
cell = cells.getCell("B2");
cell.setValue("h2nd Words");

FileOutputStream stream=new FileOutputStream("e:\\files\\out_myfile.csv");


this.workbook.save(stream,FileFormatType.CSV);

Could you create a sample test code with your template file and post us here to show the issue, we will check it soon.

Thank you.

Hi,

Can you try with the attached file to see if the it works for you?

We use "java.io.InputStream" type instead of FileInputStream.

Once we revert the library jar back to the old version, we no longer have the problem.

Thanks!

-Ying

Hi Ying,

Thanks for providing us the template csv file here.

We found the issue after an initial test, we got NullPointerException opening your file. We will look into your issue to figure it out soon. We will get back to you soon.

Thank you.

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

Please try the attached latest version of Aspose.Cells. We have fixed your mentioned issue.

Thank You & Best Regards,

The issues you have found earlier (filed as 10244) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.