Continuing Large Amount of Text within Cell

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Generator for .NET (v4)  /  Continuing Large Amount of Text within Cell

DynamicPDF Generator for .NET (v4) Forum

I have a maste table that has other tables within it and have no problem implementing the GetOverflowRows().

The problem I am having is when a specific cell has more text than can fit on one page, how does one break the content in that cell apart?

Thanks for any help!

i.Narrative is the large amount of text (around page and a half).

Here's a code snippet:
'Master table
Dim tableMaster As Table = New Table(0, 60, 576, 671)
tableMaster.Width = 576
tableMaster.Columns.Add(576)
tableMaster.BorderWidth = 0

Dim MasterRowNarrative As Row = tableMaster.Rows.Add
Dim tableNarrative As Table = New Table(0, 0, 572, 25)
tableNarrative.Columns.Add(572)
tableNarrative.BorderWidth = 1


Dim TableNarrativeRow1 As Row = tableNarrative.Rows.Add(8, Font.TimesBold, 7, RgbColor.Black, RgbColor.White)
Dim TableNarrativeRow2 As Row = tableNarrative.Rows.Add(8, Font.TimesRoman, 7, RgbColor.Black, RgbColor.White)

TableNarrativeRow1.BackgroundColor = Grayscale.Silver
TableNarrativeRow1.Cells.Add("Narrative").Align = CellAlign.Left

'*****************************************************
'THIS IS THE CELL THAT HAS THE LARGE AMOUNT OF TEXT THAT NEEDS
'TO BE BROKEN UP ACROSS MULTIPLE PAGES (IF NECESSARY)
'************************************************************
Dim NarrativeCell As Cell = TableNarrativeRow2.Cells.Add(i.Narrative)
NarrativeCell.Align = CellAlign.Left


'Set the actual table height

tableNarrative.Height = tableNarrative.GetRequiredHeight
MasterRowNarrative.Cells.Add(tableNarrative)

Do
  Dim MyPage As Page = New Page(PageSize.Letter)
  MyPage.Dimensions.SetMargins(18, 18, 18, 18)
  MyPage.Elements.Add(tableMaster)
  MyDocument.Pages.Add(MyPage)
  tableMaster = tableMaster.GetOverflowRows()
Loop While Not (tableMaster Is Nothing)

'Add the template to the document
MyDocument.Template = MyTemplate

MyDocument.Draw(sDocumentPath & "\" & sDocumentName & ".pdf")
Posted by a ceTe Software moderator
Hello,

It is not possible to split a cell to add the overflow to the next page. You will have to split the text which can fit in one page and add that text only to the cell and add the remaining text to the cell in another page.

You can get the height required by the text using the GetRequiredHeight method of the TextArea page element and you can use this height to check whether the text fits in the page or not. Depending on this you can break the text and add it in two different rows so that the remaining text will go to another page.

Thanks,
ceTe Software Support Team.
I was hoping I didn't have to do that.  I'll have to keep track of all the heights of previous elements to determin how uch space remind on the page.

Thanks for the reply.

Erez
Posted by a ceTe Software moderator
Hello Erez,

Yes, you will have to keep track of the Y position and the height available on the page to break the text. It is not possible to split the cell so you will have to break the text in this case.

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 3:29 AM.