text area in a table

text area in a table

Forum member · Mar 18, 2008
I am creating a tables dynamically from HTM markup. Example Markup ( always different ) - <table> <tr><th width="55"><b>#</b></th><th width="300"><b>Description of Action Step</b></th></tr> <tr><td><b>1<b></td><td>Analyze spend volume for each commodity, division, and employee role</td></tr> <tr><td><b>2<b></td><td>Review current spend on cards to identify the spend types and/or transaction</td></tr> </table> I create an xml text reader to parse the table XmlTextReader xDoc = new XmlTextReader( text.Substring( tableMatch.Index , endTable8 ) , XmlNodeType.Element , context ); In order for the Bold tags to be acknowledged I need to add a text area to the table. The problem is that I do not know at this point the width of the cell that I am adding the textarea to. Is there a way to let the textarea inherit its dimensions from its container? When adding text as a string to the cell the dimensions are inherited. if ( xDoc.LocalName.Equals( "td" ) ) { // Create an FormattedTextAreaStyle and set the initial properties FormattedTextAreaStyle textAreaStyle = new FormattedTextAreaStyle(familyWhitney, 12, false); // Create an FormattedTextArea using the style FormattedTextArea formattedTextArea = new FormattedTextArea(xDoc.ReadString(), 0, ?,?,?, textAreaStyle); Cell cell = row.Cells.Add(formattedTextArea); }

Re: text area in a table

Support · Mar 18, 2008
Hello, It is not possible to get the width required for the FormattedTextArea. If you specify the Width for the formatted text area then you can get the Height required by using the GetRequiredHeight method. You can get the width of the text by using the GetTextWidth method of the font class and set this width to the formatted text area. If you are using a bold font then this will give the width for the bold text. If you are using the <b> tag then it will give the width for the normal text. Thanks, ceTe Software Support Team.

Re: text area in a table

Forum member · Mar 18, 2008
Hello, Sorry if I was not extremely clear. I do not want to get the width required of the formattedtextarea, I want to set the width of the formattedtextarea to be that of the column that I am inserting the cell.... I want it to inherit, or fill, the space I have already allocated in the table, not override it. Is it possible to not set a width and have it use the width of the cell? Thanks!

Re: text area in a table

Support · Mar 18, 2008
Hello, You will have to specify the width for the formatted text area. The formatted text area will not inherit the width given to the cell of the table. If you are creating the cells dynamically then you can get the width of the cell by using the Width property of the Cell object. Thanks, ceTe Software Support Team.