davidgohel / flextable

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

Tabs stripped from text (using to indent rows) #75

Closed mlduarte closed 6 years ago

mlduarte commented 6 years ago

Similar to issue #39, is it possible to get tabs recognised (would like to indent row), have also tried spaces but these are stripped as well.

df <- data.frame(A = "Hello World", B = "Hello\tWorld", C = "Hello\r\nWorld")
ft <- flextable(df)
ft <- width(ft, width = 1)
ft

Session info, as requested:

sessionInfo() R version 3.4.2 (2017-09-28) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale: [1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252 LC_MONETARY=English_Australia.1252 [4] LC_NUMERIC=C LC_TIME=English_Australia.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] forecast_8.4 bindrcpp_0.2.2 magrittr_1.5 readxl_1.1.0 lubridate_1.7.4 stringr_1.3.1 dplyr_0.7.5
[8] purrr_0.2.5 readr_1.1.1 tidyr_0.8.1 tibble_1.4.2 ggplot2_2.2.1 tidyverse_1.2.1 forcats_0.3.0
[15] dbplyr_1.2.1 dbplot_0.3.0 glue_1.2.0 DBI_1.0.0 odbc_1.1.6 scales_0.5.0.9000 kableExtra_0.9.0 [22] knitr_1.20

loaded via a namespace (and not attached): [1] nlme_3.1-137 xts_0.10-2 bit64_0.9-7 httr_1.3.1 rprojroot_1.3-2 C50_0.1.2 tools_3.4.2
[8] backports_1.1.2 R6_2.2.2 DT_0.4 rpart_4.1-13 mgcv_1.8-24 lazyeval_0.2.1 colorspace_1.3-2 [15] nnet_7.3-12 tidyselect_0.2.4 mnormt_1.5-5 curl_3.2 bit_1.1-14 compiler_3.4.2 cli_1.0.0
[22] rvest_0.3.2 xml2_1.2.0 Cubist_0.2.2 labeling_0.3 tseries_0.10-45 lmtest_0.9-36 fracdiff_1.4-2
[29] mvtnorm_1.0-8 psych_1.8.4 quadprog_1.5-5 digest_0.6.15 foreign_0.8-70 rmarkdown_1.10.2 pkgconfig_2.0.1
[36] htmltools_0.3.6 TTR_0.23-3 htmlwidgets_1.2 rlang_0.2.1 quantmod_0.4-13 rstudioapi_0.7 bindr_0.1.1
[43] zoo_1.8-2 jsonlite_1.5 Formula_1.2-3 Matrix_1.2-14 Rcpp_0.12.17 munsell_0.5.0 partykit_1.2-2
[50] stringi_1.1.7 yaml_2.1.19 inum_1.0-0 plyr_1.8.4 grid_3.4.2 blob_1.1.1 parallel_3.4.2
[57] crayon_1.3.4 lattice_0.20-35 haven_1.1.1 splines_3.4.2 hms_0.4.2 pillar_1.2.3 reshape2_1.4.3
[64] urca_1.3-0 evaluate_0.10.1 modelr_0.1.2 cellranger_1.1.0 gtable_0.2.0 assertthat_0.2.0 libcoin_1.0-1
[71] broom_0.4.4 uroot_2.0-9 survival_2.42-3 viridisLite_0.3.0 timeDate_3043.102

mlduarte commented 6 years ago

Apologies .. not sure how to delete. In RStudio Viewer, they appear to be stripped, however in the generated PPT file they are visible.

davidgohel commented 6 years ago

No problem @mlduarte

I suppose you are working with R for Windows? Could you add the sessionInfo() results?

If it work in pptx that's probably a side effect of ppt difference with other formats. If you want to add indentation, you should play with parameter padding in officer::fp_par.

There is an illustration here: https://davidgohel.github.io/flextable/articles/format.html#add-padding

David

mlduarte commented 6 years ago

Thank-you for the reference.

github-actions[bot] commented 2 years 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.