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 inlineStr. closes #112 #161 #225

Merged
merged 11 commits into from
Jul 11, 2021
Merged

Conversation

JanMarvin
Copy link
Collaborator

@JanMarvin JanMarvin commented Jul 11, 2021

what does it do

This PR implements basic handling of inlineStr. It reads the inlineStr <is> node and handles it as if its a <v> node with t="str". So this:

<c r=... >
    <is>
        <t>text</t>
    </is>
</c>

is for our import logic identical to this

<c r=... t="str">
    <v>text</v>
</c>

how was it implemented

I've implemented it as type 5 so once it's imported as inlineStr it can be written as inlineStr. My initial PR was quite small, only a few lines, but when testing it, reading with read.xlsx() directly from files was slow as hell. Most likely due to hundreds of runs through the same large string. Therefore I had to remove the import logic from the getCellInfo() file and replace it with the logic from loadworksheets(). In theory there shouldn't be a measurable speed difference and this should be beneficial since it reduces the two different approaches for the same thing to only a single (duplicated) approach. Still I didn't run any benchmarks with previous versions against this PR.

what's left for others to do

I haven't implemented any modifications for userspace functions to create, remove or modify inlineStr and I have no interest to do so. Therefore currently the only way to write inlineStrs with openxlsx is to import one, but I assume it can be implemented quite easily and might be beneficial for other reasons.

final words?

Included in this PR are minor updates caused by a new Rcpp release (completely harmless) and a modification to the LICENSE file which was outdated.

@codecov-commenter
Copy link

codecov-commenter commented Jul 11, 2021

Codecov Report

Merging #225 (df670fc) into master (57333c1) will increase coverage by 0.15%.
The diff coverage is 92.39%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #225      +/-   ##
==========================================
+ Coverage   65.44%   65.59%   +0.15%     
==========================================
  Files          34       34              
  Lines        8879     8918      +39     
==========================================
+ Hits         5811     5850      +39     
  Misses       3068     3068              
Impacted Files Coverage Δ
R/utils.R 94.11% <ø> (ø)
src/write_file_2.cpp 0.00% <0.00%> (ø)
src/read_workbook.cpp 90.26% <95.94%> (-0.19%) ⬇️
R/workbook_read_workbook.R 89.32% <100.00%> (+0.56%) ⬆️
src/load_workbook.cpp 94.76% <100.00%> (+0.05%) ⬆️
src/write_data.cpp 62.96% <100.00%> (+1.13%) ⬆️
src/write_file.cpp 89.04% <100.00%> (+0.15%) ⬆️
R/WorkbookClass.R 57.24% <0.00%> (+0.16%) ⬆️

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 89ce583...df670fc. Read the comment docs.

@JanMarvin
Copy link
Collaborator Author

This fixes #112 #161 and #204 (probably others)

@JanMarvin
Copy link
Collaborator Author

Oh I'm not sure about the changes in src/write_file_2.cpp. They are similar to the other changes (I actually started with this file), but in my tests it was not used, therefore not sure about it. It's one of the many mysteries of openxlsx which function is called when and for what reason.

@ycphs ycphs merged commit 0694c7a into ycphs:master Jul 11, 2021
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.

3 participants