pharmaRTF icon indicating copy to clipboard operation
pharmaRTF copied to clipboard

Gap between column titles and table body in LibreOffice Writer

Open deel-sider opened this issue 2 years ago • 5 comments

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

deel-sider avatar Jul 10 '21 13:07 deel-sider

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.

mstackhouse avatar Dec 10 '21 21:12 mstackhouse

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 avatar Dec 11 '21 09:12 deel-sider

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

deel-sider avatar Dec 11 '21 09:12 deel-sider

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

mstackhouse avatar Dec 13 '21 14:12 mstackhouse

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

deel-sider avatar Dec 13 '21 15:12 deel-sider