PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index PDFsharp - moved to http://forum.pdfsharp.net/
Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Important Notice: We regret to inform you that our free phpBB forum hosting service will be discontinued by the end of June 30, 2024. If you wish to migrate to our paid hosting service, please contact billing@hostonnet.com.
Migra Doc table image

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/
View previous topic :: View next topic  
Author Message
mav23



Joined: 02 Sep 2008
Posts: 5
Location: India

PostPosted: Tue Sep 02, 2008 6:18 am    Post subject: Migra Doc table image Reply with quote

Hi ,
i have something like this for creating a table via migradoc
Document document = new Document();
Table table = new Table();
Column column = table.AddColumn(Unit.FromInch(7));
Cell cell;
Row row = table.AddRow();
cell = row.Cells[0];
cell.AddParagraph("test");
table.SetEdge(0, 0, 1, 1, Edge.Box, BorderStyle.Single, 1.5);
document.LastSection.Add(table);

problem is i want to add a background image to the table not for a cell.
how to do this? someone please help
Back to top
View user's profile Send private message
Thomas Hoevel



Joined: 16 Oct 2006
Posts: 387
Location: Cologne, Germany

PostPosted: Tue Sep 02, 2008 7:35 am    Post subject: Reply with quote

Hello!

AFAIK background images are not supported - neither for cells nor for tables.

You can achieve a similar effect if you add an image just before you add the table. Set the WrapStyle of the image to "Through" and the table will be drawn above the image.
_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
mav23



Joined: 02 Sep 2008
Posts: 5
Location: India

PostPosted: Tue Sep 02, 2008 8:35 am    Post subject: Reply with quote

Hi thomas ,
thanks a lot for the quick reply,can u help me out in the code part a bit?
I need the code to add an image.Right now am stuck as to how to implement this in migradoc,as i just started using this pdf tool

Document document = new Document();
Section section = document.AddSection();
section.AddImage("test.gif");
Table table = new Table();
Column column = table.AddColumn(Unit.FromInch(7));
Cell cell;
Row row = table.AddRow();
cell = row.Cells[0];
cell.AddParagraph("test");
table.SetEdge(0, 0, 1, 1, Edge.Box, BorderStyle.Single, 1.5);
document.LastSection.Add(table);

it will be helpful if u can add code, the way u wanted me to implement image functionality.I created a section and added an image just before i create the table.Now how i proceed to add imagewrapstyle as through?plz help me with the code
Back to top
View user's profile Send private message
Thomas Hoevel



Joined: 16 Oct 2006
Posts: 387
Location: Cologne, Germany

PostPosted: Tue Sep 02, 2008 10:25 am    Post subject: Reply with quote

AddImage returns the image and allows you to change its appearance:
Code:
MigraDoc.DocumentObjectModel.Shapes.Image image = section.AddImage("<filename goes here>");
image.WrapFormat.Style = MigraDoc.DocumentObjectModel.Shapes.WrapStyle.Through;

Or with the appropriate usings:
Code:
Image image = section.AddImage("<filename goes here>");
image.WrapFormat.Style = WrapStyle.Through;
image.Width = Unit.FromInch(7);


The height of the image and the height of the table should match and you should take care that the table will never split on a pagebreak.
_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
mav23



Joined: 02 Sep 2008
Posts: 5
Location: India

PostPosted: Tue Sep 02, 2008 11:17 am    Post subject: Reply with quote

thank you very much thomas
i got what i wanted:)i was trying to get a watermark effect with this actually..
and its done now:) thank you once again for the quick replies u gave me
Back to top
View user's profile Send private message
mav23



Joined: 02 Sep 2008
Posts: 5
Location: India

PostPosted: Wed Sep 03, 2008 4:37 am    Post subject: Reply with quote

hi
just a quick clarification..
in my code i have cell.AddParagraph("test")
the text is coming after leaving a small gap from left side of table.so when am applying image ,the image is starting where the text starts am i missing something? or is it by default that way? anything i can do to make the image start from table left end without leaving gap..
Back to top
View user's profile Send private message
Thomas Hoevel



Joined: 16 Oct 2006
Posts: 387
Location: Cologne, Germany

PostPosted: Wed Sep 03, 2008 8:28 am    Post subject: Reply with quote

Hello!

It's a feature: the text in the table is left aligned with the text outside the table.

You can give the image a negative left position to make up for the padding of the table
_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
mav23



Joined: 02 Sep 2008
Posts: 5
Location: India

PostPosted: Wed Sep 03, 2008 9:57 am    Post subject: Reply with quote

ok thanks agian thomas:)
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/ All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own YouTube Clone

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com