awalker89 / openxlsx

R package for .xlsx file reading and writing.
Other
364 stars 79 forks source link

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

Open kainhofer opened 5 years ago

kainhofer commented 5 years ago

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:

What is missing:

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

codecov[bot] commented 5 years ago

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%) :arrow_up:
R/wrappers.R 42.4% <0%> (-0.22%) :arrow_down:
R/WorkbookClass.R 52.38% <0%> (-2.88%) :arrow_down:
src/write_data.cpp 60.76% <0%> (-3.8%) :arrow_down:
src/write_file_2.cpp 0% <0%> (-1.43%) :arrow_down:
R/HyperlinkClass.R 93.02% <0%> (-0.98%) :arrow_down:
R/workbook_write_data.R 82.35% <0%> (-0.85%) :arrow_down:
src/read_workbook.cpp 90.55% <0%> (-0.39%) :arrow_down:
R/writeDataTable.R 71.59% <0%> (-0.32%) :arrow_down:
R/helperFunctions.R 75.31% <0%> (-0.25%) :arrow_down:
... 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 commented 4 years ago

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.