Skip to content
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 an option to scale the font size of the header/footer with the document #1085

Closed
jploetner opened this issue Jul 17, 2024 · 1 comment · Fixed by #1086
Closed

Add an option to scale the font size of the header/footer with the document #1085

jploetner opened this issue Jul 17, 2024 · 1 comment · Fixed by #1086

Comments

@jploetner
Copy link

Hello,

when creating an excel file I scale the content to fit on one page with wb_page_setup(fit_to_width = 1) for printing, which works fine. The problem is that the font sizes of the header and footer are too big, because per default they are not scaled as well. In Excel there is an option in View -> Page Layout -> click on the header or footer -> Design called Scale with document. If you check it, then the header/footer are automatically scaled as well. But right now there is no argument in openxlsx2 to change it.

If you create the following file:

library(openxlsx2)

wb <- wb_workbook() %>%
  wb_add_worksheet(header = c(NA, "Header", NA), orientation = "landscape") %>%
  wb_page_setup(fit_to_width = 1) %>%
  wb_add_data(x = as.data.frame(matrix(1:500, ncol = 25)))

wb$open()

you can see in the following screenshot that "Header" is larger than the rest of the document (Unfortunately, I wasn't able to change the language of my Excel at the moment):

grafik

However, if you check Scale with document "Header" is scaled as well:

grafik

It would be great, if an option to change that Scale with document-parameter could be added to ensure that the whole document and not just the body is scaled when fitting a worksheet to a fixed number of pages.

@JanMarvin
Copy link
Owner

Hi @jploetner , thanks for the report and I appreciate the screenshots (never would have guessed the impact). I have prepared a PR which should solve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants