Replies: 1 comment
-
Hi @HeenGhIIT It looks like what you're asking is how Excel modifies the underlying SpreadsheetML (XML) to adjust shapes when new columns are inserted under them. I don't know exactly what happens but my approach to this would be to compare a before/after of the spreadsheet when Excel does this. One tool that could help with this is the OOXML Viewer: https://github.com/yuenm18/ooxml-viewer-vscode |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm working on a project that involves manipulating Excel files programmatically using the Open XML SDK. Currently, I'm facing a challenge regarding updating the positions of shapes/Charts within the worksheet after inserting new columns. I've reviewed the Open XML documentation and tried different approaches, but I'm encountering difficulties with the specific XML structure of shapes and their anchor positions. Below GIF is to explain what I am trying to achieve. In Excel when you select a column, rmb and select to 'Insert' a new column will be inserted and if there are any shapes or charts in the affected area, they are expanded accordingly. I am trying to achieve this using open XML SDK.
As shown in the GIF my goal is to achieve the following:
Insert a new column into the worksheet.
Update the positions of shapes/Charts within the affected range so that they align correctly with the new column (Expansion of shapes and charts).
I've attempted to use the TwoCellAnchor approach, as recommended in various resources, but I'm having trouble understanding the exact structure of the XML elements and attributes involved in updating the position of shapes/Charts.
I've noticed that classes like Xdr.Marker, A.ColumnId, and A.ColOffset have been suggested in previous discussions, but these classes do not seem to directly address the issue. I'm struggling to identify the correct classes and properties to manipulate in order to achieve the desired results.
Could someone with experience in working with Open XML and manipulating shape positions help shed some light on this? Are there any specific classes or methods I should be using, or is this a limitation in the Open XML SDK? Any guidance, code snippets, or examples would be greatly appreciated.
Thank you in advance for your assistance.
Below is my current code which inserts 3 new columns after column index 1.
Beta Was this translation helpful? Give feedback.
All reactions