Skip to content

Generated Excel file loses page breaks when prininting area does not start in the first column #3143

@alarai

Description

@alarai

This is:

- [X] a bug report
- [ ] a feature request
- [X] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

What is the expected behavior?

The Printing configuration should be kept after saving the document.

What is the current behavior?

When the printing area does not start on the first column, the page breaks disappears or ar return to automatic ones.

What are the steps to reproduce?

This simple code allows to test the case, it just opens the file and save it without modification.
The area_ko.xlsx gives the following result (left is the original file, right is after opening and saving it with PhpSpreadsheet.)
image

The area.xlsx file is the same case just with the printing area set to start on the first column, and works as expected
image

<?php

require __DIR__ . '/vendor/autoload.php';

// Load the file
$xlsxReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx');
$workbook = $xlsxReader->load('area.xlsx');    
//$workbook = $xlsxReader->load('area_ko.xlsx');    

// Save the file
$writer = new  \PhpOffice\PhpSpreadsheet\Writer\Xlsx($workbook);
$writer->save('result.xlsx');

What features do you think are causing the issue

  • Reader
  • Writer
  • Styles
  • Data Validations
  • Formula Calculations
  • Charts
  • AutoFilter
  • Form Elements

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions