@@ -42,21 +42,19 @@ class WorkbookXform extends BaseXform {
4242 let index = 0 ; // sheets is sparse array - calc index manually
4343 model . sheets . forEach ( sheet => {
4444 if ( sheet . pageSetup && sheet . pageSetup . printArea ) {
45+ const definedName = {
46+ name : '_xlnm.Print_Area' ,
47+ localSheetId : index ,
48+ ranges : [ ] ,
49+ } ;
4550 sheet . pageSetup . printArea . split ( '&&' ) . forEach ( printArea => {
4651 const printAreaComponents = printArea . split ( ':' ) ;
47- const definedName = {
48- name : '_xlnm.Print_Area' ,
49- ranges : [ `'${ sheet . name } '!$${ printAreaComponents [ 0 ] } :$${ printAreaComponents [ 1 ] } ` ] ,
50- localSheetId : index ,
51- } ;
52- printAreas . push ( definedName ) ;
52+ definedName . ranges . push ( `'${ sheet . name } '!$${ printAreaComponents [ 0 ] } :$${ printAreaComponents [ 1 ] } ` ) ;
5353 } ) ;
54+ printAreas . push ( definedName ) ;
5455 }
5556
56- if (
57- sheet . pageSetup &&
58- ( sheet . pageSetup . printTitlesRow || sheet . pageSetup . printTitlesColumn )
59- ) {
57+ if ( sheet . pageSetup && ( sheet . pageSetup . printTitlesRow || sheet . pageSetup . printTitlesColumn ) ) {
6058 const ranges = [ ] ;
6159
6260 if ( sheet . pageSetup . printTitlesColumn ) {
@@ -193,10 +191,12 @@ class WorkbookXform extends BaseXform {
193191 if ( ! worksheet . pageSetup ) {
194192 worksheet . pageSetup = { } ;
195193 }
196- const range = colCache . decodeEx ( definedName . ranges [ 0 ] ) ;
197- worksheet . pageSetup . printArea = worksheet . pageSetup . printArea
198- ? `${ worksheet . pageSetup . printArea } &&${ range . dimensions } `
199- : range . dimensions ;
194+ for ( let i = 0 ; i < definedName . ranges . length ; ++ i ) {
195+ const range = colCache . decodeEx ( definedName . ranges [ i ] ) ;
196+ worksheet . pageSetup . printArea = worksheet . pageSetup . printArea
197+ ? `${ worksheet . pageSetup . printArea } &&${ range . dimensions } `
198+ : range . dimensions ;
199+ }
200200 }
201201 } else if ( definedName . name === '_xlnm.Print_Titles' ) {
202202 worksheet = worksheets [ definedName . localSheetId ] ;
0 commit comments