Skip to content
This repository was archived by the owner on Mar 9, 2020. It is now read-only.

Conversation

@Michael-Greiner
Copy link

EPPlus seems to have a problem, if the sheetData tag in a Worksheet has a XML namespace prefix:
After changing and saving the file, the Worksheet is empty.

How to reproduce the problem, using the attached file:

In Windows Powershell execute:

Add-Type -Path "C:\Users\xxx\Documents\Softwareentwicklung\libraries\EPPlus\EPPlus\EPPlus\bin\Debug\net40\EPPlus.dll"
$Path = "C:\Users\xxx\Desktop\PCC_definition_export_20190704133330_DE_EN.xlsx"
[OfficeOpenXml.ExcelPackage]$excelPackage = New-Object OfficeOpenXML.ExcelPackage($Path)
[OfficeOpenXml.ExcelWorkbook]$book = $excelPackage.Workbook
[OfficeOpenXml.ExcelWorksheet]$dataSheet = $book.Worksheets[1]
[OfficeOpenXml.ExcelRange]$cells = $dataSheet.Cells
$cells["A3"].Value # Display content of A3
$cells["A3"].Value = "asdf"
$excelPackage.SaveAs("$($Path)2.xlsx")

Problem: The saved file has an empty worksheet :-(

How I fixed the problem:
Just remove the namespace prefix.
Why would you use a namespace prefix for the document wide namespace anyway? :-)

PCC_definition_export_20190704133330_DE_EN.xlsx

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant