PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Mar 18, 2018 7:56 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
 Post subject: Table trouble :)
PostPosted: Sat Feb 27, 2016 7:12 pm 

Joined: Sat Feb 27, 2016 7:05 pm
Posts: 1

First time user of MigraDoc here and I really like what I have achieved so far. However, I am having an annoying problem I can't seem to get my head around, eventhough I read through multiple forums posts.

What I am trying to achieve:

- A table with 6 columns, 1 row
- Cell 1, 3, 5 contains an image on top of another image (to give background image effect)
- Cell 2, 4, 6 contains text

The problem is that I can't get both the background image effect and the image on top, centered at the same time. The result at the moment is (attached img).

The code I have so far:

Table table = new Table();
table.Borders.Width = 0.75;

for (int i = 0; i < 3; i++)
   Column column = table.AddColumn("1.2cm");
   column.Format.Alignment = ParagraphAlignment.Center;
   Column column2 = table.AddColumn("2.1cm");
   column2.Format.Alignment = ParagraphAlignment.Center;

Row row = table.AddRow();

for (int i = 0; i < 3; i++)
   int tmp = i * 2;

   //circle image
   Image image = new Image("../../circle-outline-512.png");
   image.WrapFormat.Style = WrapStyle.Through;
   image.ScaleHeight = 1.7;
   image.LockAspectRatio = true;
   image.Width = "0.7cm";
   //icon image
   Image iconImage = new Image("../../1352357958.png");
   iconImage.ScaleHeight = 0.9;
   iconImage.LockAspectRatio = true;

   row.Cells[tmp].VerticalAlignment = VerticalAlignment.Center;
   row.Cells[tmp].Format.Alignment = ParagraphAlignment.Center;
   //label text
   row.Cells[tmp + 1].AddParagraph(labelText);
   row.Cells[tmp + 1].VerticalAlignment = VerticalAlignment.Center;

I tried adding both images to a paragraph and centered the paragraph, but then the WrapStyle.Through effect is "lost" - the images are no longer on top of each other.

I also tried different image.Left, image.Top positions and no luck with RelativeHorizontal or RelativeVertical either.

Any input is appreciated!

MigraDoc-table.png [ 10.39 KiB | Viewed 1426 times ]
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: Baidu [Spider], Google [Bot] and 6 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:  
Powered by phpBB® Forum Software © phpBB Group