View source: R/class-workbook-wrappers.R
| wb_merge_cells | R Documentation |
Worksheet cell merging
wb_merge_cells(
wb,
sheet = current_sheet(),
dims = NULL,
solve = FALSE,
direction = NULL,
...
)
wb_unmerge_cells(wb, sheet = current_sheet(), dims = NULL, ...)
wb |
A Workbook object |
sheet |
A name or index of a worksheet |
dims |
worksheet cells |
solve |
logical if intersecting merges should be solved |
direction |
direction in which to split the cell merging. Allows "row" or "col" |
... |
additional arguments |
If using the deprecated arguments rows and cols with a merged region must be rectangular,
only min and max of cols and rows are used.
Other workbook wrappers:
base_font-wb,
col_widths-wb,
creators-wb,
grouping-wb,
row_heights-wb,
wb_add_chartsheet(),
wb_add_data(),
wb_add_data_table(),
wb_add_formula(),
wb_add_hyperlink(),
wb_add_pivot_table(),
wb_add_slicer(),
wb_add_worksheet(),
wb_base_colors,
wb_clone_worksheet(),
wb_copy_cells(),
wb_freeze_pane(),
wb_save(),
wb_set_last_modified_by(),
wb_workbook()
Other worksheet content functions:
col_widths-wb,
filter-wb,
grouping-wb,
named_region-wb,
row_heights-wb,
wb_add_conditional_formatting(),
wb_add_data(),
wb_add_data_table(),
wb_add_formula(),
wb_add_hyperlink(),
wb_add_pivot_table(),
wb_add_slicer(),
wb_add_thread(),
wb_freeze_pane()
# Create a new workbook
wb <- wb_workbook()$add_worksheet()
# Merge cells: Row 2 column C to F (3:6)
wb <- wb_merge_cells(wb, dims = "C3:F6")
# Merge cells:Rows 10 to 20 columns A to J (1:10)
wb <- wb_merge_cells(wb, dims = wb_dims(rows = 10:20, cols = 1:10))
wb$add_worksheet()
## Intersecting merges
wb <- wb_merge_cells(wb, dims = wb_dims(cols = 1:10, rows = 1))
wb <- wb_merge_cells(wb, dims = wb_dims(cols = 5:10, rows = 2))
wb <- wb_merge_cells(wb, dims = wb_dims(cols = 1:10, rows = 12))
try(wb_merge_cells(wb, dims = "A1:A10"))
## remove merged cells
# removes any intersecting merges
wb <- wb_unmerge_cells(wb, dims = wb_dims(cols = 1, rows = 1))
wb <- wb_merge_cells(wb, dims = "A1:A10")
# or let us decide how to solve this
wb <- wb_merge_cells(wb, dims = "A1:A10", solve = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.