c# - Embed word document into another WITHOUT icon -
how embed word document word document via openxml sdk, showing content, not icon of word? such, manually in word: insert object file -> without checking "dispaly icon"?
i've found article, uses icon. i've tried use openxml sdk productivity tool, shows generated binary data.
edited: use following code:
drawaspect = oledrawaspectvalues.content
and add image part:
var imagepart = maindocumentpart.addnewpart<imagepart>("image/x-emf", imagepartid); generateimagepart(imagepart);
but image part - array of bytes of word's icon. so, in case happens following: when open generated document, shows embedded document icon, when double click embedded document, edit , save changes, embedded document shown content, maybe it's possible in way show content without editing embedded document? should use instead of array of bytes of word's icon array of bytes of doc's screenshot? not sure described clear, please ask
i'm afraid asking impossible. difference far word file concerned between icon , embedded file, image. when don't use icon word pretty take screenshot of document embedding , inserts in place of icon graphic.
i've uploaded example grabbed word file made. found little gem in /media folder inside .docx file.
so basicly, choice in resolving if can't live icon somehow grab picture of word-file want embed , insert instead of icon image.
how you'd go can't pretty. first of open xml sdk contains no such functionality. tried playing bit around office interop well, no luck.
i see 2 possible ways achieve this.
first 1 via interop. you'll need install "pretend printer" ones print pdf instead of sending printer. 1 needs print image format. format of file in media folder .emf i'm not positive thats requirement.
anyways, should above somehow possible embed picture, pretty using example link microsoft, , change size of "icon" image of document.
second possibility open word document process, set document size 72% (or whatever makes document 1 on screen on desktop) , grab print screen , cut down document , use image embedding.
for record, don't recommend of above, thoose options see.
should have better solution i'm ears.
finally, should decide want push on this, i'll happy code example of option number 2 if reply , tell me you'd that.
- kaspar
Comments
Post a Comment