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

Incompatible Excel theme #32

Closed
daniel-fahey opened this issue May 22, 2018 · 3 comments
Closed

Incompatible Excel theme #32

daniel-fahey opened this issue May 22, 2018 · 3 comments

Comments

@daniel-fahey
Copy link

daniel-fahey commented May 22, 2018

Weird little Excel file linked below which will crash the rsession when attempting to open with xlsx_cells. I have removed all the original sheets, but this file still causes the crash, so the xlsx file can be used a minimal example.
minimal.xlsx
image

Tested on both Windows and Linux. Was able to get a backtrace of rsession using GDB on Linux:

#0  0x00007fe0ee8c7e5e in xlsxstyles::cacheThemeRgb (this=this@entry=0x7ffda6d241e8, path="/home/dan/data-lab/servest-meths/data/test_measures/minimal.xlsx") at xlsxstyles.cpp:93
#1  0x00007fe0ee8c85aa in xlsxstyles::xlsxstyles (this=0x7ffda6d241e8, path="/home/dan/data-lab/servest-meths/data/test_measures/minimal.xlsx") at xlsxstyles.cpp:30
#2  0x00007fe0ee8acf62 in xlsxbook::xlsxbook (this=0x7ffda6d24180, path=..., sheet_paths=..., sheet_names=..., comments_paths=...) at xlsxbook.cpp:32
#3  0x00007fe0ee897e2e in xlsx_cells_ (path="/home/dan/data-lab/servest-meths/data/test_measures/minimal.xlsx", sheet_paths=..., sheet_names=..., comments_paths=...) at tidyxl.cpp:26
#4  0x00007fe0ee88341c in _tidyxl_xlsx_cells_ (pathSEXP=<optimised out>, sheet_pathsSEXP=<optimised out>, sheet_namesSEXP=<optimised out>, comments_pathsSEXP=<optimised out>) at RcppExports.cpp:18
#5  0x00007fe11132cc9c in ?? () from /usr/lib/R/lib/libR.so
#6  0x00007fe11136a20d in Rf_eval () from /usr/lib/R/lib/libR.so
#7  0x00007fe11136ccae in ?? () from /usr/lib/R/lib/libR.so
#8  0x00007fe111369fec in Rf_eval () from /usr/lib/R/lib/libR.so
#9  0x00007fe11136c00f in ?? () from /usr/lib/R/lib/libR.so
#10 0x00007fe111369db6 in Rf_eval () from /usr/lib/R/lib/libR.so
#11 0x00007fe11136ccae in ?? () from /usr/lib/R/lib/libR.so
#12 0x00007fe111369fec in Rf_eval () from /usr/lib/R/lib/libR.so
#13 0x00007fe11136c00f in ?? () from /usr/lib/R/lib/libR.so
#14 0x00007fe111369db6 in Rf_eval () from /usr/lib/R/lib/libR.so
#15 0x00007fe111393632 in Rf_ReplIteration () from /usr/lib/R/lib/libR.so
#16 0x00007fe111393a31 in ?? () from /usr/lib/R/lib/libR.so
#17 0x00007fe111393ae8 in run_Rmainloop () from /usr/lib/R/lib/libR.so
#18 0x0000000000e4206f in rstudio::r::session::runEmbeddedR(rstudio::core::FilePath const&, rstudio::core::FilePath const&, bool, bool, SA_TYPE, rstudio::r::session::Callbacks const&, rstudio::r::session::InternalCallbacks*) ()
#19 0x0000000000e2061f in rstudio::r::session::run(rstudio::r::session::ROptions const&, rstudio::r::session::RCallbacks const&) ()
#20 0x0000000000718d53 in main ()

Line #0 gave me a clue that it had something to do with the theme1.xml inside the workbook, so I deleted it and repaired with Excel, which stops the crash. So it seems there's some issue with the RapidXML library and the theme settings in this weird Excel file.

@nacnudus
Copy link
Owner

Thanks Dan. Confirmed. Do you happen to know what software created the original file?

@daniel-fahey
Copy link
Author

Excel 2016 64-bit

@nacnudus
Copy link
Owner

The problem is that I assumed the first two nodes would be sysClr

<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme">
<a:themeElements>
<a:clrScheme name="Office">
<a:dk1>
<a:sysClr val="windowText" lastClr="000000"/>
</a:dk1>
<a:lt1>
<a:sysClr val="window" lastClr="FFFFFF"/>
</a:lt1>

But in this case the first one is srgbClr

<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme">
<a:themeElements>
<a:clrScheme name="Custom 2">
<a:dk1>
<a:srgbClr val="262626"/>
</a:dk1>
<a:lt1>
<a:sysClr val="window" lastClr="FFFFFF"/>
</a:lt1>

So I should check the name of the child node first, then.

  • If it's sysClr, use the lastClr attribute
  • Otherwise use the val attribute

nacnudus added a commit that referenced this issue May 22, 2018
 Safely get RGB from theme colour nodes (fixes #32)
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

No branches or pull requests

2 participants