PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 11:26 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: Sat Nov 14, 2020 10:28 pm 
Offline

Joined: Fri Mar 09, 2018 12:51 pm
Posts: 6
Hi,
I don't know if I've found a bug or if I am doing something wrong...
I am working with Migradoc library (C# Nuget 1.50.5147).

As an example let's take a table with four columns, where we merge the third and fourth (last) one and add borders to them:
Code:
private static Table BuildTable()
{
    Table table = new Table();

    table.AddColumn(100);
    table.AddColumn(60);
    table.AddColumn(280);
    table.AddColumn(60);

    Row row = table.AddRow();

    Cell cell = row.Cells[0];
    cell.AddParagraph("A");
    SetBorder(cell);

    cell = row.Cells[1];
    cell.AddParagraph("B");
    SetBorder(cell);

    cell = row.Cells[2];
    cell.MergeRight = 1;
    cell.AddParagraph("C");
    SetBorder(cell);

    return table;
}

private static void SetBorder(Cell cell)
{
    cell.Borders.Top.Width = 1;
    cell.Borders.Left.Width = 1;
    cell.Borders.Right.Width = 1;
    cell.Borders.Bottom.Width = 1;
}


The result is that the merged cell does not have the right border:
Attachment:
migra1.png
migra1.png [ 1.43 KiB | Viewed 6661 times ]


If I add another column, in order that the merge one is not the last one like followings, it works:

Code:
    // rest of code
    table.AddColumn(60);
    table.AddColumn(60); <-- Added fifth column

    Row row = table.AddRow();

    // rest of code


Is it a bug?


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 16, 2020 6:55 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
emaborsa wrote:
Is it a bug?
I don't know. Setting borders for the forth cell should work with your first implementation.

You can set border width for the table and then you will have borders on all sides - with just one assignment.

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


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 26, 2020 2:13 pm 
Offline

Joined: Fri Mar 09, 2018 12:51 pm
Posts: 6
Thanks, yes it would be another workaround.

I any case, I opened a ticket on Github.


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: Google [Bot] and 41 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