Reputation: 65
I'm using this code to convert a CSV file to an xls file:
Spire.Xls.Workbook workbook = new Spire.Xls.Workbook();
workbook.LoadFromFile(path + @"\1.csv", ",", 1, 1);
Spire.Xls.Worksheet sheet = workbook.Worksheets[0];
workbook.SaveToFile(path + @"\1.xls");
The generated excel file contains "Numbers Stored as Text" warnings.
I want to ignore/disable all these warnings from C# code.
How do I do this?
Upvotes: 1
Views: 1914
Reputation: 65
I found the solution!
using Excel = Microsoft.Office.Interop.Excel;
Excel.Application app= new Excel.Application();
app.ErrorCheckingOptions.BackgroundChecking = false;//This line disable error checking
Excel.Workbook wb = app.Workbooks.Open(path, 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true);
...
wb.Close(true, url, null);
Upvotes: 3