PDFsharp & MigraDoc Forum

PDFsharp - A .NET library for processing PDF & MigraDoc - Creating documents on the fly
It is currently Fri May 16, 2025 6:18 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules

Also see our new Tailored Support & Services site.



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sat Mar 01, 2025 8:46 am 
Offline

Joined: Sat Mar 01, 2025 8:33 am
Posts: 1
Hi,
I have two problems with my table.
The first one, cells don't have the same height in a row.
The second one, cells don't get together. It's a gap between them.
It's a very simple table.

I use MigraDocCore and PdfSharpCore, both v1.3.65
This is the code, and the result is the attachment.

Paragraph p = section.AddParagraph();
p.Format.Font.Name = "Verdana";
p.Format.Font.Size = 12;
p.Format.Alignment = ParagraphAlignment.Center;
p.AddText("This is a title");
p.AddLineBreak();
p.AddLineBreak();

Table t1 = section.AddTable();
t1.Format.Borders.Width = new Unit(0.5, UnitType.Point);
t1.Format.Borders.Color = Colors.Black;
t1.Format.Font.Name = "Verdana";
t1.Format.Font.Size = 7;

t1.AddColumn(new Unit(0.7, UnitType.Centimeter));
t1.AddColumn(new Unit(5, UnitType.Centimeter));
t1.AddColumn(new Unit(9, UnitType.Centimeter));

Row r11 = t1.AddRow();
r11.HeightRule = RowHeightRule.Exactly;
r11.Height = new Unit(5, UnitType.Centimeter);

Paragraph p10 = r11[0].AddParagraph();

Paragraph p11 = r11[1].AddParagraph();
p11.AddText("Text of line 1");
p11.AddLineBreak();
FormattedText cursiva11 = p11.AddFormattedText("Text of line 2");
cursiva11.Italic = true;

Paragraph p12 = r11[2].AddParagraph();


Any help? Thanks in advance.


Attachments:
TableIssues.JPG
TableIssues.JPG [ 7.97 KiB | Viewed 2947 times ]
Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 03, 2025 8:21 am 
Offline
PDFsharp Guru
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 1044
Location: CCAA
Hi!
echulin wrote:
I use MigraDocCore and PdfSharpCore, both v1.3.65
These third-party libraries are off-topic here.

But that looks odd.
If you get the same results with MigraDoc 6.2.0 Preview 3, then please use the IssueSubmissionTemplate that allows us to replicate the issue.
https://docs.pdfsharp.net/General/Issue ... About.html

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


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 03, 2025 8:48 pm 
Offline
PDFsharp Guru
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 1044
Location: CCAA
Now I understand the "problem".

This code sets borders for the paragraphs inside the table. It does not activate the borders of the table.
echulin wrote:
t1.Format.Borders.Width = new Unit(0.5, UnitType.Point);


To activate the borders of the table, use "t1.Borders.Width" instead.
Adjacent cells share the border between them and there will be no gaps between them. And height is the same for all cells in a row.

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