Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Wed Jun 19, 2019 1:37 pm

Picture not displayed when replacing text with image:
Code:
TextSelection selPics = p.Find(new Regex(@"(<@Picture//PictureSize)[^<]*@>"));
string reportPDFImageFormat = ConfigurationManager.AppSettings["reportPDFImageFormat"]; // medium
if (selPics != null)
{
string imgUrl =get image url();
if (!string.IsNullOrEmpty(imgUrl))
{
using (var image =getImagefromUrl)
{
//Load picture in function of tag (checks for custom size)
DocPicture pic = new DocPicture(document);
pic.LoadImage(image);
pic = GetDocPictureFromImage(ref pic, selectionPictures.SelectedText, 200);

//replace template with picture
TextRange range = selPics.GetAsOneRange();

int index = range.OwnerParagraph.ChildObjects.IndexOf(range);
range.OwnerParagraph.ChildObjects.Insert(index, pic);
range.OwnerParagraph.ChildObjects.Remove(range);
}
}
The same code works for other picture placements.

vanee
 
Posts: 2
Joined: Wed Jun 19, 2019 1:28 pm

Thu Jun 20, 2019 9:51 am

Hi,

Thank you for your inquiry.
After an initial test with the latest Spire.Doc Pack(hot fix) Version:7.6.5, I didn’t encounter your issue on my side. Please provide your input word document, your full test code as well as your image url to help us further look into your issue. You could send them to us via email (support@e-iceblue.com). Thanks in advance.

Sincerely,
Nancy
E-iceblue support team
User avatar

nancy.yang
 
Posts: 184
Joined: Wed Apr 03, 2019 2:33 am

Thu Jun 20, 2019 11:53 am

Hi,
Thanks for your reply.. The issue was with Url as I had set a wrong url path, I was not getting the image displayed. Thanks again for your immediate response.

Regadrs,
Vanee

vanee
 
Posts: 2
Joined: Wed Jun 19, 2019 1:28 pm

Fri Jun 21, 2019 3:21 am

Hi,

Thanks for your feedback.
Any question, welcome to get it back to us.
Have a nice day :D

Sincerely,
Nancy
E-iceblue support team
User avatar

nancy.yang
 
Posts: 184
Joined: Wed Apr 03, 2019 2:33 am

Return to Spire.Doc