We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

A generic error occurred in GDI+ for at Aspose.Words.DocumentBuilder.InsertImage

Hi,


I am getting a error while writing an image into word.
Please find the attached error xml for reference and let me know what am i doing wrong.

Code
int imageHeight = -1;
int imageWidth = 150;

byte[] fileBytes = Convert.FromBase64String(chartData);
MemoryStream ms = new MemoryStream(fileBytes);
string clippedDate = exportDetails.ClippedDate.ToString(“MMMM dd, yyyy”);
this.CreateChartTitleForDownload(docExport, builder, exportDetails.UrlPath, clippedDate);

if (exportDetails.SheetName == “Timeline”)
{
imageHeight = 50;
imageWidth = 80;
}
if (chartData != “”)
{
if (exportDetails.SheetCount == 8)
{
builder.InsertImage(ms, RelativeHorizontalPosition.Page, 30, RelativeVerticalPosition.Page, 60,
docExport.FirstSection.PageSetup.PageWidth - imageWidth, imageHeight, WrapType.Inline);
}
else
{
Shape shape = builder.InsertImage(Image.FromStream(ms), RelativeHorizontalPosition.Page, 30,
RelativeVerticalPosition.Page, 60,
docExport.FirstSection.PageSetup.PageWidth - imageWidth, imageHeight, WrapType.Inline);
shape.TextPath.Text = “Chart”;

docExport.Accept(new LargeImageSplitter());
}
}
builder.MoveToDocumentEnd();
builder.InsertBreak(BreakType.PageBreak);


Regards,
IMS

Hi Viraj,

Thanks for your inquiry. It would be great if you please share following detail for investigation purposes.


  • Please attach your input Word documents.
  • Please attach your image file.
  • Please

    create a standalone/runnable simple application (for example a Console
    Application Project
    ) that demonstrates the code (Aspose.Words code) you used to generate
    your output document

  • Please
    attach your target Word document showing the desired behavior. You can
    use Microsoft Word to create your target Word document. I will
    investigate as to how you are expecting your final document be generated
    like.

Unfortunately,
it is difficult to say what the problem is without the Document(s) and
simplified application. We need your Document(s) and simple project to
reproduce the problem. As soon as you get these pieces of information to
us we’ll start our investigation into your issue.