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

Border of cell is dawing over whole row
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2521
Page 1 of 1

Author:  stefan2342 [ Thu Jul 18, 2013 12:51 pm ]
Post subject:  Border of cell is dawing over whole row

Hi,

I'm using Migradoc for drawing a table. I used this code:

Code:
Document Doc = new Document();
Section Section = Doc.AddSection();
Table t = Section.AddTable();

t.AddColumn();
t.AddColumn();
t.AddColumn();
t.AddColumn();
t.AddColumn();
t.AddColumn();

Row r0 = t.AddRow();
r0.Cells[0].Borders.Width = 0.75;
r0.Cells[1].Borders.Width = 0.75;
r0.Cells[2].Borders.Width = 0.75;
r0.Cells[3].Borders.Width = 0.75;
r0.Cells[4].Borders.Width = 0.75;
r0.Cells[5].Borders.Width = 0.75;

Row r1 = t.AddRow();
r1.Cells[0].MergeRight = 5;

Row r2 = t.AddRow();
r2.Cells[0].Borders.Width = 0.75;
r2.Cells[2].Borders.Width = 0.75;

PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(true, PdfFontEmbedding.Always);
pdfRenderer.Document = Doc;
pdfRenderer.RenderDocument();
pdfRenderer.PdfDocument.Save(String.Format("{0}.pdf", "Test"));   


Row 2 shouldn't have any border but it has a bottom border.

Is there anything wrong with my source code or is it a bug?

I am using Migradoc/PDFSharp 1.32 WPF

Thanks
Stefan.

Attachments:
File comment: Output file
output.JPG
output.JPG [ 25.16 KiB | Viewed 5661 times ]

Author:  Thomas Hoevel [ Thu Jul 18, 2013 2:27 pm ]
Post subject:  Re: Border of cell is dawing over whole row

stefan2342 wrote:
Is there anything wrong with my source code or is it a bug?
I'm afraid it is a bug.

To determine the border between row 1 and row 2, MigraDoc combines the settings of both rows. Problem is the MergeRight and the border for the first column is used for all columns.

I can suggest three lines of code as a workaround:
Code:
Row r1 = t.AddRow();
r1.Cells[0].MergeRight = 5;
r1.Cells[0].Borders.Width = 0;
Row r1A = t.AddRow();
r1A.Height = 0;
r1A.HeightRule = RowHeightRule.Exactly;
I add a new row with no height and no border.

IMHO your original code should work and I'll put this issue on the bug list.

Author:  stefan2342 [ Thu Jul 18, 2013 2:36 pm ]
Post subject:  Re: Border of cell is dawing over whole row

Thanks for your quick response. Your workaround ist working fine.

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