@@ -93,6 +93,71 @@ describe('Workbook', function() {
9393 . then ( function ( wb2 ) {
9494 var ws2 = wb2 . getWorksheet ( 'printHeader' ) ;
9595 expect ( ws2 . pageSetup . printTitlesRow ) . to . equal ( '$1:$2' ) ;
96+ expect ( ws2 . pageSetup . printTitlesColumn ) . to . be . undefined ;
97+ } ) ;
98+ } ) ;
99+ it ( 'printTitlesColumn' , function ( ) {
100+ var wb = new Excel . Workbook ( ) ;
101+ var ws = wb . addWorksheet ( 'printColumn' ) ;
102+
103+ ws . getCell ( 'A1' ) . value = 'This is a column repeated on every printed page' ;
104+ ws . getCell ( 'A2' ) . value = 'This is a column repeated on every printed page' ;
105+ ws . getCell ( 'B1' ) . value = 'This is a repeated column too' ;
106+ ws . getCell ( 'B2' ) . value = 'This is a repeated column too' ;
107+
108+ ws . getCell ( 'C1' ) . value = 'This is a regular column' ;
109+ ws . getCell ( 'C2' ) . value = 'This is a regular column' ;
110+ ws . getCell ( 'D1' ) . value = 'This is a regular column' ;
111+ ws . getCell ( 'D2' ) . value = 'This is a regular column' ;
112+
113+ ws . pageSetup . printTitlesRow = 'A:B' ;
114+
115+ return wb . xlsx . writeFile ( TEST_XLSX_FILE_NAME )
116+ . then ( function ( ) {
117+ var wb2 = new Excel . Workbook ( ) ;
118+ return wb2 . xlsx . readFile ( TEST_XLSX_FILE_NAME ) ;
119+ } )
120+ . then ( function ( wb2 ) {
121+ var ws2 = wb2 . getWorksheet ( 'printColumn' ) ;
122+ expect ( ws2 . pageSetup . printTitlesRow ) . to . be . undefined ;
123+ expect ( ws2 . pageSetup . printTitlesColumn ) . to . equal ( '$A:$B' ) ;
124+ } ) ;
125+ } ) ;
126+ it ( 'printTitlesRowAndColumn' , function ( ) {
127+ var wb = new Excel . Workbook ( ) ;
128+ var ws = wb . addWorksheet ( 'printHeaderAndColumn' ) ;
129+
130+ ws . getCell ( 'A1' ) . value = 'This is a column / row repeated on every printed page' ;
131+ ws . getCell ( 'A2' ) . value = 'This is a column / row repeated on every printed page' ;
132+ ws . getCell ( 'B1' ) . value = 'This is a repeated column / row too' ;
133+ ws . getCell ( 'B2' ) . value = 'This is a repeated column / row too' ;
134+
135+ ws . getCell ( 'C1' ) . value = 'This is a regular column, repeated row' ;
136+ ws . getCell ( 'C2' ) . value = 'This is a regular column, repeated row' ;
137+ ws . getCell ( 'D1' ) . value = 'This is a regular column, repeated row' ;
138+ ws . getCell ( 'D2' ) . value = 'This is a regular column, repeated row' ;
139+
140+ ws . getCell ( 'A3' ) . value = 'This is a repeated column' ;
141+ ws . getCell ( 'B3' ) . value = 'This is a repeated column' ;
142+ ws . getCell ( 'C3' ) . value = 'This is a regular column / row' ;
143+ ws . getCell ( 'D3' ) . value = 'This is a regular column / row' ;
144+
145+ ws . pageSetup . printTitlesColumn = 'A:B' ;
146+ ws . pageSetup . printTitlesRow = '1:2' ;
147+
148+ for ( var i = 0 ; i < 100 ; i ++ ) {
149+ ws . addRow ( [ 'repeated column, not repeated row' , 'repeated column, not repeated row' , 'no repeat' , 'no repeat' ] ) ;
150+ }
151+
152+ return wb . xlsx . writeFile ( TEST_XLSX_FILE_NAME )
153+ . then ( function ( ) {
154+ var wb2 = new Excel . Workbook ( ) ;
155+ return wb2 . xlsx . readFile ( TEST_XLSX_FILE_NAME ) ;
156+ } )
157+ . then ( function ( wb2 ) {
158+ var ws2 = wb2 . getWorksheet ( 'printHeaderAndColumn' ) ;
159+ expect ( ws2 . pageSetup . printTitlesRow ) . to . equal ( '$1:$2' ) ;
160+ expect ( ws2 . pageSetup . printTitlesColumn ) . to . equal ( '$A:$B' ) ;
96161 } ) ;
97162 } ) ;
98163
0 commit comments