diff --git a/README.md b/README.md
index c9a1449e2..469ad5727 100644
--- a/README.md
+++ b/README.md
@@ -270,6 +270,9 @@ worksheet.pageSetup.margins = {
// Set Print Area for a sheet
worksheet.pageSetup.printArea = 'A1:G20';
+// Repeat specific rows on every printed page
+worksheet.pageSetup.printTitlesRow = '1:3';
+
```
**Supported pageSetup settings**
@@ -1712,4 +1715,4 @@ If any splice operation affects a merged cell, the merge group will not be moved
| 0.4.2 |
Addressed the following issues:
These issues are potentially caused by a bug that caused colours with zero themes, tints or indexes to be rendered and parsed incorrectly.Regarding themes: the theme files stored inside the xlsx container hold important information regarding colours, styles etc and if the theme information from a loaded xlsx file is lost, the results can be unpredictable and undesirable. To address this, when an ExcelJS Workbook parses an XLSX file, it will preserve any theme files it finds and include them when writing to a new XLSX. If this behaviour is not desired, the Workbook class exposes a clearThemes() function which will drop the theme content. Note that this behaviour is only implemented in the document based Workbook class, not the streamed Reader and Writer.
|
| 0.4.3 | |
| 0.4.4 | |
-| 0.4.6 | |
+| 0.4.6 | |
\ No newline at end of file
diff --git a/lib/xlsx/xform/book/workbook-xform.js b/lib/xlsx/xform/book/workbook-xform.js
index 35e922a87..5711a642c 100644
--- a/lib/xlsx/xform/book/workbook-xform.js
+++ b/lib/xlsx/xform/book/workbook-xform.js
@@ -60,6 +60,18 @@ utils.inherits(WorkbookXform, BaseXform, {
};
printAreas.push(definedName);
}
+ if (sheet.pageSetup && sheet.pageSetup.printTitlesRow) {
+
+ var titlesRows = sheet.pageSetup.printTitlesRow.split(':');
+
+ var definedName = {
+ name: '_xlnm.Print_Titles',
+
+ ranges: ['\'' + sheet.name + '\'!$' + titlesRows[0] + ':$' + titlesRows[1]],
+ localSheetId: index
+ };
+ printAreas.push(definedName);
+ }
index++;
});
if (printAreas.length) {
diff --git a/test/testWbXform.js b/test/testWbXform.js
new file mode 100644
index 000000000..76160e45a
--- /dev/null
+++ b/test/testWbXform.js
@@ -0,0 +1,28 @@
+
+var Excel = require('../excel');
+
+var filename = process.argv[2];
+
+var wb = new Excel.Workbook();
+
+var ws = wb.addWorksheet('printHeader');
+
+
+ws.getCell('A1').value = 'This is a header row repeated on every printed page';
+ws.getCell('B2').value = 'This is a header row too';
+
+for (var i=0 ; i < 100 ; i++){
+ ws.addRow(['not header row']);
+};
+
+
+ws.pageSetup.printTitlesRow = '1:2';
+
+
+wb.xlsx.writeFile(filename)
+ .then(function() {
+ console.log('Done.');
+ })
+ .catch(function(error) {
+ console.log(error.message);
+ });
\ No newline at end of file