PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
Table trouble :) https://forum.pdfsharp.net/viewtopic.php?f=2&t=3302 |
Page 1 of 1 |
Author: | jho [ Sat Feb 27, 2016 7:12 pm ] | ||
Post subject: | Table trouble :) | ||
Hi! 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: Code: 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"; row.Cells[tmp].Add(image); //icon image Image iconImage = new Image("../../1352357958.png"); iconImage.ScaleHeight = 0.9; iconImage.LockAspectRatio = true; row.Cells[tmp].Add(iconImage); 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!
|
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |