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

Retain original XML identifiers #355

Open
robin-garnham opened this issue Mar 7, 2023 · 5 comments
Open

Retain original XML identifiers #355

robin-garnham opened this issue Mar 7, 2023 · 5 comments

Comments

@robin-garnham
Copy link

Hi there

Great library, thanks to everyone who has contributed.

I'm wondering if there is a way to preserve the original XML ID's onto the generated HTML?
I can see in the original .docx file that most of the elements have ID's on them, how do I get those onto the generated HTML?

@mwilliamson
Copy link
Owner

No, this isn't something that Mammoth supports, and is probably unlikely to. Would you mind explaining what your use case is?

@robin-garnham
Copy link
Author

I want to be able to retain the XML identifier so I can confidently write data back into the original Word Doc in the correct location.

I'm happy to fork the library if need be, any tips on where I'd need to change?

@christianvoigt
Copy link

@robin-garnham did you make any progress on this? I am also interested in exactly the same use case.

@robin-garnham
Copy link
Author

Yes, I did manage to. I just changed the code and left it as a patch, which worked against 1.6.0 (newer versions might need the patch to be updated).

The code is a bit messy, but it works for my use case :)

mammoth+1.6.0.patch

@christianvoigt
Copy link

thank you for the patch!

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

3 participants