This is a migrated thread and some comments may be shown as answers.

Block in table cell.

2 Answers 49 Views
PdfProcessing
This is a migrated thread and some comments may be shown as answers.
jaipal
Top achievements
Rank 1
jaipal asked on 21 Mar 2018, 07:46 PM

Hello All,

I am inserting certain amount of text into a block which is part of a table cell. , Post to that i am checking the size of the table and if it is over to the size of the page height , i am doing a split on the block. 

During Debug time , i can observe that the block is split properly but when we check the generated PDF file , we are observing the text to be overflowing in first page. Is this some thing that any one can help me. 

Block answerBlock = new Block();

answerBlock.InsertText(Answer);

if (textAreaTable.Measure().Height +  > pageHeight - 120)
{
Size setSize = answerBlock.Measure(new Size(450, pageHeight - (120 )));
Block secondBlock = answerBlock.Split();
var mySize = answerBlock.DesiredSize;
var pendingElements = answerBlock.PendingElements;
answerCell.Blocks.Add(answerBlock);
}

2 Answers, 1 is accepted

Sort by
0
Accepted
Deyan
Telerik team
answered on 26 Mar 2018, 04:33 PM
Hello,

As described in this forum post, IBlockElement interface is designed to measure, draw and finally split the block element. If you need to draw the textAreaTable instance in the available space then you should simply provide the available size as Draw method parameter.
textAreaTable.Draw(editor, new Rect(new Size(450, pageHeight - 120)));

Later if you need to draw the remaining content you should only split the table instance and it will recursively split the blocks inside its cells.
if (textAreaTable.HasPendingContent)
{
    textAreaTable = textAreaTable.Split();
}

I hope this helps.

Regards,
Deyan
Progress Telerik

0
jaipal
Top achievements
Rank 1
answered on 20 Apr 2018, 07:29 PM

Thank you Deyan.

Even i came across the same solution on HasPendingContent and it did worked for me. 

 

Tags
PdfProcessing
Asked by
jaipal
Top achievements
Rank 1
Answers by
Deyan
Telerik team
jaipal
Top achievements
Rank 1
Share this question
or