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 illustrates the behavior to generate a CSV file for the 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 |