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

Free Support Forum - aspose.com

Word Document has incorrect font size

With the following code, I am getting a word document that has the font size set to 36 regardless what the rich text has. See code below and the rich text string I'm passing. Can you help me understand why this might be? I really the the font size to be what it specified in the rich text.

Thanks!

***********************

String commentFileName = String.Empty;

ASCIIEncoding encoding = new ASCIIEncoding();
Byte[] bytes = encoding.GetBytes(text);

using (MemoryStream ms = new MemoryStream(bytes))
{
LoadFormat loadFormat = Aspose.Words.LoadFormat.Rtf;

commentFileName = FileUtils.GetTempFileName(TypeConversion.EnumToString(SaveFormat.Docx));

Document doc = new Document(ms, null,loadFormat,null);
doc.Save(commentFileName, SaveFormat.Docx);

the variable text is:
"

this is arial 10

this is courier 10

georgia 14

"

Hi Jane,


Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word do. Could you please load shared rich text in MS Word document and share that document here for testing? Please read Aspose.Words LoadFormat and SaveFormat Enumeration form following documentation links.

http://www.aspose.com/docs/display/wordsnet/LoadFormat+Enumeration
http://www.aspose.com/docs/display/wordsnet/SaveFormat+Enumeration

Please let us know if you have any more queries.

I will review the above links, and have attached the word document.


My Aspose.Words.LoadFormat is Rtf and my Aspose.Words.SaveFormat is Docx. Changing the LoadFormat or removing it completely does not change the output. The font size is always 36 regardless.

Any other ideas?

Hi Jane,


Thanks for sharing the additional information. Please note that Aspose.Words mimics the same behavior as MS Word do. Please see the attached input.html file. I have inserted the shared input rich text string into HTML. If you load this input rich text string in MS Word, you will get the same output. The font size is 36.

Hope this answers your query. Please let us know if you have any more queries.