mk-j / PHP_XLSXWriter

Lightweight XLSX Excel Spreadsheet Writer in PHP
MIT License
1.84k stars 663 forks source link

Is there any way to set a Page Break? #314

Open jaraiza opened 2 years ago

jaraiza commented 2 years ago

Hi, I've tried to use the same format as PHPExcel:

$writer->getActiveSheet()->setBreak( 'A15', PHPExcel_Worksheet::BREAK_ROW );

but then I realized there's no "getActiveSheet" neither "setBreak" code inside xlsxwriter.class.php. Is there any way to accomplish that?

image

Thanks!

jaraiza commented 2 years ago

Ok, I've found that editing the XML I can set manually the page breaks

Under line 319 $sheet->file_writer->write( '</headerFooter>');

I can add this: $sheet->file_writer->write( '<rowBreaks count="1" manualBreakCount="1">'); $sheet->file_writer->write( '<brk id="8" max="16383" man="1"/>'); $sheet->file_writer->write( '</rowBreaks>');

And the file is created with a row break below row 8.

Any ideas on how to add a function to recreate this behavior?

Thanks!