Skip to content

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

Open
kainhofer wants to merge 7 commits into
awalker89:masterfrom
kainhofer:bug255_cloneWorksheet
Open

Implement cloneWorksheet function to duplicate existing sheets in the workbook#483
kainhofer wants to merge 7 commits into
awalker89:masterfrom
kainhofer:bug255_cloneWorksheet

Conversation

@kainhofer
Copy link
Copy Markdown
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
Copy Markdown

codecov Bot commented Aug 18, 2019

Codecov Report

❌ Patch coverage is 0% with 86 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (master@ead0038). Learn more about missing BASE report.

Files with missing lines Patch % Lines
R/WorkbookClass.R 0.00% 76 Missing ⚠️
R/wrappers.R 0.00% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master     #483   +/-   ##
=========================================
  Coverage          ?   59.35%           
=========================================
  Files             ?       30           
  Lines             ?     7108           
  Branches          ?        0           
=========================================
  Hits              ?     4219           
  Misses            ?     2889           
  Partials          ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ycphs
Copy link
Copy Markdown
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.

2 participants