Page 1 of 1

Images and Unique Identifiers

PostPosted: Wed Apr 20, 2011 8:56 am
by LokiTC
I am inserting images in my docs, as per the example shown in AddImage.java:

Code: Select all
BinaryPartAbstractImage imagePart = BinaryPartAbstractImage.createImagePart(_package, bytes);
Inline inline = imagePart.createImageInline(null, null, id1, id2, false);

// Now wrap the inline in w:p/w:r/w:drawing
P p = _objFactory.createP();
R run = _objFactory.createR();      
p.getParagraphContent().add(run);       
org.docx4j.wml.Drawing drawing = _objFactory.createDrawing();      
run.getRunContent().add(drawing);      
drawing.getAnchorOrInline().add(inline);
      
_documentPart.addObject(p);


My question is, for the create image inline call, id1 & 2 are supposed to be unique ids:

id1 - An id unique in the document
id2 - Another id unique in the document

So, is there a class/method somewhere to query what the next available IDs are? Or do have to track / figure it out manually?

Does it matter if they are not unique? In the example the same values for id1 & 2 are reused several times.

Thanks,

LokiTC

Re: Images and Unique Identifiers

PostPosted: Thu Apr 21, 2011 1:20 am
by jason
They don't matter for most purposes, but its been a while since I looked into that, so I don't recall their significance (surely they have some purpose..).

There is no class/method to query what the next available IDs are.

You can research them more if you use the search menu above to search documentinteropinitiative.

Be interested to learn what you discover :-)