davidgohel / flextable

table farming
https://ardata-fr.github.io/flextable-book/
554 stars 79 forks source link

Repeated footer for long tables #566

Closed cwilso6 closed 1 year ago

cwilso6 commented 1 year ago

I wondering if it is possible to add a feature for repeating the footer for each page of a long table. Here is a basic example of the challenge.

---
title: "Untitled"
format: 
  docx:
    keep-md: false
---
library(flextable)
library(officer)
knitr::opts_chunk$set(echo = FALSE)
ft <- flextable(mtcars)
ft |> add_footer_lines("Some additional info about table") |>
  paginate(hdr_ftr = TRUE, init = FALSE) #not complete sure this is need or helpful

which produced: image

and what I am hoping for is image

which was not straightforward I inserted a row below in the second to last row on the first page, merged the new cells, added a border on the top of the new row, and left-aligned the text. I recognize that this can be done manually but my team is hoping to automate the report generation as it will be generated from a shiny app.

davidgohel commented 1 year ago

Hello, what you are asking is not possible because MS Word does not come with a table footer concept. It is not feasible. The only workaround would be to add the table in its proper section and to add a section page footer where your content will repeated until the section is closed.

github-actions[bot] commented 6 months ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.