I have a simple dataframe I am trying to export to a word document. I am working with ReporteRs. I want all number to be at the center of the cell (both in the body and the header).
a <- 1:5
b <- 1:5
df <- data.frame(a,b)
According to the documentation "Use ft_object[] <- value to perform the operation on the whole part (body, header or footer) of the FlexTable."
So I try
df_Flex <- FlexTable(df)
setFlexTableWidths(df_Flex, rep(0.5,2))
df_Flex[] <- parProperties(text.align = 'center')
Yet, the results is a table with only the number in the body being at the center. The header is not. If I want both the header and the body to be at the center I have to write two lines of code
df_Flex[] <- parProperties(text.align = 'center')
df_Flex[,,to='header'] <- parProperties(text.align = 'center')
which is annoying because if I want to perform other formatting I will need to write the code twice each time.
Does anyone know why this happens and how to solve the problem?
