I am creating a table and trying to add it to a spire document.
However, when I try to set the layout to autofit to contents, I get an "Object reference is null error" that comes from within spire.doc assemblies.
No further information is given.
The code I'm using is below:
private Table createTable(string tableJson, Document document)
{
JArray jsonTable = (JArray)JsonConvert.DeserializeObject(tableJson);
JArray rowtable = (JArray)jsonTable[0];
int rowCount = jsonTable.Count();
int cellCount = rowtable.Count();
Table table = new Table(document, true, 1f);
table.ResetCells(rowCount, cellCount);
populateCells(table, jsonTable);
table.AutoFit(AutoFitBehaviorType.AutoFitToContents);
return table;
}