-
-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for headerFooter, fitToHeight/Width, printTitleRows (xlsx only) #208
Conversation
@@ -329,7 +332,9 @@ public function createContentFiles(Options $options, array $worksheets): self | |||
fwrite($worksheetFilePointer, '<sheetPr filterMode="false"><pageSetUpPr fitToPage="false"/></sheetPr>'); | |||
fwrite($worksheetFilePointer, sprintf('<dimension ref="%s"/>', $range)); | |||
} | |||
|
|||
if (isset($pageSetup) && $pageSetup->fitToPage) { | |||
fwrite($worksheetFilePointer, '<sheetPr><pageSetUpPr fitToPage="true"/></sheetPr>'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sheetPr
tag is already written within the autofilter if
few lines above: we need to handle the case where both are used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I understand, when both autofilter and fitToPage are turned on, the fitToPage attribute will be true, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed it to handle the case.
b826464
@@ -6,8 +6,16 @@ | |||
|
|||
final class PageSetup | |||
{ | |||
public bool $fitToPage = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public bool $fitToPage = false; | |
public readonly bool $fitToPage = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, this can't be accepted. The following error occurs:
$fitToPage cannot have default value
Besides, fitToPage value depends on fitToHeight and fitToWidth, which is passed to the constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just remove the default value and set it in the constructor as
$this->fitToPage = null !== $fitToHeight || null !== $fitToWidth;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed it.
Co-authored-by: Filippo Tessarotto <zoeslam@gmail.com>
…openspout into headerFooter_fitToHW
Thank you @tekku-taro 💪 |
Add support for headerFooter, fitToHeight/Width, printTitleRows (xlsx only)
headerFooter
Header and footer can be set via Options::setHeaderFooter()
fitToHeight/Width
Add new arguments for fitToHeight and fitToWidth to the PageSetup constructor.
printTitleRows
Print title rows can be set at the sheet level for XLSX writers.
Examples (preview images)