PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 8:46 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



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

Joined: Tue Aug 06, 2019 10:45 am
Posts: 45
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:

Code:
            int ncols = 6;
            int nrows = 50;

            float pageWidth = 560f;
            float colSize = pageWidth / ncols;
            var doc = new MigraDocument();
            doc.LastSection.AddParagraph(Lorem);
            doc.LastSection.AddParagraph(Ipsum);

            var tab = doc.LastSection.AddTable();

            for (int i = 0; i < ncols; ++i)
                tab.AddColumn(colSize);

            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?


Top
 Profile  
Reply with quote  
PostPosted: Tue May 11, 2021 1:57 pm 
Offline

Joined: Tue Aug 06, 2019 10:45 am
Posts: 45
Hello, I still have this problem, should I add this as a git issue?
or is there no solution to this problem?


Top
 Profile  
Reply with quote  
PostPosted: Wed May 12, 2021 6:57 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
IRlyDunno wrote:
Hello, I still have this problem, should I add this as a git issue?
That's up to you.

Probably it is just a simple change in the RTF Renderer.
However, the RTF part is not my area of expertise. Someone has to check the RTF documentation to find out which RTF elements must be added to achieve these effects. Feel free to investigate in that direction.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


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

All times are UTC


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], travrance and 152 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