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

How should header column be implemented?
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2045
Page 1 of 1

Author:  lala [ Wed Jun 06, 2012 7:26 pm ]
Post subject:  How should header column be implemented?

I want to render a table with the first column repeating on every page. I see the Column object has a HeadingFormat property, but couldn't get it to do what I want -- is there any examples available that demonstrates this?

Thanks in advance.

Author:  lala [ Wed Jun 06, 2012 7:59 pm ]
Post subject:  Re: How should header column be implemented?

Here's what I have:

Code:
            Document doc = new Document();
            Section section = doc.AddSection();
            Table table = section.AddTable();
            table.Format.Borders.Width = 1;

            Column headerColumn = table.AddColumn();
            headerColumn.HeadingFormat = true;

            for (int i = 0; i < 100; i++) {
                table.AddColumn();
            }

            for (int i = 0; i < 15; i++) {
                Row row = table.AddRow();
                for (int j = 0; j < table.Columns.Count; j++) {
                    row[j].AddParagraph(string.Format("[{0}, {1}]", i, j));
                }
            }

            PdfDocumentRenderer render = new PdfDocumentRenderer(true);
            render.Document = doc;
            render.RenderDocument();
            string filename = "temp.pdf";
            render.Save(filename);
            Process.Start(filename);


Currently it gets cutoff at the 8th column. What do I have to do so that it'd automatically render the rest of the columns on a new page and repeat the first column?

Author:  () => true [ Thu Jun 07, 2012 8:22 am ]
Post subject:  Re: How should header column be implemented?

Hi!
lala wrote:
What do I have to do so that it'd automatically render the rest of the columns on a new page and repeat the first column?
AFAIK this is not (yet) implemented in the current generation of MigraDoc.

Heading rows do work, but currently all columns must fit the width of a single page.

You can save your document to an MDDDL file and then use the old MigraDoc client to render the PDF:
http://migradoc.empira.de/migradoc/Defa ... D=DlClient
This previous generation of MigraDoc supports wide tables spreading over several pages.

If you save the MDDDL file with the correct extension, double clicking the file will open the preview - just click the PDF symbol in the toolbar to create a PDF file.
The MigraDoc client includes a command-line tool (IIRC it's MGD.EXE) that allows you to run this step (MDDDL to PDF) automatically without a GUI popping up.

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