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

vml numbering is half broken #535

Closed
JanMarvin opened this issue Feb 3, 2023 · 1 comment
Closed

vml numbering is half broken #535

JanMarvin opened this issue Feb 3, 2023 · 1 comment

Comments

@JanMarvin
Copy link
Owner

JanMarvin commented Feb 3, 2023

Everything is fine, if we write a workbook we have created. The issue stems from incorrect vml numbering if a sheet contains no vml reference. In theory it should be a simple workbook with two empty sheets and a comment on the second.

The vml file will be vmlDrawing1.xml if written from Excel and vmlDrawing2.xml if written from us. Because we wrongfully assume that every sheet has a matching vml file if one is available. Unfortunately that's not true. In this case we have updated all but the worksheet reference to point to vml2. In the worksheet references we still point to vml1 and the XLSX output will not find the files and excel will repair the workbook by removing all vml references.

To solve this, we have to change the vml reordering. I'm not sure how complicated this is going to be. Either we have created a very complicated nonsense or ...

Updated with example: we see two sheets, assume two vmlDrawings. Yet the reference remains pointing at vmlDrawing1.xml. This should be fixed to match what Excel creates. Otherwise I fear that in some more messed up file, we will break due to some not updated reference order.

This should impact everything that interferes with vmlDrawings or drawings in general. I kinda was under the impression that we had already fixed this with this strange file where the custom drawing was interfering with the reference counter.

library(openxlsx2)

wb <- wb_load("https://github.com/JanMarvin/openxlsx-data/raw/main/vml_numbering.xlsx")

wb$vml
#> [[1]]
#> list()
#> 
#> [[2]]
#> [1] "<xml xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\"><o:shapelayout v:ext=\"edit\"><o:idmap v:ext=\"edit\" data=\"1\"/></o:shapelayout><v:shapetype id=\"_x0000_t202\" coordsize=\"21600,21600\" o:spt=\"202\" path=\"m,l,21600r21600,l21600,xe\"><v:stroke joinstyle=\"miter\"/><v:path gradientshapeok=\"t\" o:connecttype=\"rect\"/></v:shapetype><v:shape id=\"_x0000_s1025\" type=\"#_x0000_t202\" style=\"position:absolute;  margin-left:80pt;margin-top:2pt;width:104pt;height:69pt;z-index:1\" fillcolor=\"#ffffe1 [80]\" o:insetmode=\"auto\"><v:fill color2=\"#ffffe1 [80]\"/><v:shadow color=\"none [81]\" obscured=\"t\"/><v:path o:connecttype=\"none\"/><v:textbox style=\"mso-direction-alt:auto\"><div style=\"text-align:left\"/></v:textbox><x:ClientData ObjectType=\"Note\"><x:MoveWithCells/><x:SizeWithCells/><x:Anchor>    1, 15, 0, 2, 2, 54, 4, 7</x:Anchor><x:AutoFill>False</x:AutoFill><x:Row>0</x:Row><x:Column>0</x:Column><x:Visible/></x:ClientData></v:shape></xml>"

wb$worksheets_rels
#> [[1]]
#> character(0)
#> 
#> [[2]]
#> [1] "<Relationship Id=\"rId2\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments\" Target=\"../comments1.xml\"/>"             
#> [2] "<Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing\" Target=\"../drawings/vmlDrawing1.vml\"/>"
@JanMarvin
Copy link
Owner Author

Closed in #536

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

1 participant