-
Notifications
You must be signed in to change notification settings - Fork 285
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
[Excel2007+] Pre-defined pictures are losing the move and size properties #1180
Comments
Thanks for notifying about this issue, and for this very detailed analysis. Reproduced. it works fine for I did the test on these four files with the demo program
Concerned code:
|
Hi folks,
thank you for providing this powerful library. It helps us a lot to avoid data exports with formatting the file by each employee :-)
We noticed an issue with the Excel-Reader and templates with inserted graphics, which are losing their move and size property.
Use Case
We are using a pre-defined excel template with some upfront formatting like fonts, basic details, header and footer and a company logo (for this example I took the SAP logo). The library fills in the data from a SAP ALV grid into the excel defined table range.
Issue
A picture is by default always related to a excel cell. In case of resizing this cell (e. g. longer table contents), this will also resize the logo (most likely distorted).
This can be fixed by setting the picture properties to "Move but don't size with cells" or "Don't move or size with cells". However, this setting is not considered properly in abap2xlsx and results in the exported file always to the property value of "Move and size with cells".
Root Cause
The Method
LOAD_WORKSHEET_DRAWING
is reading the pictures within the template.The method is checking if it's either a
oneCellAnchor
(move but don't size) or atwoCellAnchor
(move and size) by reading the properties ofexcelfile.xlsx\xl\drawing\drawing1.xml
However, Excel is using different xml nodes and attributes:
Move and size with cells:
<xdr:twoCellAnchor>
Move but don't size with cells:
<xdr:twoCellAnchor editAs="oneCell">
Don't move or size with cells:
<xdr:twoCellAnchor editAs="absolute">
Solution
I have no clue how to implement a feasible solution, which fulfills all the requirements of an Office Open XML document.
Any feedback, workaround or solution to keep the formatting of the inserted picture is highly appreciated:-)
Best regards,
Felix
The text was updated successfully, but these errors were encountered: