LoadOptions for GridWeb

Load with Other Encoding

For a CSV file, it is actually a text‑based file without the specific encoding described in the XLSX format.

Therefore, users can set a specific character encoding before loading the file.

Here is a sample code to load a Chinese CSV file:

GridTxtLoadOptions topt = new GridTxtLoadOptions();
topt.Encoding = Encoding.GetEncoding("GB2312");
GridWeb1.LoadOptions = topt;
string filePath = Server.MapPath("~/workbook/chinesefile.csv");
GridWeb1.ImportExcelFile(filePath);