Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine column labels in the table header as an additional header #125

Closed
leeangling opened this issue Nov 10, 2022 · 3 comments
Closed
Assignees

Comments

@leeangling
Copy link

When we create a new table header that combine multiple columns, the bottom border line is connected together. Can we add a new feature to not connect the bottom border line? one possible solution is to add a new border type that is indent at the start and end of border line.
test

This is a similar feature as gt tab_spanner() function. By default, the bottom line between tab_spanner() is not connected. Here is a gt example.
Untitled

Thanks!

@fb-elong
Copy link
Collaborator

There is no direct support for indent in RTF format for border line. But you can hack the feature if you really need it.

I would not put it into r2rtf package as it is not a formal border line type supported by RTF file, you may consider to write and maintain a helper function for your organization if needed.

Here is a quick example to illustrate the idea.

library(r2rtf)
head(iris)[, 1:4] %>% 
  rtf_colheader(colheader = c(" | title 1 | | | title 2 | "), 
                col_rel_width = c(1, 8, 1, 1, 8, 1), 
                border_left =  c("single", "", "", "single", "", ""), 
                border_bottom = c("", "single", "", "", "single", "")) %>% 
  rtf_body(col_rel_width = c(5, 5, 5, 5), border_first = "") %>% 
  rtf_encode() %>% 
  write_rtf("tmp.rtf")

image

@leeangling
Copy link
Author

Thank you for providing the example solution. This solution can solve most of my problem in combining column labels. The extra separation cell may takes too many spaces when the table is too busy. Do you have a solution to reduce the space?

@elong0527
Copy link
Collaborator

I thought the example already show you by controlling col_rel_width

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants