PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Get Paragraph Text
https://forum.pdfsharp.net/viewtopic.php?f=2&t=489
Page 1 of 1

Author:  interpeo [ Sat Sep 27, 2008 3:26 pm ]
Post subject:  Get Paragraph Text

Hi all,

I tried a very simple task without success. :(

How can I get the text of a Paragraph, for example after I write the fallawing code:

row.Cells[0].AddParagraph("pdfsharp")

I don't see a property like: row.Cells[0].Text / Value

Thanx a lot, great library!

Matteo

Author:  Thomas Hoevel [ Mon Oct 06, 2008 1:10 pm ]
Post subject: 

A cell can contain more than simple text.

IIRC you'll find it in row.Cells[0].Elements.

In your case there should be one Paragraph object, but complex cells may contain several (potentially nested) elements.
You can even have a table in a cell ...

Author:  PeterGillespie [ Thu Oct 23, 2008 8:47 am ]
Post subject: 

This is how I did it:

Code:
StringBuilder allTextInParagraph = new StringBuilder();
 foreach (DocumentObject element in _paragraph.Elements)
 {

    if (element is MigraDoc.DocumentObjectModel.Text)
   {

     MigraDoc.DocumentObjectModel.Text textObj =
                                  (MigraDoc.DocumentObjectModel.Text)element;

     allTextInParagraph.Append(textObj.Content);
   }
}

Author:  Orestone [ Mon Mar 23, 2009 6:24 am ]
Post subject:  Table in a Cell

Thomas Hoevel wrote:
... You can even have a table in a cell ...


Not sure this is an appropriate place to ask this but how do I put a Table in a Cell as hinted above?

The following does not compile
Code:
var cell = new Cell;
cell.AddTable();

as AddTable is not a method of the class Cell.

I understand from another post of mine http://forum.pdfsharp.net/viewtopic.php?p=1610&mforum=pdfsharp#1610 that I can embed a Table in a TextFrame but if I do that I end up with the following hierarchy:
Code:
Cell
|_TextFrame (containing a single cell table)
  |_Table (1x1) containing another table/textframe combo
    |_TextFrame
      |_Table (rows_N x cols_M)


This hierarchy quickly gets very confusing and with nested tables and worse (for me), the TextFrame does not expand to the size of the embedded table (like it does if it simply contained paragraphs) so the following rows in my outer level table overlay those of the inner table.

So the question is: Is it possible to add a Table to a Cell of a containing table and have the containing table expand with the embedded table?

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