PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index PDFsharp - moved to http://forum.pdfsharp.net/
Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

MigrDoc Table in a row?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/
View previous topic :: View next topic  
Author Message
NateDawg



Joined: 01 Apr 2008
Posts: 6

PostPosted: Fri Apr 04, 2008 5:36 am    Post subject: MigrDoc Table in a row? Reply with quote

Is it possible to add a table to a row or cell of another table? I can't seem to find a way to do it.

I have a table of records that are retrieved from a database and each record has a few child records that I need to display in line. the child records have a different number of columns and they are a different width. So I figured a table in a table was the best solution (like in Html code).

Is this possible?

thanks,

-- Nathan Rover
Back to top
View user's profile Send private message
Thomas Hoevel



Joined: 16 Oct 2006
Posts: 387
Location: Cologne, Germany

PostPosted: Mon Apr 07, 2008 7:52 am    Post subject: Reply with quote

This can be done and I did it a few months ago, but don't remember the trick.

Don't look for an AddTable method at the table cell. Use "new Table()" and the generic Add method. I don't recall if I added the table directly to the cell or if I added a paragraph to the cell and the table to the paragraph.

Related topic (uses a TextFrame for that purpose which is not generally needed to have nested tables)
_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
NateDawg



Joined: 01 Apr 2008
Posts: 6

PostPosted: Tue Apr 08, 2008 8:57 pm    Post subject: I'm still getting an error. Reply with quote

I've tried to add it to the cell and to a paragraph and I'm getting an error: Overload resolution failed because no accessible 'Add' can be called with these arguments.

here is my code section:

Code:
For Each DTRow As DataRow In Students.Rows
  Dim tbl As New MigraDoc.DocumentObjectModel.Tables.Table()
  tbl.Borders.Width = 0.75

  Column = tbl.AddColumn(MigraDoc.DocumentObjectModel.Unit.FromInch(1.25))
  Column.Format.Alignment = ParagraphAlignment.Center

  Row = tbl.AddRow()
  Cell = Row.Cells(0)
  Cell.AddParagraph(i.ToString())

  Row = Table.AddRow()
  Cell = Row.Cells(0)
  Cell.MergeRight = 5
  Paragraph = Cell.AddParagraph()
  Paragraph.Add(tbl)
  i += 1
Next


The line that causes the error is "Paragraph.Add(tbl)" "tbl" is the name of the table I'm trying to insert in to "table" which is the main table. Each "tbl" will be about 4 or 5 rows, with different columns than the main table. My hope was that if a complete "tbl" did not fit on a page it would move to the next page. I can't figure out how to do that with just one table. Any suggestions?

Thanks,

-- Nathan Rover
Back to top
View user's profile Send private message
Thomas Hoevel



Joined: 16 Oct 2006
Posts: 387
Location: Cologne, Germany

PostPosted: Wed Apr 09, 2008 7:35 am    Post subject: Re: I'm still getting an error. Reply with quote

NateDawg wrote:
My hope was that if a complete "tbl" did not fit on a page it would move to the next page. I can't figure out how to do that with just one table. Any suggestions?


I don't recall how I managed to get nested tables when I tried it about two years ago ...

Today I tried it with a textframe in a cell:
Code:
        Cell cell = row1.Cells[0];
        TextFrame tf = cell.AddTextFrame();
        Table table2 = tf.AddTable();
        table2.Borders.Width = 1;
        table2.AddColumn();
        row = table2.AddRow();
        row.Cells[0].AddParagraph("*** Test ***");


This works and should do the trick (if the nested tables are small enough to fit on a page).
_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/ All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own YouTube Clone

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com