How do we reset Table.AutoFit from DocumentBuilder?

If I have this code:

void BuildDocument()
{
  var builder = new DocumentBuilder();
  BuildTable1(builder);
  BuildTable2(builder);
}

void BuildTable1(DocumentBuilder builder)
{
  var table = builder.StartTable();
  table.AutoFit(AutoFitBehavior.AutoFitToContents);
  builder.EndTable();
  // TODO: should reset builder
}

void BuildTable2(DocumentBuilder builder)
{
   // BuildTable2 should not be responsible for knowing that BuildTable1 called Table.AutoFit.
}

We believe that each method using a DocumentBuilder instance should be responsible for resetting the properties of that instance. The issue is if we use Table.AutoFit on one of the methods, it messes up the other methods that needs to build a table. Our question is which DocumentBuilder properties were changed by the Table.AutoFit method so we could reset them to our expected defaults?

@gojanpaolo,

Thanks for your inquiry. Please also ZIP and attach the following resources here for testing:

  • Your simplified input Word document (if any)
  • Aspose.Words 19.5 generated output document showing the undesired behavior
  • Your expected document showing the correct output. You can create expected document by using MS Word.
  • Please also create a simplified standalone console application (source code without compilation errors) that helps us to reproduce the same problem on our end and attach it here for testing. Please do not include Aspose.Words DLL files in it to reduce the file size.

As soon as you get these pieces of information ready, we will start further investigation into your issue and provide you more information. Thanks for your cooperation.