Whow to enable autofilter in excelhatm5?

Whow to enable autofilter in excelhatm5?

i have the following piece of code.

{
title: reportName,
extend: 'excelHtml5',
autoFilter: true,
filename: reportFileName(type),
customize: function(xlsx) {
var sheet = xlsx.xl.worksheets['sheet1.xml'];
var new_style = '<?xml version="1.0" encoding="UTF-8"?><styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac" xmlns:x14ac="https://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"><numFmts count="2"><numFmt numFmtId="171" formatCode="d/mm/yyyy;@/><numFmt numFmtId="172" formatCode="m/d/yyyy;@/></numFmts><fonts count="1" x14ac:knownFonts="1"><font><sz val="11"/><color theme="1"/><name val="Calibri"/><family val="2"/><scheme val="minor"/></font></fonts><fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="solid"><fgColor rgb="FFFFFF00"/><bgColor indexed="64"/></patternFill></fill></fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="2"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/><xf numFmtId="9" fontId="1" fillId="0" borderId="0" applyFont="0" applyFill="0" applyBorder="0" applyAlignment="0" applyProtection="0"/></cellStyleXfs><cellXfs count="2"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/><xf numFmtId="0" fontId="0" fillId="1" borderId="0" xfId="0" applyAlignment="1"></xf></cellXfs><cellStyles count="2"><cellStyle name="Procent" xfId="1" builtinId="0"/><cellStyle name="Standaard" xfId="0" builtinId="0"/></cellStyles><dxfs count="0"/><tableStyles count="0" defaultTableStyle="TableStyleMedium2" defaultPivotStyle="PivotStyleLight16"/><colors><mruColors><color rgb="FFFFFF00"/></mruColors></colors><extLst><ext uri="{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}" xmlns:x14="https://schemas.microsoft.com/office/spreadsheetml/2009/9/main"><x14:slicerStyles defaultSlicerStyle="SlicerStyleLight1"/></ext></extLst></styleSheet>';
var f1 = '<sheetViews><sheetView><pane ySplit="1" state="frozen" /></sheetView></sheetViews>';
var f2 = '<autoFilter ref="A1:Y1"/>';
xlsx.xl['styles.xml'] = $.parseXML(new_style);
$('row:first c', sheet).attr('s','1');
$('worksheet', sheet).prepend(f1);
$('worksheet', sheet).append(f2);
}
},

which should export excel. in which the autofilter must be enabled and the first line must be fixed and yellow.
The file is created and saved. After opening the file through google docs and through LibereOffice, the first line is fixed and colored in yellow when the file is opened.
but without the autofilter enabled.
But if you open it in Microsoft Office, it gives an error and offers to correct the file. Then when opening the file we have the first line fixed but with a gray background and no autofilter enabled

Answers

Sign In or Register to comment.