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

consider header/footer specs hf_spec() #85

Open
jmbarbone opened this issue Mar 12, 2022 · 2 comments
Open

consider header/footer specs hf_spec() #85

jmbarbone opened this issue Mar 12, 2022 · 2 comments

Comments

@jmbarbone
Copy link
Collaborator

probably would be better to do something like :

hf_spec <- function(type = c("header", "footer"), default = NULL, odd = default, even = default, first = default, last = default) {
  type <- match.arg(type)
  ...
  structure(ls, class = "header_footer_spec")
}

# fun printing
print.header_footer_spec <- function(x, ...) {
  ... 
  invisible(x)
}

And handle the header and footer separately. Would be easy then to toggle:

# even only:
hf_spec("header", odd = "odd_header_here")

# skip first page:
hf_spec("header", "default_spec_here", first = NULL)

... and etc, etc.

  • make it easy to set header and footer text
  • consider ability to use an image (e.g. company logo) (perhaps something like hf_spec("header", "{image1} Header text {image2}", images = list(image1 = filepath1.png, image2 = filepath2.png))? But I don't really know how this is done with the xml
@JanMarvin
Copy link
Owner

JanMarvin commented Mar 12, 2022

I quickly drafted an example and had a look at the xml: logo_hf.xlsx

<headerFooter>
<!-- left header: P is current Page, N is number of pages -->
<!-- center header: current date and time 2022-03-13 00:04 CET in dd.mm.yy hh:mm notation -->
<!-- right header: the graphic rId1 -->
<oddHeader>&L&P/&N&C&"System Font,Regular"&10&K000000&D &T&R&G</oddHeader>
</headerFooter>
<legacyDrawingHF r:id="rId1"/>

Needs the following (should all be copyable from insertImage)

  • content_types entries: png,
  • media
  • vmlDrawing
  • vmlDrawing_rel pointing to media
  • legacy drawing entry in worksheet
  • worksheet_rel entry pointing to vml_drawing

Guess we can use all of the insertImage code, but instead of adding it somewhere in the worksheet, we add it to the header. But that's as far I am about to go with this issue 😄

[Edit] "Only one picture can be inserted in each section of the header."

@JanMarvin
Copy link
Owner

ofc duplication should be minimised, maybe we can simply extract the media to workbook part and make the include image to worksheet/header part special cases

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

No branches or pull requests

2 participants