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?