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

Free Support Forum - aspose.com

Not able to insert HTML with images properly


I am trying to insert some HTML using builder, but I couldn’t make working properly. Basically I need to insert an image on fly with dynamic width. So I have two images of same size, one is for gray and another RGB colors. here is the code I was using:

StringBuilder sb = new StringBuilder();
sb.Append("<div style=“position: relative; left: 0; top: 0;”>");
sb.Append("<div style=“background-image:url(‘images/gray.png’); position: relative; top: 0; left: 0; height: 26px; width: 173px; " />”);
sb.Append("<div style=“background-image:url(‘images/color.png’); position: absolute; top: 0px; left: 0px; height: 26px; width: 100px;” />");

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.Writeln(“before html”);
builder.Writeln(“after html”);


How can I update my document with this HTML? (I have attached the output document here)

Hi Srinivasa,

Thanks for your inquiry. Unfortunately, Aspose.Words does not support style background-image:url at the moment. However, I have logged this feature request as WORDSNET-11278 in our issue tracking system. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan