PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun May 09, 2021 8:35 am

All times are UTC

Forum rules

Please read this before posting on this forum: Forum Rules

Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Thu Apr 15, 2021 3:06 pm 

Joined: Tue Aug 06, 2019 10:45 am
Posts: 44
I can't find anything related to this issue I'm having, but the table property KeepTogether and the Row property Keepwith doesn't work on rtf

I made some code that lets me replicate the issue:

            int ncols = 6;
            int nrows = 50;

            float pageWidth = 560f;
            float colSize = pageWidth / ncols;
            var doc = new MigraDocument();

            var tab = doc.LastSection.AddTable();

            for (int i = 0; i < ncols; ++i)

            for (int i = 0; i < nrows; ++i)
                var row = tab.AddRow();
                if (i == 0)
                    row.HeadingFormat = true;

                for (int j = 0; j < ncols; ++j)
                    if (i == 0)
                        row.Cells[j].Format.Shading.Color = Colors.DarkBlue;
                        row.Cells[j].Format.Font.Color = Colors.White;
                    else if (i % 2 == 0)
                        row.Cells[j].Format.Shading.Color = Colors.AliceBlue;
                        row.Cells[j].Format.Font.Color = Colors.White;

                    row.Cells[j].AddParagraph(j + " : " + i);
                    row.Cells[j].Borders.Width = 0.5;
                    row.Cells[j].RoundedCorner = RoundedCorner.BottomLeft | RoundedCorner.BottomRight | RoundedCorner.TopLeft | RoundedCorner.TopRight;
            tab.Rows.Alignment = RowAlignment.Center;

            tab.Rows[0].KeepWith = tab.Rows.Count;
            tab.KeepTogether = true;

saving/rendering this document as a rtf, does not give the expected output, since the table is split between the first and second pages.

Saving/rendering this document as a pdf, the result is the full table, on the second page, as per expected.

is there any way to make the tables NOT break on rtf?

Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 10 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