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

Free Support Forum - aspose.com

ParagraphFormat.Style returns incorrect font values using C#

Hello! I found a bug when reading the font for first paragraph in last section. I open it and can see it is Comic Sans MS, but in code, it is read as Times New Roman, although Times New Roman is nowhere used in the document.
I attach a test project.


Hi Dragos,

Thanks for your query. I have tested the scenario and have managed to reproduce the same problem at my end. I have logged this issue in our issue tracking system and you will be notified via this forum thread once this issue is resolved.

Please use the following code snippet for a workaround.

var doc = new Document(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "test.docx"));
Console.WriteLine("Test first paragraph in last section font");
Console.WriteLine("Expected Font: Comic Sans MS");
// Console.WriteLine("Actual Font: " + doc.LastSection.Body.Paragraphs[1].ParagraphFormat.Style.Font.Name);
Console.WriteLine("Actual Font: " + doc.LastSection.Body.Paragraphs[1].Runs[0].Font.Name);

Thanks for your inquiry. I closed the issue as “Not a Bug”. Actually, formatting of text in MS Word documents can be defined on few different levels:

  1. Paragraph style defined for the particular paragraph;
  2. Character style defined for the particular run;
  3. Explicit formatting specified for a particular run.

For more information, please see the following link:
So you cannot determine whether paragraph has for example bold text by checking just paragraph’s style. There can be a run with bold text.
Hope this helps. Please let me know if you need more assistance, I will be glad to help you.
Best regards,