Click here to Skip to main content
15,672,517 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to replace string in word document with image

I have tried like this

foreach (Word.Range docRange in docTemp.Words)

                    if (docRange.Text.Trim().Equals("signature",
                        string signaturePath = Properties.Settings.Default.SFolderPath + "\\Signatures\\signature.png";
                        Word.InlineShape pic = docRange.InlineShapes.AddPicture(signaturePath);


but its inserting image not replacing string "signature".

1 solution

Before you insert an image, you need to select range in which you want to insert picture ;)

How to: Programmatically Define and Select Ranges in Documents[^]
How to: Define and Select Ranges in Documents[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900