@@ -42,15 +42,18 @@ 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 (
53+ `'${ sheet . name } '!$${ printAreaComponents [ 0 ] } :$${ printAreaComponents [ 1 ] } `
54+ ) ;
5355 } ) ;
56+ printAreas . push ( definedName ) ;
5457 }
5558
5659 if (
@@ -193,10 +196,12 @@ class WorkbookXform extends BaseXform {
193196 if ( ! worksheet . pageSetup ) {
194197 worksheet . pageSetup = { } ;
195198 }
196- const range = colCache . decodeEx ( definedName . ranges [ 0 ] ) ;
197- worksheet . pageSetup . printArea = worksheet . pageSetup . printArea
198- ? `${ worksheet . pageSetup . printArea } &&${ range . dimensions } `
199- : range . dimensions ;
199+ for ( let i = 0 ; i < definedName . ranges . length ; ++ i ) {
200+ const range = colCache . decodeEx ( definedName . ranges [ i ] ) ;
201+ worksheet . pageSetup . printArea = worksheet . pageSetup . printArea
202+ ? `${ worksheet . pageSetup . printArea } &&${ range . dimensions } `
203+ : range . dimensions ;
204+ }
200205 }
201206 } else if ( definedName . name === '_xlnm.Print_Titles' ) {
202207 worksheet = worksheets [ definedName . localSheetId ] ;
0 commit comments