-
Notifications
You must be signed in to change notification settings - Fork 544
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
AddEmbeddedPackagePart is saved to wrong path #1318
Comments
Hi @twsouthwick I made a mistake trying to PR to v2.20 so I pulled it again. I think you may want my PR for v3 or another version than 2.20. You can look at the code here 9f7ed97 |
@Asbjoedt do you have test code including the embedded contents to be added? I will need to verify all the behavior here.
<sigh, another edit> for (2) above, it won't be just in the backend generation. It will have to be decided based on the content type passed into |
Also, another reason came to mind. When you AddImagePart in the SDK, they are saved to
Here's code for you to test the behaviour on .xlsx files.
I recommend you create your own test sample, where you i.e. create two .xlsx spreadsheets and embed one of the .xlsx into the other as an object. You should try the embedding process first using Excel and then Open XML SDK. |
@Asbjoedt thanks for the additional details and explanation. I can create a sample to test this and verify the behavior. Regarding (1) above, yes, I agree that we should imitate Excel also. The SDK is not only built around the ISO standard but around the Office behaviors. So good point. |
@tomjebo. It would be great if this fix could get into 2.20, if possible. |
@Asbjoedt I'm working on getting this into v2.20.0. |
@tomjebo this was included in v2.20.0 right? Can this be closed? |
@twsouthwick, @Asbjoedt we can probably close this issue now. See #1406. The path behavior that you observed is indeed a deviation from what Excel actually does. However, as you noted the package is not broken because of this deviation. But in #1406, I'd like to investigate using features to "enhance" the SDK to do this mimicking behavior. So we can track the "enhancement" there. |
Describe the bug
ISSUE 1
You can iterate all EmbeddedPackageParts by doing the below. It iterates WorksheetParts and then each EmbeddedPackagePart.
You can delete any EmbeddedPackagePart by deleting it at the WorksheetPart level like this.
However, if you want to AddEmbeddedPackagePart you can do so also at the WorksheetPart level:
But the new EmbeddedPackagePart will be saved to this URI where a new
embeddings
folder will be created:If you use Excel, all EmbeddedPackageParts are saved in this folder instead:
Is this correct behaviour? Should Open XML SDK also save the part to
xl/embeddings
?ISSUE 2:
Excel saves the EmbeddedPackagePart with original extension i.e.
.xlsx
.Open XML SDK saves EmbeddedPackagePart with
.bin
extension.Observed behavior
EmbeddedPackagePart is saved to
xl/worksheets/embeddings
EmbeddedPackagePart is saved with
.bin
extension.Expected behavior
EmbeddedPackagePart should be saved to
xl/embeddings
EmbeddedPackagePart should be saved with the original extension of the package i.e.
.xlsx
.Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: