File tree Expand file tree Collapse file tree 2 files changed +23
-8
lines changed Expand file tree Collapse file tree 2 files changed +23
-8
lines changed Original file line number Diff line number Diff line change @@ -45,21 +45,16 @@ class WorkbookXform extends BaseXform {
4545 const definedName = {
4646 name : '_xlnm.Print_Area' ,
4747 localSheetId : index ,
48- ranges :[ ]
48+ ranges : [ ] ,
4949 } ;
5050 sheet . pageSetup . printArea . split ( '&&' ) . forEach ( printArea => {
5151 const printAreaComponents = printArea . split ( ':' ) ;
52- definedName . ranges . push (
53- `'${ sheet . name } '!$${ printAreaComponents [ 0 ] } :$${ printAreaComponents [ 1 ] } `
54- ) ;
52+ definedName . ranges . push ( `'${ sheet . name } '!$${ printAreaComponents [ 0 ] } :$${ printAreaComponents [ 1 ] } ` ) ;
5553 } ) ;
5654 printAreas . push ( definedName ) ;
5755 }
5856
59- if (
60- sheet . pageSetup &&
61- ( sheet . pageSetup . printTitlesRow || sheet . pageSetup . printTitlesColumn )
62- ) {
57+ if ( sheet . pageSetup && ( sheet . pageSetup . printTitlesRow || sheet . pageSetup . printTitlesColumn ) ) {
6358 const ranges = [ ] ;
6459
6560 if ( sheet . pageSetup . printTitlesColumn ) {
Original file line number Diff line number Diff line change 1+ const ExcelJS = verquire ( 'exceljs' ) ;
2+
3+ // const NEW_TEST_17_XLSX_FILE_NAME = './spec/integration/data/test-new-pr-17.xlsx';
4+
5+ describe ( 'new pr related issues' , ( ) => {
6+ describe ( 'new pr 17 serialize and deserialize multiple print areas on one worksheet' , ( ) => {
7+ it ( 'Multiple print areas can be correctly read to settings' , async ( ) => {
8+ const wb = new ExcelJS . Workbook ( ) ;
9+ const ws = wb . addWorksheet ( 'sheet' ) ;
10+ const writePrintArea = 'A2:B5&&A7:B10&&A13:B17' ;
11+ ws . pageSetup . printArea = writePrintArea ;
12+ // await wb.xlsx.writeFile(NEW_TEST_17_XLSX_FILE_NAME);
13+ const buffer = await wb . xlsx . writeBuffer ( ) ;
14+ await wb . xlsx . load ( buffer ) ;
15+ const worksheet = wb . getWorksheet ( 'sheet' ) ;
16+ const readPintArea = worksheet . pageSetup . printArea ;
17+ expect ( writePrintArea ) . to . equal ( readPintArea ) ;
18+ } ) ;
19+ } ) ;
20+ } ) ;
You can’t perform that action at this time.
0 commit comments