Hello,
Thank you for your inquiry,
I tested the following code with the latest
Spire.XLS Pack(Hotfix) Version:10.10.6, but found the IgnoreErrorOptions works well. If you are using an older version, please download the latest version and try again.
- Code: Select all
Workbook workbook = new Workbook();
workbook.CreateEmptySheets(1);
Worksheet sheet = workbook.Worksheets[0];
DataTable dataTable = new DataTable("Test");
dataTable.Columns.Add("IgnoreError", typeof(string));
dataTable.Columns.Add("DoNotIgnoreError", typeof(string));
DataRow dr = dataTable.NewRow();
dr[0] = 1;
dr[1] = 1;
dataTable.Rows.Add(dr);
dr = dataTable.NewRow();
dr[0] = 2;
dr[1] = 2;
dataTable.Rows.Add(dr);
dr = dataTable.NewRow();
dr[0] = 3;
dr[1] = 3;
dataTable.Rows.Add(dr);
dr = dataTable.NewRow();
dr[0] = 4;
dr[1] = 4;
dataTable.Rows.Add(dr);
sheet.InsertDataTable(dataTable, true, 1, 1);
sheet.Columns[0].IgnoreErrorOptions = IgnoreErrorType.NumberAsText;
sheet.AutoFitColumn(1);
sheet.AutoFitColumn(2);
string result = "ImportDataFromDataTable_output.xlsx";
workbook.SaveToFile(result, ExcelVersion.Version2013);
My output:
- output.png (7.02 KiB) Viewed 952 times
If the issue still occurs after trying, please provide your full test code to help us investigate further. Thanks in advance.
Sincerely,
Brian
E-iceblue support team