Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2350
ASP.NET MVC Excel - Inserting row creates spreadsheet with 16384 columns
posted

I have a simple Excel spreadsheet that I'm opening using the Infragistics.Documents.Excel.Workbook class. I'm then inserting a single row, and then resaving to a new file.

The problem is that the saved worksheet has the maximum 16384 columns in the spreadsheet. The original only had 26 columns.

I'm having this issue in a lot of different workbooks that I use the row insert logic in. I narrowed it down to this simple example which is attached in the "Excel Insert Bug13.xlsx" file. If I simply create a new worksheet from scratch, then I can properly save it programatically without the extra columns. My issue is that I've already created 40 different worksheets where I am inserting data and the problem occurs in most of them. As you can see from the attached example, I've tried to narrow down the problem as much as I could and I still can't figure out what is causing this behavior.

Here is my code for duplicating this:

Workbook m_Workbook = Workbook.Load(@"C:\Workspace\Excel Insert Bug13.xlsx");

m_Workbook.Worksheets[0].Rows.Insert(0);

m_Workbook.Save(@"C:\Workspace\Output.xlsx");

I am using version 15.1.20151.2112.

Thanks,

Paul

Excel Insert bug.zip