Free Support Forum - aspose.com

Aspose.HTML to Word: Fonts are not getting applied but css and images are fine

I am new to ASPOSE and trying HTML to WORD and facing issues related to the font is not getting applied to the generated word document.

I tried adding the new fonts on my local computer as well but no luck.

The font is getting reset to Times New Roman in the generated word document.

I am using 21.3.0.0 version, any idea what I am doing wrong here, or do I need to do anything extra for the fonts?

Below is the code that I am using

string source = doc.DocumentNode.InnerHtml; // This is giving me the complete HTML of the page

        using (var document = new Aspose.Html.HTMLDocument(source, new Aspose.Html.Url("BaseURLOfTheHostedWebsite")))
        {
            // Initialize DocSaveOptions 
            var options = new Aspose.Html.Saving.DocSaveOptions();
            options.DocumentFormat = Aspose.Html.Rendering.Doc.DocumentFormat.DOCX;
            options.FontEmbeddingRule = Aspose.Html.Rendering.Doc.FontEmbeddingRule.Full;

            // Convert HTML webpage to DOCX
            var docPath = Path.Combine(filePath, fileName);
            Aspose.Html.Converters.Converter.ConvertHTML(document, options, docPath);
        }

Thanks
Bobin Sondhi

@bobinsondhi

Would you please share your sample HTML in .zip format with us? We will test the scenario in our environment and address it accordingly.

@asad.ali: Thanks for the reply, I have attached the sample HTML that I am trying to convert to docx.

Sample HTML.zip (41.2 KB)

@bobinsondhi

We were able to notice the issue in our environment and have logged it as HTMLNET-3083 in our issue tracking system. We will further look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

We are sorry for the inconvenience.

@asad.ali: Thanks for the confirmation. Do you have any tentative date when I can expect the resolution?

@bobinsondhi

The ticket has been just logged in our issue management system and it will be investigated on first come first serve basis. We will be able to share further updates regarding fix ETA once it is fully analyzed. As soon as we make some significant progress towards its resolution, we will inform you. Please give us some time.

We are sorry for the inconvenience.

Hi Asid

Thanks for the update. We are facing another issue with Word doc file converted from HTML.

Check attached for the sample HTML & Word doc file. If you open up the word document then it has separate section for each text line. The word document is not in the continued text and it’s not easy to modify text and add new paragraph. Refer to section.png under the attached file.

See below for other issues

  1. If I try to change the text in the section then it’s not allowing me to enter a new line
  2. If I continue typing then it text goes beyond the section and not visible on the doc.

We want a regular word document without any sections and which free to modify by the user.
Files.zip (1.4 MB)

@bobinsondhi

We have logged another issue as HTMLNET-3094 in our issue tracking system for investigation purpose. We will look into its details as well and let you know once the ticket is resolved. Please be patient and give us some time.

We apologize for the inconvenience.

We want to buy this tool after this issue is fixed, so if you can provide the tentative date, then it would be helpful.

@bobinsondhi

The tickets have recently been logged in our issue management system and are pending for review. However, we have recorded your concerns along with the ticket will consider them during the investigation. We will let you know as soon as we have some definite updates regarding resolution or fix ETA of the tickets. Please spare us little time.

We apologize for the inconvenience.

Hi [asad.ali]

Any update on the issue related to exported MS word file?

HTMLNET-3094

Regards
Bobin Sondhi

@bobinsondhi

We are afraid that investigation of the logged ticket is not yet completed and we are not in a position to share some reliable ETA at the moment. However, we will definitely let you know once the analysis in complete. Your patience is highly appreciated in this regard. Please give us some time.

We apologize for the inconvenience.