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 ?
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!