tags:

views:

312

answers:

2

Hi,

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 serveral duplicates stored in the package.

Anyone shed some light?

+1  A: 

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.

Tim Coulter
A: 

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/

salgo60