سؤال

I Open a excel file inside c# using OpenXML.

This works just fine. I can read and modify the values, etc.

Now I added a new Column "DD" to that file and suddenly I cannot access Data in that column.

  private static Row GetRow(Worksheet worksheet, uint rowIndex)
        {
            return worksheet.GetFirstChild<SheetData>().Elements<Row>().First(r => r.RowIndex == rowIndex);
        }
Row row = GetRow(worksheet, rowIndex);

When I try to get any Cell-Value of the added column with:

row.Elements<Cell>()

it does not contain the new column, but ends at Column "DC" (Index 106)

[Columns BP->DC are hidden if this might be an issue]

Is there a limitation Number of Columns that OpenXML can read? Or might there be another reason?

(Other options like using ClosedXml do not work for me. This project is already very complex and I cannot start all over again)

هل كانت مفيدة؟

المحلول

Solved it.

If I add data by just scrolling right and entering data into a cell I got the problem like described.

But when I insert a new Column by rightclicking on the last column and selecting "insert" instead everything is fine.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top