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

Free Support Forum - aspose.com

DocumentBuilder: EndTable sets wrong font size after PushFont/PopFont

Attached sample has default font size “10”. I use “DocumentBuilder.PushFont/PopFont” and write text with font size 14. Then a table is written. After the “EndTable” call, the documentbuilder font size has changed to “14” (the size before “PopFont”).

  DocumentBuilder docBuilder = new DocumentBuilder(doc);
  docBuilder.Document.Styles.DefaultParagraphFormat.Style.Font.Size = 10;

  docBuilder.PushFont();
  docBuilder.Font.Size = 14;
  docBuilder.Font.Bold = true;

  docBuilder.Writeln("This is the title");
  docBuilder.PopFont();

  docBuilder.StartTable();

  //add cells...

  docBuilder.EndRow();

  //add more cells...

  docBuilder.EndTable();

  //After "EndTable", the font will be set to the font which was used before "PopFont"...
  docBuilder.Writeln("TESTTESTTEST");

AsposeTableTest.zip (4.9 MB)

I found https://forum.aspose.com/t/documentbuilder-endtable-sets-documentbuilder-properties-unexpectedly-font-paragraphformat-etc/194788/5 which sounds similar, but this post does not mention “PushFont”, so I created a new topic.

Is this a bug?

Best regards

Wolfgang

@wknauf

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-19483. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-19483) have been fixed in this Aspose.Words for .NET 20.1 update and this Aspose.Words for Java 20.1 update.

I can confirm that it works now. Many thanks for the fast fix!

Best regards

Wolfgang