InsertImage fails (does not show image) in my document

When I insert the attached chart.png into a blank document it works. But when I insert it into the attached .doc it fails.
Can you please advise a workaround?
Code I’m using:

string outputFileName = "AsposeTestImage";
string templateFile = @"template\Table headings come out symbol.doc";
Aspose.Words.License wordLicense = new Aspose.Words.License();
wordLicense.SetLicense("Aspose.Words.lic");
Document doc = new Document(templateFile);
DocumentBuilder builder = new DocumentBuilder(doc);
Image nConvChart = Bitmap.FromFile("chart.png");
builder.InsertImage(nConvChart);
doc.Save(outputFileName + ".doc", SaveFormat.Doc);
// display
Process.Start(outputFileName + ".doc");

I’ve discovered that the image is being inserted but just not immediately visible in the output word doc.
If I change the pargraph line spacing in the Normal style from “Exactly at 13pt” to “Single” then the image will appear!
Since I need the line spacing at “Exactly at 13pt” is there some other workaround ?

NB: This problem occurs on Aspose.Words .NET 10.4.0. I’ve also tested it on Aspose.Words .NET 5.0.2 and the problem does not occur.

Hi
Thanks for your request. I think, in your case, you can specify WrapType of shape to resolve the problem:

Shape shape = builder.InsertImage(nConvChart);
shape.WrapType = WrapType.Square;

Hope this helps.
Best regards,

Thanks for the suggestion I’ll play around with that. I will also try setting the paragraph line spacing to single.

It seems this is a known issue with Word 2003 rather than anything to do with Aspose. I found info here on inserting graphics when “In line with text” and a paragraph format with exact line spacing is used:

Pictures or other objects do not appear in a Word document

I inserted some graphics in a document, but now I can’t see them

I was just lucky that when I used the old Aspose.Words and Aspose.PDF it worked when it probably also shouldn’t have!

Hi there,
Thanks for posting this information. I’m sure it will come in handy for others who happen to run into the same issue.
Thanks,