Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/button/excelHtml5.xml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@
Enable Excel's auto filter feature for the header cells in the table allowing the user to quickly filter and sort the exported spreadsheet in Excel. Note that this does not operate in LibreOffice (although the spreadsheet is still readable).
</option>

<option type="boolean" name="fixedHeader" default="false" since="3.0.2">
Freeze the header cells in the table allowing the user to always see the header as they scroll the spreadsheet.
</option>



<example title="DataTables initialisation: Use the HTML5 Excel button"><![CDATA[
Expand Down
26 changes: 26 additions & 0 deletions js/buttons.html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,32 @@ DataTable.ext.buttons.excelHtml5 = {
);
}

// Make the header fixed while scrolling
if (config.fixedHeader) {
var sheetViews = _createNode(rels, 'sheetViews', {
children: [
_createNode(rels, 'sheetView', {
attr: {
tabSelected: '1',
workbookViewId: '0'
},
children: [
_createNode(rels, 'pane', {
attr: {
xSplit: '0',
ySplit: '2',
topLeftCell: 'A' + (dataStartRow + 1),
activePane: 'bottomRight',
state: 'frozen'
}
})
]
})
]
});
$('worksheet', rels).prepend(sheetViews);
}

// Workbook modifications
var workbook = xlsx.xl['workbook.xml'];

Expand Down