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

Free Support Forum - aspose.com

Save workbook to CSV file with UTF-8 encoding

We are using aspose.cell java library version 2.2.

I would like to find out if we can save the workbook to CSV format using UTF-8 encoding.

I have tried to use workbook’s save API but the file is saved to ANSI encoding by default.


Hi,

To specify encoding of the generated CSV file, you can
use:
Workbook.getSaveOptions().setEncoding("UTF-8");
Thank you.

Hi,

Thanks for the replay.

I tried to use this API but got compile error. Is this API supported in version 2.2? or is I need to have later aspose.cell JAVA version in order to use?

Thanks!
-Ying


Hi,

Please try the attached latest version/fix and let us know if you can find the related API now.

Thank you.

Hi,

Thanks for the jar file.

I tried with your library file and it does have the setEncoding() API you mentioned here. However, we have only license for version 2.2. Do we need to purchase additional license in order to utilize this API?

Thanks!
-Ying

Hi,

Well, we tested the method is there in Aspose.Cells for Java v2.2.0.0. Please confirm us your version number of Aspose.Cells for Java that you are using in your project.

Moreover, you may also try other overloaded methods of Workbook class for your need:
i) save(String fileName, char separator, String charsetName)

ii) save(OutputStream stream, char separator, String charsetName)


Thank you.

Hi,

That’s strange. We are using the version 2.2. Can you upload your version of 2.2.0.0 so that I can give it a try here?

I have tried the overload functions but none of them are working. The file is still saved to ANSI format.

Thanks,
-Ying

Hi,

Please download and try our latest version v2.3.0:
http://www.aspose.com/community/files/72/java-components/aspose.cells-for-java/entry243913.aspx

For your information, when you purchase a license, you are eligible to use any version/fix that will be released in the next whole year. So, if you have purchased the license a few months ago, you can and should use latest version of the product which is more enhanced with new features.

To know which version you are using programmatically at run time, please see the document:
http://www.aspose.com/documentation/java-components/aspose.cells-for-java/check-version-number-of-the-component.html


Thank you.

Hi,

I checked out the latest 2.2.0 version from your website and am able to use the setEncoding API. Looks like our lib version is out-dated.

Thanks for your help!

-Ying

Hi,

It looks like a strange character is added to the beginning of the file after I use API to save the cvs:
this.workbook.getSaveOptions().setEncoding(“UTF-8”);

If you open the csv in Text Editor, you will not be able to see this character, but if you call the substring() function to get it in JAVA, you will see it.

We are using the latest version 2.2.0.0 dated
04-16-2010.

Please response asap since this is very critical for our current release.

Thanks!

Another note:

If I use your latest version of 2.3, the issue does not exist, no strange character is added into the beginning of the file.

Hi,

Well, it might a bug in in some older versions for saving CSV file. So, I am afraid you have to use our latest versions to solve the problem, there is no other alternative to that issue.



Thank you.