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

Fixed problem with namespace prefix for sheetData tag in worksheet. #611

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

None yet

1 participant