Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Tue Nov 03, 2020 7:54 pm

I am loading a 6 column spreadsheet from a data table and I am getting error flags in the cells of one of the columns that appear to be NumberToText related. I have tried everything to resolve this and the IgnoreErrorOptions is not working to eliminate these cells from being flagged. Can you help?
Attachments
Capture.JPG
Capture.JPG (37.38 KiB) Viewed 965 times

wetovickk
 
Posts: 1
Joined: Tue Nov 03, 2020 7:42 pm

Wed Nov 04, 2020 3:11 am

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
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
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Mon Nov 16, 2020 6:08 am

Hello,

How is your issue now? Could you please give us some feedback at your convenience?

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.XLS