DocX icon indicating copy to clipboard operation
DocX copied to clipboard

Add image to Bookmark

Open Alirz opened this issue 7 years ago • 8 comments

How can I add image to bookmark in .net with xceed?

Alirz avatar Feb 19 '18 13:02 Alirz

Hi, We will investigate to add this feature. thank you.

XceedBoucherS avatar Feb 23 '18 14:02 XceedBoucherS

hello do you have any tips to add this feature ?

psohm avatar Jul 16 '18 22:07 psohm

Is it roughly possible to say when this feature will be added?

AlexanderMair avatar Nov 23 '18 10:11 AlexanderMair

The code looks like not so complicated. I find the code for a php library https://github.com/PHPOffice/PHPWord/pull/1516 as I understood, we have to add the file as an attachement to the file and then there is a quite simple code in xml

psohm avatar Nov 23 '18 10:11 psohm

You can always create an empty paragraph and add the image to it. Then, add the bookmark to this paragraph. Something like :

var doc = DocX.Load("test.docx"); var image = doc.AddImage( "CIMG3709.jpg" ); var picture = image.CreatePicture( 112, 112 ); var p = doc.InsertParagraph(); p.AppendPicture( picture ); p.AppendBookmark( "ImageBookmark" ); doc.SaveAs("test2.docx");

XceedBoucherS avatar Dec 03 '18 14:12 XceedBoucherS

sure but in this case, you add the image to the end of the document the goal is to insert an image to a specified bookmark. I hope it is clear for you.

psohm avatar Dec 03 '18 14:12 psohm

Hi, You can always modify the paragraph of a specific bookmark : var doc = DocX.Load("test.docx"); var image = doc.AddImage( "CIMG3709.jpg" ); var picture = image.CreatePicture( 112, 112 ); doc.Bookmarks[ 0 ].Paragraph.AppendPicture( picture ); doc.SaveAs("test2.docx");

XceedBoucherS avatar Dec 04 '18 20:12 XceedBoucherS

Is there any one know how to implement this solution in node.js?

sandeeppaneliya avatar May 06 '20 09:05 sandeeppaneliya