Reputation: 1
I am creating a Word document based on a template. The template contains a image in the header section which I would like to re-use elsewhere in the document.
The image is stored in the package -> word/media/myImage.jpeg
so I need to somehow add a relationship to my each section that I wish to display the image again. I have attempted this successfuly manually, the question is how using the sdk 2.0.
Using the AddImagePart()
method is useless as this just adds the image again which is silly as I only need one copy rather than several duplicates stored in the package.
Anyone shed some light?
Upvotes: 0
Views: 921
Reputation: 967
Best way is to open up the document in DocumentReflector.exe and have a look on the code generated
Eric has some blog posts about that http://blogs.msdn.com/ericwhite/
Upvotes: 0
Reputation: 8937
My experience with the SDK 2.0 is primarily in SpreadsheetML, but assuming the same principles are used in WordprocessingML, you need to create a relationship to the existing ImagePart, by obtaining its ID (using the GetIdOfPart() method) and then calling the CreateRelationshipToPart() method on the part that will hold the secondary reference to it.
Upvotes: 1