PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

KeepWith not working on complicated rows
http://forum.pdfsharp.com/viewtopic.php?f=2&t=1285
Page 1 of 1

Author:  Craigbnz [ Thu Jul 29, 2010 8:20 pm ]
Post subject:  KeepWith not working on complicated rows

Hi Guys,

I have a main table with 1 left 1 middle and 1 right column. I add all my blocks into the middle cell and leave the left and right for formatting. Each block is added to the middle column of the outer table using outertable.AddRow()[1].Elements.AddTable(CreateMyTable()); So each row within the outer table will contain some complicated inner table.

My problem is that i can't seem to get the KeepWith to work on the outer table. The PDFDocumentRenderer.Render method fails with "Object reference not set to an instance of an object" It fails when rendering with the error.

If I comment out the last line below then it works. My code seems sensible, but maybe I'm expecting it to do someting it can't

var borrowerSignatureRow = documentTable.AddRow();
borrowerSignatureRow[1].Elements.Add(CreateBorrowerSignaturetable());

var borrowerWitnessRow = documentTable.AddRow();
borrowerWitnessRow[1].Elements.Add(CreateWitnessTable(false));
borrowerSignatureRow.KeepWith = borrowerWitnessRow.Index; //If I comment this row out it works.

Author:  Craigbnz [ Thu Jul 29, 2010 9:44 pm ]
Post subject:  Re: KeepWith not working on complicated rows

Hi Guys,

I've resolved this one myself. It stemed from my misunderstanding of how KeepWith works. I originally thought it worked by saying Row a KeepsWith Row e whereby you specify the index of Row E. I now understand that KeepWith requires a 'Number of Rows' rather than a 'End Row Index'.

Cheers

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/