Quantcast
Channel: NPOI
Viewing all articles
Browse latest Browse all 1621

Created Unassigned: Writing xlsx workbook with active filtering gives corrupted file [13957]

$
0
0
If you open a xlsx workbook that has active filter (filtering turned on AND filter applied such as having rows filtered out), writing it to the disk will create a corrupted file:

"We found a problem with some content in 'filename'. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes."

Then click Yes

"Repaired part: /xl/worksheets/sheet1.xml part with XMl error. Load error. Line 1, column 693."

original xlsx file and corrupted one attached, method to obtain corrupted file below

```
Sub Main()

Dim wb As IWorkbook = WorkbookFactory.Create(originalfilepath)
Using writeStream As New FileStream(newfilepath, FileMode.Create, FileAccess.Write)
wb.Write(writeStream)
End Using

End Sub
```

Viewing all articles
Browse latest Browse all 1621

Trending Articles