How to generate CSV file for other languages?
CSV stands for Comma Separated Values. Files that contain the .csv extension are comma-delimited files, which are very similar to plain text files.
To generate CSV files for other languages, XlsIO enables an UTF8 encoding option while saving the file. The following code snippets illustrate the behavior to generate a CSV file for other languages.
C#
IWorkbook workbook = application.Workbooks.Create(1); // The first worksheet object in the worksheets collection is accessed. IWorksheet worksheet = workbook.Worksheets[0]; worksheet.Range["A1"].Text = "добро пожаловать , Привет, мир"; workbook.Version = ExcelVersion.Excel2013; workbook.Worksheets[0].SaveAs(("output.csv", ",", System.Text.Encoding.UTF8);
VB
Dim workbook As IWorkbook = application.Workbooks.Create(1) 'The first worksheet object in the worksheets collection is accessed. Dim worksheet As IWorksheet = workbook.Worksheets(0) worksheet.Range("A1").Text = "добро пожаловать , Привет, мир" workbook.Version = ExcelVersion.Excel2013 workbook.Worksheets(0).SaveAs(("output.csv", ",", System.Text.Encoding.UTF8)
Figure 1: Output CSV File
The sample to generate CSV file for other languages can be downloaded here.
The encoding options are enabled for better performance, which avoids encoding checks internally. Here, we recommend to use the below code snippet to achieve the requirement with other languages.
'Code to convert to other languages 'Code for ASCII values 'Code that performs internal encoding |
Take a moment to peruse the documentation where you can find basic Excel document processing options along with the features like import and export data, chart, formulas, conditional formatting, data validation, tables, pivot tables and protect the Excel documents, and most importantly, the PDF, CSV and Image conversions with code examples.
Conclusion
I hope you enjoyed learning about how to generate CSV file for other languages.
You can refer to our XIsIO’s feature tour page to learn about its other groundbreaking features. Explore our UG documentation and online demos to understand how to manipulate data in Excel documents.
If you are an existing user, you can access our latest components from the License and Downloads page. For new users, you can try our 30-day free trial to check out XlsIO and other Syncfusion® components.
If you have any queries or require clarification, please let us know in the comments below or contact us through our support forums, Support Tickets, or feedback portal. We are always happy to assist you!