davidgohel / flextable

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

`border_inner_h()` has weird changes in line widths in R Studio Viewer #545

Closed phargarten2 closed 1 year ago

phargarten2 commented 1 year ago

Hello, I used flextable in R Studio and noticed weird changes in line widths when the table is viewed in R Studio. However, it is viewed as expected in the Word Document.

This issue is similar to #343, with two differences:

  1. I found the opposite problem of what the author found in issue 343.
  2. I am using a newer version of the flextable and officer packages.

From the example of border_inner_h:

library(officer)
std_border = fp_border(color="orange", width = 1)
dat <- iris[c(1:5, 51:55, 101:105),]
ft <- flextable::flextable(dat)
ft <- border_remove(x = ft)
ft

No borders: image

# add inner horizontal borders
ft <- border_inner_h(ft, border = std_border )
ft
save_as_docx(ft, path = "tmp.docx")

From the R viewer: image

Some lines are oddly thicker than others despite the border width equaling 1.

But saving it to the Word document comes out as expected: image

Session Info:

xfun::session_info("flextable")
R version 4.2.3 (2023-03-15 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045), RStudio 2023.3.1.446

Locale:
  LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8    LC_MONETARY=English_United States.utf8 
 LC_NUMERIC=C                          
  LC_TIME=English_United States.utf8    

 Package version:
   askpass_1.1             base64enc_0.1.3         bslib_0.4.2             cachem_1.0.7            cli_3.6.1               commonmark_1.9.0        cpp11_0.4.3            
   crayon_1.5.2            crul_1.4.0              curl_5.0.0              data.table_1.14.8       digest_0.6.31           ellipsis_0.3.2          evaluate_0.21          
   fastmap_1.1.1           **flextable_0.9.1**         fontawesome_0.5.1       fontBitstreamVera_0.1.1 fontLiberation_0.1.0    fontquiver_0.2.1        fs_1.6.1               
   gdtools_0.3.3           gfonts_0.2.0            glue_1.6.2              graphics_4.2.3          grDevices_4.2.3         grid_4.2.3              highr_0.10             
   htmltools_0.5.5         httpcode_0.3.0          httpuv_1.6.9            jquerylib_0.1.4         jsonlite_1.8.4          knitr_1.43              later_1.3.0            
   lifecycle_1.0.3         magrittr_2.0.3          memoise_2.0.1           methods_4.2.3           mime_0.12               **officer_0.6.2**           openssl_2.0.6          
   promises_1.2.0.1        R6_2.5.1                ragg_1.2.5              rappdirs_0.3.3          Rcpp_1.0.10             rlang_1.1.0             rmarkdown_2.21         
   sass_0.4.6              shiny_1.7.4             sourcetools_0.1.7.1     stats_4.2.3             stringi_1.7.12          stringr_1.5.0           sys_3.4.2              
   systemfonts_1.0.4       textshaping_0.3.6       tinytex_0.45            tools_4.2.3             triebeard_0.4.1         urltools_1.7.3          utils_4.2.3            
   uuid_1.1.0              vctrs_0.6.1             withr_2.5.0             xfun_0.39               xml2_1.3.3              xtable_1.8.4            yaml_2.3.7             
   zip_2.2.2              

When submitting a new issue:

phargarten2 commented 1 year ago

The problem existed for *flextable_0.9.1 and officer_0.6.2. However, upon updating to flextable_0.9.2.009 on GitHub, the problem went away. From the R viewer: image

Versions: flextable_0.9.2.009
officer_0.6.2


Session Info:

> xfun::session_info("flextable")
R version 4.2.3 (2023-03-15 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045), RStudio 2023.3.1.446

Locale:
  LC_COLLATE=English_United States.utf8 
  LC_CTYPE=English_United States.utf8   
  LC_MONETARY=English_United States.utf8
  LC_NUMERIC=C                          
  LC_TIME=English_United States.utf8    

Package version:
  askpass_1.1             base64enc_0.1.3         bslib_0.4.2            
  cachem_1.0.7            cli_3.6.1               commonmark_1.9.0       
  cpp11_0.4.3             crayon_1.5.2            crul_1.4.0             
  curl_5.0.0              data.table_1.14.8       digest_0.6.31          
  ellipsis_0.3.2          evaluate_0.21           fastmap_1.1.1          
  flextable_0.9.2.009     fontawesome_0.5.1       fontBitstreamVera_0.1.1
  fontLiberation_0.1.0    fontquiver_0.2.1        fs_1.6.1               
  gdtools_0.3.3           gfonts_0.2.0            glue_1.6.2             
  graphics_4.2.3          grDevices_4.2.3         grid_4.2.3             
  highr_0.10              htmltools_0.5.5         httpcode_0.3.0         
  httpuv_1.6.9            jquerylib_0.1.4         jsonlite_1.8.4         
  knitr_1.43              later_1.3.0             lifecycle_1.0.3        
  magrittr_2.0.3          memoise_2.0.1           methods_4.2.3          
  mime_0.12               officer_0.6.2           openssl_2.0.6          
  promises_1.2.0.1        R6_2.5.1                ragg_1.2.5             
  rappdirs_0.3.3          Rcpp_1.0.10             rlang_1.1.0            
  rmarkdown_2.21          sass_0.4.6              shiny_1.7.4            
  sourcetools_0.1.7.1     stats_4.2.3             stringi_1.7.12         
  stringr_1.5.0           sys_3.4.2               systemfonts_1.0.4      
  textshaping_0.3.6       tinytex_0.45            tools_4.2.3            
  triebeard_0.4.1         urltools_1.7.3          utils_4.2.3            
  uuid_1.1.0              vctrs_0.6.1             withr_2.5.0            
  xfun_0.39               xml2_1.3.3              xtable_1.8.4           
  yaml_2.3.7              zip_2.3.0 
github-actions[bot] commented 9 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.