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

provide wb_copy_cells. closes #282 #515

Merged
merged 4 commits into from
Jan 14, 2023
Merged

provide wb_copy_cells. closes #282 #515

merged 4 commits into from
Jan 14, 2023

Conversation

JanMarvin
Copy link
Owner

@JanMarvin JanMarvin commented Jan 14, 2023

There are a few things related that can be addressed in the future

  • further tweaks to wb_copy_cells() maybe something like Excels apply style option.
  • further tweaks to wb_data() (it was a quick draft to allow mschart() inclusion and maybe colNames should be moved to attributes)
  • tweaks to wb_clone_worksheet(). next_sheet() always returns sheets named next_sheet.
library(openxlsx2)

wb <- wb_workbook()$
  add_worksheet()$
  add_data(x = mtcars)$
  add_fill(dims = "A1:F1", color = wb_color("yellow"))

dat <- wb_data(wb, dims = "A1:D4", colNames = FALSE)

wb$
  # 1:1 copy to M2
  clone_worksheet(old = 1, new = "Clone1")$
  copy_cells(data = dat, dims = "M2", as_value = FALSE, as_ref = FALSE, transpose = FALSE)$
  # 1:1 transposed copy to A20
  clone_worksheet(old = 1, new = "Clone2")$
  copy_cells(data = dat, dims = "A20", as_value = FALSE, as_ref = FALSE, transpose = TRUE)$
  # reference transposed copy to A20
  clone_worksheet(old = 1, new = "Clone3")$
  copy_cells(data = dat, dims = "A20", as_value = FALSE, as_ref = TRUE, transpose = TRUE)$
  # value copy to A20
  clone_worksheet(old = 1, new = "Clone4")$
  copy_cells(data = dat, dims = "A20", as_value = TRUE, as_ref = FALSE, transpose = FALSE)

@JanMarvin JanMarvin added this to the v0.5 milestone Jan 14, 2023
@JanMarvin JanMarvin merged commit a1a9706 into main Jan 14, 2023
@JanMarvin JanMarvin deleted the gh_issue_282 branch January 14, 2023 13:12
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

Successfully merging this pull request may close these issues.

None yet

1 participant