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

Free Support Forum - aspose.com

Words Font Issue

Hello,

I am using code below in for each loop to generate Main Final document from various child documents. Everything looks good but the font, once in a time during the loop it seems the font on lobjAppendDoc is changed. How can I set the font for this object to always be Times New Roman and 12 size ?

When the loop ends I just want to be sure that entire document has same font and size. Please let me know.

Thanks,

Vinay Hattarki

Foreach ......

Dim lbMyData() As Byte

lbMyData = poDocBytes

If IO.File.Exists(System.IO.Path.GetTempPath & "TempAppend.Doc") = True Then

IO.File.Delete(System.IO.Path.GetTempPath & "TempAppend.Doc")

End If

IO.File.WriteAllBytes(System.IO.Path.GetTempPath & "TempAppend.Doc", lbMyData)

Dim lobjAppendDoc As New Aspose.Words.Document(System.IO.Path.GetTempPath & "TempAppend.Doc")

If pbSectionContinuous = True Then

lobjAppendDoc.FirstSection.PageSetup.SectionStart = SectionStart.Continuous

End If

AsposeUnlinkFields(lobjAppendDoc)

lobjAppendDoc.FirstSection.PageSetup.PaperSize = Aspose.Words.PaperSize.Legal

mobjMainAsposeDoc.AppendDocument(lobjAppendDoc, ImportFormatMode.UseDestinationStyles)

Any update on this issue? As well, I am looking to change the font according to condition inside the loop.

Thanks,

Vinay Hattarki

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Maybe the problem is caused because you are using ImportFormatMode.UseDestinationStyles and some style in the destination document overrides style in the source document. Please try using ImportFormatMode.KeepSourceFormatting .

Best regards.

Hello,

I used both the formats and it is same status. Actually I would like to use UseDestinationStyles because I dont want to change font on my main document object.

Is there any way to change the font in the object once it is loaded?

For example below how should I change all the data to different font and size using the object lobjAppendDoc ? Consider TempAppend.Doc has font of Verdana 12 and I wish to chang that in lobjAppendDoc to TimesNewRoman 10. How can I get that working?

Dim lobjAppendDoc As New Aspose.Words.Document(System.IO.Path.GetTempPath & "TempAppend.Doc")

Please let me know if you have any work around.

Thanks,

Vinay Hattarki

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Please see the following forum thread to learn how to change font in the document:

Hope this helps.

Best regards.