forked from exceljs/exceljs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request exceljs#1042 from AlexanderPruss/1041-MultiplePrin…
…tAreas 1041 multiple print areas
- Loading branch information
Showing
3 changed files
with
54 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
const Excel = require('../excel'); | ||
|
||
const {Workbook} = Excel; | ||
|
||
const [, , filename] = process.argv; | ||
|
||
const wb = new Workbook(); | ||
const ws = wb.addWorksheet('test sheet'); | ||
|
||
for (let row = 1; row <= 10; row++) { | ||
const values = []; | ||
if (row === 1) { | ||
values.push(''); | ||
for (let col = 2; col <= 10; col++) { | ||
values.push(`Col ${col}`); | ||
} | ||
} else { | ||
for (let col = 1; col <= 10; col++) { | ||
if (col === 1) { | ||
values.push(`Row ${row}`); | ||
} else { | ||
values.push(`${row}-${col}`); | ||
} | ||
} | ||
} | ||
ws.addRow(values); | ||
} | ||
|
||
ws.pageSetup.printTitlesColumn = 'A:A'; | ||
ws.pageSetup.printTitlesRow = '1:1'; | ||
ws.pageSetup.printArea = 'A1:B5&&A6:B10'; | ||
|
||
wb.xlsx | ||
.writeFile(filename) | ||
.then(() => { | ||
console.log('Done.'); | ||
}) | ||
.catch(error => { | ||
console.log(error.message); | ||
}); |