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

Gap between column titles and table body in LibreOffice Writer #7

Open
deel-sider opened this issue Jul 10, 2021 · 5 comments
Open

Comments

@deel-sider
Copy link

Hi,

Thanks for creating this. One thing that I have noticed is that the generated RTF files look different in LibreOffice Writer compared to how they look in Microsoft Word. In LibreOffice, there is an extra gap between the column heading and the table body that is not present in Word. While it looks as if things are being rendered differently, it this something that can be addressed?

Many thanks,

John

@mstackhouse
Copy link
Contributor

Hi @kpl05.

Interesting observation. Our primary target has been making sure things render correctly within Microsoft Word, as in the pharma industry, these RTF documents often get handed off to medical writers who use Microsoft Word to assemble their reports. And even though word reads and writes RTF code, it still converts it to its own flavor in the background.

It would help if you provide a screenshot of the gap you're seeing and an example file. I'm curious if the gap is something coming from the huxtable table output or something being done by pharmaRTF.

@deel-sider
Copy link
Author

Hi Mike,

Here is the LibreOffice screenshot as requested:

Screenshot from 2021-12-11 09-16-09

table_1.pdf

Unfortunately, Github does not seem to let me attach RTF files unless there is another way to do this so I have added a PDF file to show things in more detail.

Regards,

John

@deel-sider
Copy link
Author

Hi Mike,

Just trying a DOCX file made in LibreOffice to see if that helps in any way because that retains the gap.

table_1.docx

Regards,

John

@mstackhouse
Copy link
Contributor

Thanks - one more question, can you provide the code you used? Or create a reprex? That will help us out as well.

@deel-sider
Copy link
Author

Hi Mike,

Here is some of the code that was used:

c19v_latest %>%
dplyr::ungroup() %>%
dplyr::mutate(rank=as.integer(rank(-percap))) %>%
dplyr::arrange(rank) %>%
dplyr::select(rank,location,population,date,total_vaccinations,percap) %>%
huxtable::as_hux() %>%
huxtable::set_width(1.5) %>%
huxtable::set_col_width(c(0.3,1.1,0.7,0.5,1.2,0.6)) %>%
huxtable::set_contents(1,1,"Order") %>%
huxtable::set_contents(1,2,"Country") %>%
huxtable::set_contents(1,3,"Population") %>%
huxtable::set_contents(1,4,"Latest Date") %>%
huxtable::set_contents(1,5,"Total Number of Vaccinations") %>%
huxtable::set_contents(1,6,"Vaccinations per Capita") %>%
huxtable::set_number_format(everywhere,3,fmt_pretty()) %>%
huxtable::set_number_format(everywhere,5,fmt_pretty()) %>%
huxtable::set_number_format(everywhere,6,"%5.5f") %>%
huxtable::set_font(everywhere,everywhere,"Arial") %>%
huxtable::set_all_borders() %>%
pharmaRTF::rtf_doc(titles=list(hf_line("Table 7: COVID-19 Vaccinations by Per Capita Rate",font="Arial")
, hf_line(" ")
)
) %>%
pharmaRTF::write_rtf(file=paste0("~/Documents/python_stuff/output/c19/",tprefix,"7.rtf"))

A REPREX may take longer so I hope the above helps to add clarity.

Regards,

John

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