We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug With v3.0.2 AddWorkbookPart method is throwing exception - The specified package is invalid. The main part is missing.
Refer attached file (EmptyExcel.xlsx) to be used with below sample code.
using (SpreadsheetDocument document = SpreadsheetDocument.Open($"EmptyExcel.xlsx", true)) { if (document.WorkbookPart != null) { document.DeletePart(document.WorkbookPart); } /*** below line throws error ***/ var workbookPart = document.AddWorkbookPart(); workbookPart.Workbook.Save(); }
Observed behavior Exception - The specified package is invalid. The main part is missing. Kindly note that same is working with v2.20.0.
Expected behavior It should add workbook part instead of throwing exception.
Desktop (please complete the following information):
Debug Info Adding below line post delete part call resolves issue
document.ChangeDocumentType(SpreadsheetDocumentType.Workbook);
The text was updated successfully, but these errors were encountered:
Use default document type if no main part is available
176f828
Fixes #1745
4ec5720
twsouthwick
Successfully merging a pull request may close this issue.
Describe the bug
With v3.0.2 AddWorkbookPart method is throwing exception - The specified package is invalid. The main part is missing.
Refer attached file (EmptyExcel.xlsx) to be used with below sample code.
Observed behavior
Exception - The specified package is invalid. The main part is missing. Kindly note that same is working with v2.20.0.
Expected behavior
It should add workbook part instead of throwing exception.
Desktop (please complete the following information):
Debug Info
Adding below line post delete part call resolves issue
document.ChangeDocumentType(SpreadsheetDocumentType.Workbook);
The text was updated successfully, but these errors were encountered: