Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexOutOfRangeException when opening the excel workbook #2266

Open
2 tasks
sjanisz opened this issue Jan 18, 2024 · 0 comments
Open
2 tasks

IndexOutOfRangeException when opening the excel workbook #2266

sjanisz opened this issue Jan 18, 2024 · 0 comments

Comments

@sjanisz
Copy link

sjanisz commented Jan 18, 2024

Do you want to request a feature or report a bug?

  • [] Bug
  • Feature
  • [x ] Question

Did you test against the latest CI build?

  • Yes
  • [ x] No

Version of ClosedXML

0.102.2

What is the current behavior?

IndexOutOfRangeException exception thrown

What is the expected behavior or new feature?

No exception

Code to reproduce problem:

public void Main()
{
    using (var workbook = new XLWorkbook(filePath1))
{
    return;
}
}

Issue is similar to #144 however I am not able to reproduce it using file from that issue.
Unfortunately I am not able to send Excel file, when I try to open specific excel from code it throws me mentioned exception, call stack:

   at ClosedXML.Excel.XLWorkbook.GetFormula(String value)
   at ClosedXML.Excel.XLWorkbook.LoadConditionalFormatting(ConditionalFormatting conditionalFormatting, XLWorksheet ws, Dictionary`2 differentialFormats)
   at ClosedXML.Excel.XLWorkbook.LoadSpreadsheetDocument(SpreadsheetDocument dSpreadsheet)
   at ClosedXML.Excel.XLWorkbook.LoadSheets(String fileName)
   at ClosedXML.Excel.XLWorkbook..ctor(String file)
   at DebugConsoleApp.ClosedXml.Debug() in C:\Users\xxx\Desktop\proj\dummy\TESTING_PROJECT\DebugConsoleApp\ClosedXml.cs:line 16
   at DebugConsoleApp.Program.Main(String[] args) in C:\Users\xxx\Desktop\proj\dummy\TESTING_PROJECT\DebugConsoleApp\Program.cs:line 28

When I open file i see it is in protected view, that view itself cannot be the problem because other files, also with protected view work ok. When I open such file manually, disable protected view and just save the file it works ok from code. I know it is impossible to find out the root cause now but maybe reading above description someone would have an idea what could help there?
Tried with other excel library (EPPlus last GNU version) and it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant