-
-
Notifications
You must be signed in to change notification settings - Fork 494
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
DocPr Element - ID attribute is always 1 when adding multiple images #2719
Comments
Hello, The file you found is a test. There is only one image so id is set to 1 So basically its sort of post processing, where lib goes through all images and does counter starting from 1 and +1 for each img it finds. |
Thanks for your reply, do you know when was this change introduced? In my version of Docx it always assign an ID 1 to all the images in the document |
In the initial post you mentioned that image is in the footer. I might guess its considered as one image for all of them. |
I mentioned if there's an textbox in the footer that contains a DocPr element with ID 1 and then if I add the images to the main body then the ID of DocPr element for these images is always set to 1 and this is causing issues when opening word document |
Oh yeah, makes sense. They could overlap. I remember fixing similar overlapping in the past for something. |
Ok, I can give you a JSON object which contains the word document (with some tags/bookmarks) and the images to be populated in a bookmark. will that suffice? |
Well, better if that's js script we can run in node, like
|
Ok, I will try and get it done in next couple of days. Thanks |
Hi,
In Word 2019 and certain versions of Microsoft 365, if you insert a textbox into a document's footer and subsequently add an image within the same document, there can be an issue where both elements receive an ID attribute value of 1. This conflict occurs because the DocPr element already has an ID assigned (1) in the footer, while the new image also receives the same ID. As a result, when attempting to open the document users encounter an error message stating "Unreadable content..."
Is it possible to assign the DocPr element an incremental value.
I can see in the code the value is hard-coded to 1, see the screenshot below
The text was updated successfully, but these errors were encountered: