Hello,
i got an issue again, that I had to fight last year. I do not remember how I could solve it (probably by an aspose update). But it’s back and I hope you know that issue or you can help to unterstand whats going on.
I use a method the calculate an image size depending on if its in a table cell or not.
if (cell != null)
{
maxWidth = cell.CellFormat.Width;
maxHeight = maxWidth;
}
else
{
var ps = builder.CurrentSection.PageSetup;
maxHeight = (ps.PageHeight - ps.TopMargin - ps.BottomMargin) * heightMultiplicator;
maxWidth = ps.PageWidth - ps.LeftMargin - ps.RightMargin;
}
In some cases the tests are failing, because cell.CellFormat.Width does contain a wrong value.
What we figured out is, that aftter calling document.save() the property is set with the correct value. Also when debugging, and populating the document in visual studio (via reflection) the width will be set correctly. It looks like there is a bug with updating some props.
As a workaround I do a doc.Save into a memory stream, before i use a replace evaluator to manipulate the document. I suppose that the Save-Method traverses the document object and thats why the width property in the document is set correctely after that.
hopefully you’ve got an advice how to handle it… This cannot be the solution…
Kind regards,
Holger