Processing
 

Inserted Pictures by Word AddIn are not displayed in Word 2016

19/09/2016 07:31#1

Joined at: 7 months ago

Post: 5

Thank: 0

Thanked: 0

I created a Word AddIn that gets WorkItems from TFS and inserts them over an HTML template that the user can alter. It has a similar structure to the Team Tab in Excel. It works perfectly fine now, except for the attachments of a workitem, which are usually pictures. For Word 2013, they are inserted correctly, for Word 2016, they are displayed as empty pictures, but with the correct size. It's not the placeholder setting, they are not empty rectangles, it just shows the picture icon in the corresponding size. I can save them to a local folder, so the picture seems to be there. I get the pictures by creating an html tag for them and downloading them to Temp. This is the html tag code:

var attachmentPath = AttachmentStorage.SaveAttachmentToTemp(attachment); var imageSize = GetImageData(attachmentPath); var imageData = ("<img src=\"" + attachmentPath + "\" width=\"" + imageSize[0] + "\" height=\"" + imageSize[1] + "\">"); imagesHtml.Add(imageData); 

The imagesHtml string is added to the complete html string of the workitem and inserted into the active document. Anyone got any ideas? Hope my question is relatively clear.

19/09/2016 08:39Top#2

Joined at: 10 months ago

Post: 15

Thank: 0

Thanked: 0

This is a trust issue as it is in general highly unsafe to have access to the local file system from within websites/HTML. See also this thread:

Why can't I do <img src="C:/localfile.jpg">?

Similar articles

VBA regex matching over two lines

4 months ago - Reply: 1 - Views: 44

Table output to Word-2011 from Rstudio using knit

4 months ago - Reply: 0 - Views: 28

Write a Collection of paragraphs into a new document

4 months ago - Reply: 1 - Views: 70

how to write paragraphs without show to document

4 months ago - Reply: 1 - Views: 66

numericals in word macro

4 months ago - Reply: 1 - Views: 45

Can not find proofing tools

4 months ago - Reply: 0 - Views: 1

Possible values for <w:outlineLvl> in Word OOXML

4 months ago - Reply: 1 - Views: 7

C# restrict editing partial word paragraph

5 months ago - Reply: 2 - Views: 142

Macro translation Please (possible virus)

4 months ago - Reply: 1 - Views: 34

Doc/Docx Fastest Reading Method for Searching

4 months ago - Reply: 0 - Views: 1

Save embedded file / content from word

4 months ago - Reply: 0 - Views: 5

Counting words in Word document, including footnores

4 months ago - Reply: 1 - Views: 22

c# access extract word ole object

4 months ago - Reply: 1 - Views: 19

Using word wildcards to find unaccepted changes

4 months ago - Reply: 1 - Views: 45

vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re