Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all articles
Browse latest Browse all 1877

Commented Issue: Workbook cannot be opened if it contains a table that is filtered by a date. [8581]

$
0
0
The following code results in an InvalidCastException when the Workbook contains a table where a column is filtered by the date. At example workbook is attached.

```
new XLWorkbook(@"C:\Scratch\DateFilter example.xlsx")
```

The full details of the exception are:
```
Unable to cast object of type 'DocumentFormat.OpenXml.Spreadsheet.DateGroupItem' to type 'DocumentFormat.OpenXml.Spreadsheet.Filter'.
at ClosedXML.Excel.XLWorkbook.LoadAutoFilterColumns(AutoFilter af, XLAutoFilter autoFilter)
at ClosedXML.Excel.XLWorkbook.LoadSpreadsheetDocument(SpreadsheetDocument dSpreadsheet)
at ClosedXML.Excel.XLWorkbook.LoadSheets(String fileName)
at ClosedXML.Excel.XLWorkbook..ctor(String file)
```
Comments: ** Comment from web user: Ged325 **

Please note the above is NOT tested for all cases, but it bypassed the issue for me to allow it to open. For my project I'm not using filters, I just need the spreadsheet data.


Viewing all articles
Browse latest Browse all 1877

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>