Skip to content

[BUG] Cannot read excel file with custom filter on table #1669

New issue

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

Closed
thambley opened this issue Apr 15, 2021 · 1 comment · Fixed by #1670
Closed

[BUG] Cannot read excel file with custom filter on table #1669

thambley opened this issue Apr 15, 2021 · 1 comment · Fixed by #1670

Comments

@thambley
Copy link
Contributor

🐛 Bug Report

Opening a file with custom auto-filter (like column contains text) on a table does not work:

Unexpected xml node in parseClose: customFilters
    at AutoFilterXform.parseClose (D:\Repos\table_monitor\node_modules\exceljs\lib\xlsx\xform\table\auto-filter-xform.js:76:15)
    at TableXform.parseClose (D:\Repos\table_monitor\node_modules\exceljs\lib\xlsx\xform\table\table-xform.js:90:24)
    at TableXform.parse (D:\Repos\table_monitor\node_modules\exceljs\lib\xlsx\xform\base-xform.js:67:21)

Table XML:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<table xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="xr xr3" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:xr3="http://schemas.microsoft.com/office/spreadsheetml/2016/revision3" id="1" xr:uid="{00000000-000C-0000-FFFF-FFFF00000000}" name="Table1" displayName="Table1" ref="A1:N134" totalsRowShown="0"><autoFilter ref="A1:N134" xr:uid="{10DCEC3C-C001-48A5-ADBD-055627E6CCF7}"><filterColumn colId="0" hiddenButton="1"><customFilters><customFilter val="*brandywine*"/></customFilters></filterColumn></autoFilter><sortState ref="A2:N110" xmlns:xlrd2="http://schemas.microsoft.com/office/spreadsheetml/2017/richdata2"><sortCondition ref="D1:D110"/></sortState><tableColumns count="14"><tableColumn id="1" xr3:uid="{00000000-0010-0000-0000-000001000000}" name="col1"/><tableColumn id="2" xr3:uid="{00000000-0010-0000-0000-000002000000}" name="col2"/><tableColumn id="3" xr3:uid="{00000000-0010-0000-0000-000003000000}" name="col3"/><tableColumn id="4" xr3:uid="{00000000-0010-0000-0000-000004000000}" name="col4"/><tableColumn id="5" xr3:uid="{00000000-0010-0000-0000-000005000000}" name="col5" dataDxfId="1"/><tableColumn id="6" xr3:uid="{00000000-0010-0000-0000-000006000000}" name="col6"/><tableColumn id="7" xr3:uid="{00000000-0010-0000-0000-000007000000}" name="col7"/><tableColumn id="8" xr3:uid="{00000000-0010-0000-0000-000008000000}" name="col8"/><tableColumn id="9" xr3:uid="{00000000-0010-0000-0000-000009000000}" name="col9"/><tableColumn id="11" xr3:uid="{00000000-0010-0000-0000-00000B000000}" name="col11"/><tableColumn id="12" xr3:uid="{00000000-0010-0000-0000-00000C000000}" name="col12"/><tableColumn id="13" xr3:uid="{00000000-0010-0000-0000-00000D000000}" name="col13"/><tableColumn id="14" xr3:uid="{8204CCC8-E383-4638-9511-EED333A12B9B}" name="col14" dataDxfId="0"/><tableColumn id="10" xr3:uid="{1559707A-D027-4A13-8930-0BE0AB218A86}" name="col10"/></tableColumns><tableStyleInfo name="TableStyleLight9" showFirstColumn="0" showLastColumn="0" showRowStripes="0" showColumnStripes="0"/></table>

Lib version: 4.2.1

Steps To Reproduce

const workbook = new Excel.Workbook();
await workbook.xlsx.readFile("customFilter.xlsx");

The expected behaviour:

Read file with a custom auto-filter on a table.

Possible solution (optional, but very helpful):

Parse optional customFilters on table auto-filter column. I will submit a pull request.

@EddyLeon
Copy link

Looking forward to this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants