davidgohel / flextable

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

Footnotes compressed to one column after using delete_columns() #591

Closed nathhenry3 closed 10 months ago

nathhenry3 commented 10 months ago

I've noticed that when using delete_columns(), any previously added footnotes get compressed to the left-hand column, rather than extending across the width of the table.

Reprex example below. Here's the original flextable, with the footnotes extending across the width of the entire table:

ft_2 <- flextable(head(iris)) ft_2 <- autofit(ft_2) ft_2 <- footnote(ft_2, i = 1, j = 1:2, value = as_paragraph( c( "This is footnote one", "This is footnote two" ) ), ref_symbols = c("a", "b"), part = "header", inline = TRUE ) ft_2 <- footnote(ft_2, i = 1, j = 3:4, value = as_paragraph( c( "This is footnote three", "This is footnote four" ) ), ref_symbols = c("c", "d"), part = "header", inline = TRUE ) ft_2

And here's the result after running delete_columns() - all footnotes get compressed into the first column:

ft_2 <- delete_columns(ft_2, j=4) ft_2

Any idea why this might be happening? I'm using flextable 0.9.4.

Thanks a lot!

davidgohel commented 10 months ago

Any idea why this might be happening?

Sure, I think you just see that it deletes any span parameters that may have been set previously. See the documentation of delete_columns().

https://davidgohel.github.io/flextable/reference/delete_columns.html#details

So the idea as documented is to redo your merge or do them after column deletion

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