Comments (6)
The issue is about this line
https://github.com/Merck/r2rtf/blob/master/R/assemble.R#L64
that needs to be updated as below to avoid duplicate font claim in RTF. Will create a PR to fix the issue.
start <- c(1, vapply(rtf[-1], function(x) max(grep("fcharset",rtf[[1]])) + 2, numeric(1)))
from r2rtf.
Fixed by #129
from r2rtf.
could you attach a few tables that can reproduce the issue?
Please also try the new function in r2rtf, we will need to update r4csr on this topic. Thanks!
https://merck.github.io/r2rtf/reference/assemble_docx.html
https://merck.github.io/r2rtf/reference/assemble_rtf.html
from r2rtf.
sure here is a dummy example:
(1) example_1.rtf has correct formatting (i.e., Arial font both body, header, footer text)
(2) example_2.rtf has correct formatting (i.e., Arial font both body, header, footer text)
(3) example_combined.rtf (use assemble_rtf() to combine example1.rtf and example2.rtf) no longer has correct formatting
Interestingly, the body text is correct (i.e., Arial font) on the first page but reverts to Courier New on the second page. All header and footer font text immediately revert to Courier New.
from r2rtf.
The code below works as expected.
Table body are both in Courier font from my end.
Could you try the code and see if it works?
For me to find the root cause, please share code that can fully reproduce the issue from your end.
library(r2rtf)
library(magrittr)
file <- replicate(2, tempfile(fileext = ".rtf"))
file1 <- head(iris) %>% rtf_body(text_font = 6) %>% rtf_encode() %>% write_rtf(file[1])
file2 <- head(cars) %>% rtf_page(orientation = "landscape") %>%
rtf_body(text_font = 6) %>% rtf_encode() %>% write_rtf(file[2])
output <- tempfile(fileext = ".rtf")
assemble_rtf(
input = file,
output = "tmp.rtf"
)
from r2rtf.
No problem. See code below. You need to change the "text_font" to something other than Courier (e.g., text_font = 3 below). Courier appears to be the default font the program is reverting to when RTF tables are combined.
library(r2rtf) # Reporting in RTF format
library(magrittr) # Required for %>%
file <- replicate(2, tempfile(fileext = ".rtf"))
file1 <- head(iris) %>%
rtf_page_header(
text = c("Testing Testing Testing"),
text_font = 3,
text_font_size = 10
) %>%
rtf_page_footer(
text = c("Testing Testing Testing"),
text_font = 3,
text_font_size = 10
) %>%
rtf_body(
text_font = 3,
text_font_size = 10
) %>%
rtf_encode() %>%
write_rtf(file[1])
file2 <- head(cars) %>%
rtf_page(orientation = "landscape") %>%
rtf_page_header(
text = c("Testing Testing Testing"),
text_font = 3,
text_font_size = 10
) %>%
rtf_page_footer(
text = c("Testing Testing Testing"),
text_font = 3,
text_font_size = 10
) %>%
rtf_body(
text_font = 3,
text_font_size = 10
) %>%
rtf_encode() %>%
write_rtf(file[2])
output <- tempfile(fileext = ".rtf")
assemble_rtf(
input = file,
output = "tmp.rtf"
)
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.