Comments (4)
Could you provide an example to illustrate what exactly you would like to achieve? (either in Word document as attachment or a screenshot)
from r2rtf.
Sorry for the inconvenience. Please see the screenshot below.
As you can see, the table page header and footer have multiple lines and they are in a table environment (one column and multiple rows) with a bottom border in the header and a top border in the footer. And in the header, the first line about page number is right aligned.
Thanks.
from r2rtf.
Multiple line can be handled by provide a vector of text as input.
I will add feature to vectorize text alignment and other formatting argument in rtf_header
and rtf_footer
.
I am not sure why a borderline is required for header and footer. No plan to implement them at current stage.
But you can see how to do it by using some internal function in r2rtf
.
library(r2rtf)
library(magrittr)
# Define a paragraph with different text justification
# ToDo: enable this feature in rtf_header and rtf_footer
header <- r2rtf:::rtf_paragraph(
c("{Page \\pagenumber of \\pagefield}",
"{text1}",
"{text2}"),
justification = c("r", "l","l"),
space_before = 0,
space_after = 0
)
# Defin a dummy table for page header and page footer line
line <- data.frame(x = "") %>%
rtf_page(border_first = "", border_last = "single") %>%
rtf_body(as_colheader = FALSE,
border_left = "",
border_right = "",
border_bottom = "",
cell_height = 0.1) %>%
rtf_footnote(c("foot1", "foot2"), as_table = FALSE, text_font_size = 12) %>%
r2rtf:::rtf_encode_table(verbose = TRUE)
line$body <- gsub("\n", "", line$body, fixed = TRUE)
header <- paste(paste(header, collapse = ""), line$body)
footer <- paste0(line$body, line$footnote)
tbl <- head(iris) %>%
rtf_page_header(header) %>%
rtf_body() %>%
rtf_page_footer(footer)
x <- tbl %>% rtf_encode()
cat(x$body)
tbl %>% rtf_encode() %>% write_rtf("tmp.rtf")
from r2rtf.
This was very helpful. Thanks for the kindly reply. I'll close the issue page.
from r2rtf.
Related Issues (20)
- border_first & page_by HOT 3
- Variations in RTF output across package versions HOT 1
- rtf_subline & page_by HOT 2
- Stop assemble_rtf applying header/footer from last .rtf to entire document HOT 7
- Recreating HAMD17 data HOT 1
- Set different border widths within a section HOT 4
- Remove border between the header and body HOT 1
- Is it possible to add a long free text? HOT 5
- Create FAQ vignette HOT 2
- Refresh RTF and derived artifacts under `vignettes/`
- Release r2rtf 1.1.1 HOT 1
- Garbled code about Chinese character HOT 4
- Unnecessary SVG saving in tests?
- Logo.png in page header for summary tables- RTF format HOT 7
- Page Spread HOT 1
- strings dependency HOT 3
- Replace Unicode / LaTeX conversion table with R script HOT 2
- Cannot handle Chinese characters HOT 4
- Release r2rtf 1.1.2
- Blank `Rplots.pdf` generated when running snapshot tests interactively from RStudio HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from r2rtf.