Convert html with svgs to word document

Hi,

I’m using the licensed version of Aspose.Words to convert html into word document.
I have an html file with svg icons in it.When I try to convert it to word document, I don’t get anything in it. Attached is one sample document.

Can you please help me get svg icons in converted word document?

Regards,
Dipak Mahajan

Hi Dipak,

Thanks for your inquiry. I have tested the scenario and have managed to reproduce the same issue at my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-11629. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi Tahir,

Thanks for looking into it.
Just wanted to convey one thing, I know if I open this html directly in word, it won’t support SVG as Microsoft Word does not support SVG at all. But I want to know is there a way aspose can help me to get these icons converted to may be in png format and those are rendered at the place of svg.

Regards,
Dipak Mahajan

Hi Dipak,

Thanks for your inquiry. The SVG is imported as Shape node into Aspose.Words DOM and you can export the shape node to image using following code example.

Document doc = new Document(MyDir + "in.html");
int i = 1;
foreach (Shape shape in doc.GetChildNodes(NodeType.Shape, true))
{
    shape.GetShapeRenderer().Save(MyDir + "Out"+i+".png", new ImageSaveOptions(SaveFormat.Png));
    i++;
}

This issue (WORDSNET-11629) is related to your input document. The Svg is not imported correctly into Aspose.Words DOM. The above code example does not export the svg to png correctly. We will update you via this forum thread once this issue is resolved. We apologize for your inconvenience.

Hi Tahir,

I have tried modifying the html a bit. Attached is the html I’m using now and the converted word document. The icons in the word document are not matching the source svg icon. Can you please check this as well?

Regards,
Dipak Mahajan

Hi Dipak,

Thanks for sharing the detail. Perhaps, you are using an older version of Aspose.Words; as with Aspose.Words v15.2.0, I am unable to reproduce this problem on my side. I would suggest you please upgrade to the latest version of Aspose.Words i.e. v15.2.0
and let us know how it goes on your side. I hope, this will help. I
have attached the output document with this post for your kind
reference.

The issues you have found earlier (filed as WORDSNET-11629) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.