PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Apr 27, 2024 6:15 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Get Paragraph Text
PostPosted: Sat Sep 27, 2008 3:26 pm 
Offline

Joined: Sat Sep 27, 2008 3:19 pm
Posts: 1
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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Oct 06, 2008 1:10 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
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 ...

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Oct 23, 2008 8:47 am 
Offline

Joined: Tue Oct 14, 2008 1:08 pm
Posts: 8
Location: England
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);
   }
}


Top
 Profile  
Reply with quote  
 Post subject: Table in a Cell
PostPosted: Mon Mar 23, 2009 6:24 am 
Offline

Joined: Fri Oct 24, 2008 12:24 pm
Posts: 13
Location: Brisbane, Australia
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?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 385 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group