Table - HTML formated text

Table - HTML formated text

Forum member · Jan 5, 2006
Is it possible to add HTML formated text of arbitrary length to a table? I've found the examples that add HTML formated text by adding an HTMLTextArea element to the table cell, but this process seems to need a pre-knowledge of the required area for the HTML. I was hoping to be able to supply the formated text to the text property of the cell so that the cell row height would expand to fit the text. (It seems to treat it as straight text, displaying the formating HTML in addition to the text) As an alternative, is it possible to compute the running height of the HTMLtextArea given a width? This would allow me to construct the HTMLtextArea that would fit the text, then add it to the table. This must be simple, but I'm kind of at a loss as to how to add a formated paragraph to a table cell. Thanks

Re: Table - HTML formated text

Support · Jan 6, 2006
Hello, It is not possible to directly add formatted text to the table. You can add it using the HtmlTextArea page element. The HtmlTextArea has built in methods for handling dynamic data better. For instance, using the GetRequiredHeight() method the height of the HtmlTextArea that is used in the constructor is not relevant since that height is reset to the appropriate required height value after the variable instantiation. So that will allow you to set the height of the HtmlTextArea equal to the required height to fit the required formatted text: Dim MyHtmlTextArea As HtmlTextArea = New HtmlTextArea("Text", 150, currentY + 2, 255, 11, Font.TimesRoman, 11) MyHtmlTextArea.Height = MyHtmlTextArea.GetRequiredHeight() Once the height is reset, you can add the HtmlTextArea page element to the cell within the table which will expand dynamically to fit the HtmlTextArea. Thanks, ceTe Software Support Team

Re: Table - HTML formated text

Forum member · Jan 6, 2006
Perfect, I knew it would be simple. It wasn't clear that you could resize an HTMLtextArea after creating it, but it makes sense now. Thanks

Re: Table - HTML formated text

Forum member · Jan 6, 2006
How do you add an htmltextarea to a cell & get it to stay in the cell. when i create a htmlarea i seem to have to insert the integer values for where it appears on the page, i reaaly need it to appear in the cell. Thanks Steve

Re: Table - HTML formated text

Support · Jan 6, 2006
Steve, There is an Add method on the row of a Table that takes any Page Element. You can then instantiate an HtmlTextArea and pass it into this Add method and it will appear in that Tables specified cell. As for the X and Y values that need to be specified in the HtmlTextArea's constructor, when you add the HtmlTextArea to a cell then that X and Y value become relative to the upper left corner of the cell (this is just the same as if you add the HtmlTextArea is added to the Page then the X and Y become relative to the Page). Thanks, ceTe Software Support Team

Re: Table - HTML formated text

Forum member · Jan 6, 2006
When adding an HTMLtextArea to a cell - make the X,Y positions relative to the upper left corner of the Cell, so usually this means setting X & Y to zero so the area is anchored to the cell position instead of the page. '===Create the Table Dim myTable As ceTe.DynamicPDF.PageElements.Table myTable = New ceTe.DynamicPDF.PageElements.Table(0, 0, 512, 512) '===Add the Columns myTable.Columns.Add(100) myTable.Columns.Add(412) '===Create the Row Dim myRow As Row = myTable.Rows.Add(1) '===Create the HTMLtextArea with position X=0, Y=0 Dim HTa1 As New HtmlTextArea(P1, 0, 0, 100, 8, ceTe.DynamicPDF.FontFamily.Helvetica, 8, False) '===Resize HTMLtextArea to fit the text HTa1.Height = HTa1.GetRequiredHeight '===Add the HTMLtextArea to the table cell myRow.Cells.Add(HTa1) This worked for me, your milage may vary... Dale

Re: Table - HTML formated text

Forum member · Jan 7, 2006
Thanks for your help! I have one more question. I'm trying to add html text to a cell & this html text can be any length, how do i set the cell to adjust its height accordingly to accommodate the html text area? Thanks Steve

Re: Table - HTML formated text

Forum member · Jan 7, 2006
ignore my last message, the post by dale explained like a treat. Cheers Dale & support team. I'm getting to grips with this now! Thanks steve

Re: Table - HTML formated text

Forum member · Jan 7, 2006
Is it possible to have a table which spans many pages & within that table an html text area which also spans many pages (length varies) Mnay Thanks Steve

Re: Table - HTML formated text

Support · Jan 9, 2006
Steve, There is not actually an functionality built into our product that will handle this automatically but by doing a few manual calculations you will likely be able to achieve the desired results. The key to accomplishing this would be figuring out how much space is left on the page from where your cell starts (the cell you are adding the HtmlTextArea) to the end of the space on the page. For example, if you know that from your current row you have a height of 300 left on the page then you would create an HtmlTextArea of height 300 and add it to that cell. Now you will be able to add the overflow of the HtmlTextArea to the next row of the table. In doing this then the HtmlTextArea will flow to the next page as your Table flows to the next page as well. Thanks, ceTe Software Support Team