FW: Changing the font while saving the html file

Hi,
We uses aspose and in one situation I am saving the .doc file as HTML file.
I would like to change the font size and name of the full html and save it.
Following is the code we are using to save the .doc file as html:

Dim doc As New Document(oFile.FilePath + oFile.FileName)
doc.Save(oFile.File + ".html", Aspose.Words.SaveFormat.Html)

Forgot to mention: the code is in vb.net

This message was posted using Email2Forum by ShL77.

Hi

Thanks for your request. The best way to change font name and font size in the document, I think, is using DocumentVisitor. Here is simple example:

// Open source document
Document doc = new Document("in.doc");
// Create visitor that will change font in the document
// After processing font in the output document will be Arial 24
FontChanger changer = new FontChanger("Arial", 24);
// Accapt visitor
doc.Accept(changer);
// Save output document
doc.Save("out.html", SaveFormat.Html);

FontChanger class is attached.
Best regards,

Thanks for this response. This functionality will definately apply the specified font across the document. Do we have a flexibility to apply standard font size across document but not to header tags (h1/h2…)?

Hi

Thanks for your inquiry. DocumentVisitor provides methods like VisitParagraphStrat and VisitParagraphEnd. You can add flag to ignore runs inside headings paragraphs. Set this flag in VisitParagraphStrat if paragraph is heading and reset on VisitParagraphEnd if paragraph is heading. Then check this flag and if it is set, then do not change font.
Please let me know if you need more information, I will be glad to help you.
Best regards,

Thanks for your suggestion. Shall try this option.