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

Implement cloneWorksheet function to duplicate existing sheets in the workbook #483

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Implement cloneWorksheet function to duplicate existing sheets in the workbook #483

wants to merge 7 commits into from

Conversation

kainhofer
Copy link
Contributor

Implement a cloneWorksheet function to create a full copy of an existing worksheet and add it as a new worksheet to the workbook.

This pull request is my current status, which I'm using myself regularly.
What is working:

  • Content
  • Styles are properly copied.
  • Tables
  • images
  • charts (data range is adjusted to point to the cloned sheet, too)

What is missing:

  • probably drawings, comments, etc.
  • pivot tables

For these, I suppose some XML strings stored in the fields of the Workbook class need to be duplicated + modified and new IDs assigned I don't have the insight into the full xlsx file format, so I have not yet figured out which parts need to be duplicated and where an ID needs to be changed. For the styles I think I got it right (at least it seems to be working)

This pull request is intended to fix/implement issues #255 and #330.
This replaces PR #355

…ing worksheet and add it as a new worksheet to the workbook.

Content, styles, etc. are properly copied.

Missing: Tables (and probably drawings, comments, etc.)
… generate new IDs and new names => cannot just copy over the tables and tableParts lists)
…nting to data in the same sheet to point to the new sheet
@codecov
Copy link

codecov bot commented Aug 18, 2019

Codecov Report

Merging #483 into master will decrease coverage by 0.87%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #483      +/-   ##
==========================================
- Coverage   60.23%   59.35%   -0.88%     
==========================================
  Files          30       30              
  Lines        7142     7108      -34     
==========================================
- Hits         4302     4219      -83     
- Misses       2840     2889      +49
Impacted Files Coverage Δ
R/worksheet_class.R 73.64% <ø> (+0.36%) ⬆️
R/wrappers.R 42.4% <0%> (-0.22%) ⬇️
R/WorkbookClass.R 52.38% <0%> (-2.88%) ⬇️
src/write_data.cpp 60.76% <0%> (-3.8%) ⬇️
src/write_file_2.cpp 0% <0%> (-1.43%) ⬇️
R/HyperlinkClass.R 93.02% <0%> (-0.98%) ⬇️
R/workbook_write_data.R 82.35% <0%> (-0.85%) ⬇️
src/read_workbook.cpp 90.55% <0%> (-0.39%) ⬇️
R/writeDataTable.R 71.59% <0%> (-0.32%) ⬇️
R/helperFunctions.R 75.31% <0%> (-0.25%) ⬇️
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ead0038...b29d653. Read the comment docs.

@ycphs
Copy link
Contributor

ycphs commented Oct 17, 2019

Hi,

I added your PR into my fork ycphs/openxlsx. I am looking forward to get your support for publishing an updated version of the package on cran.

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

2 participants