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

How to create a multi-column page-layout?
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2731
Page 1 of 1

Author:  kirchfritz [ Sun Feb 09, 2014 3:33 pm ]
Post subject:  How to create a multi-column page-layout?

I want to use PDFSharp or MigraDoc to create PDFs with a multi-column pagelayout. but I didnt find any hints how to do this?

The text should be placed on the page like in newspapers.

I cannot use tables, because tabels are organized by rows, but I only have a bulk of text, which should be filled in a three column page layout.

Can anybody help me?

Author:  () => true [ Sun Feb 09, 2014 9:52 pm ]
Post subject:  Re: How to create a multi-column page-layout?

Hi!

MigraDoc does not support several columns on one page.

One workaround: set a smaller page size for the MigraDoc document (size of one column) and draw several of these "logical" MigraDoc pages on the columns of one physical PDFsharp.
See also:
http://pdfsharp.net/wiki/MixMigraDocAnd ... ample.ashx

Author:  curtis.watson [ Fri Feb 14, 2014 7:54 pm ]
Post subject:  Re: How to create a multi-column page-layout?

Could you not create a table that fill the entire page, with the number of columns you require and a single row? You could then add multiple paragraphs into the single row under each different column.

Some quick sample code (not tested):

Code:
            Dim tbl As MigraDoc.DocumentObjectModel.Tables.Table = tf.AddTable()
            Dim col As MigraDoc.DocumentObjectModel.Tables.Column = Nothing
            Dim row As MigraDoc.DocumentObjectModel.Tables.Row = Nothing
            Dim para As MigraDoc.DocumentObjectModel.Paragraph = Nothing

            col = tbl.AddColumn
            col.Width = MigraDoc.DocumentObjectModel.Unit.FromInch(3)

            col = tbl.AddColumn
            col.Width = MigraDoc.DocumentObjectModel.Unit.FromInch(1)

            col = tbl.AddColumn
            col.Width = MigraDoc.DocumentObjectModel.Unit.FromInch(3)

            row = tbl.AddRow
            para = row.Cells(0).AddParagraph
            para.AddFormattedText("Title 1" + ControlChars.CrLf, MigraDoc.DocumentObjectModel.TextFormat.Bold)
            para.AddText("Article number one text.")

            para = row.Cells(0).AddParagraph
            para.AddFormattedText("Title 2" + ControlChars.CrLf, MigraDoc.DocumentObjectModel.TextFormat.Bold)
            para.AddText("Article number two text.")

            para = row.Cells(1).AddParagraph
            para.AddFormattedText("Title 3" + ControlChars.CrLf, MigraDoc.DocumentObjectModel.TextFormat.Bold)
            para.AddText("Article number three text.")

Author:  () => true [ Fri Feb 14, 2014 9:36 pm ]
Post subject:  Re: How to create a multi-column page-layout?

Hi!
curtis.watson wrote:
Could you not create a table that fill the entire page, with the number of columns you require and a single row?
Yes, can be done. And you can even add a second row to continue on the next page. But the general problem remains: if you want a single article to use all three columns, you still have to break the text somehow.

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