In the example, I am trying to set an indentation of 1 cm. I am using a transformation via a constant, but all numerical precision is discarted in the final output.
library(flextable)
ft <- flextable(cbind(rn = rownames(head(mtcars)), head(mtcars[, seq(3)]))) |>
theme_vanilla()
mm_to_pt_conversion <- 2.834
a <- ft |> padding(i = seq(2, 6, 2), j = 1, padding.left = 10 * mm_to_pt_conversion) # 10 mm is the wanted indentation
doc <- officer::read_docx()
doc <- body_add_flextable(doc, a)
file <- "filetocheck.docx"
print(doc, target = file)
When I use the above code, I get 0.99:
Thinking it was a fixed artifact or a converter issue I tried with different values like padding.left = 10.01 * mm_to_pt_conversion and to change font etc. Nothing changes the value. To get to have a different value you need to go from 28.xx points to 29.xx points. you can get there by using the above code with padding.left = 10.24 * mm_to_pt_conversion. Nonetheless the mm are again wrong due to the gap between the 28-29.
I do not think is a big issue but I was requested exactly 1cm indentation and I am wondering if there is a fix to this like if it is possible to use different units or add more precision to pt.
In the example, I am trying to set an indentation of 1 cm. I am using a transformation via a constant, but all numerical precision is discarted in the final output.
When I use the above code, I get
0.99
:Thinking it was a fixed artifact or a converter issue I tried with different values like
padding.left = 10.01 * mm_to_pt_conversion
and to change font etc. Nothing changes the value. To get to have a different value you need to go from 28.xx points to 29.xx points. you can get there by using the above code withpadding.left = 10.24 * mm_to_pt_conversion
. Nonetheless the mm are again wrong due to the gap between the 28-29.I do not think is a big issue but I was requested exactly 1cm indentation and I am wondering if there is a fix to this like if it is possible to use different units or add more precision to pt.