Hi I am evaluating Aspose.Words for using it to generate word doc from html. I am using following code:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertHtml(
"<P align='right'>Xyz</P>" +
"<b>123</b>" +
"<div align='center'>ABC</div>" +
"<h1 align='left'>Heading 1 left.</h1> <img src='images/logo_main.gif'/>");
doc.Save("Test.docx", SaveFormat.Docx, SaveType.OpenInWord, Response);
Response.End();
In my Page Test.aspx(Test.aspx.cs). The path of image is just relative to Test.aspx.
The generated document does not show the image. I know that it is a problem of Image path. Aspose.Words is not able to get the right image path. If I provide the
"<img src='"+Server.MapPath("images/logo_main.gif")+"'/> " , it works or I provide it as
<img src='localhost://images/logo_main.gif'/>, also works. But I can not do these because our preexisting documents have relative url.
My suggestion is that you people can provide a property to set the context path for the document, so that Aspose.words can map the path automatically.-Sushil
This message was posted using Page2Forum from Aspose.Total for .NET and Java - Documentation