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 

render tables with migradoc

 
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
a:m



Joined: 06 Nov 2007
Posts: 3

PostPosted: Tue Nov 06, 2007 5:19 pm    Post subject: render tables with migradoc Reply with quote

hi!

i want to generate pdf-files (i'm using migradoc and pdfsharp) with several tables in them.
generally this is not a problem, but sometimes i get the exception:

"Der Wert 0 ist für emSize ungültig. emSize muss größer als 0 und kleiner und kleiner als oder gleich System.Single.MaxValue sein.\r\nParametername: emSize"

when i try to render a certain table. i use the method

DosumentRenderer.RenderObject(XGraphics, XUnit.FromCentimeter(), XUnit.FromCentimeter(), "19cm", myTable);

did anybody have the same problem? where do i have to search? i'm a little helpless, because this table is always generated in the same way and sometimes it works and sometimes it does not...

anna-maria
Back to top
View user's profile Send private message
Thomas Hoevel



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

PostPosted: Tue Nov 06, 2007 5:38 pm    Post subject: Reply with quote

I get that error message in English:
Value of '0' is not valid for 'emSize'. 'emSize' should be greater than 0 and less than or equal to System.Single.MaxValue.
Parameter name: emSize

The error comes from .NET: from System.Drawing.DLL.

MigraDoc requested a font of size 0 - .NET doesn't allow this.
The problem is not the table, there is something wrong with (at least) one of your styles.
_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
a:m



Joined: 06 Nov 2007
Posts: 3

PostPosted: Wed Nov 07, 2007 9:13 am    Post subject: Reply with quote

thanks, thomas.

but now i've got a question concerning styles:
i wrote

Code:
Table myTable = new Table();
            myTable.Style = "Table";


is this not enough?
and why does it sometimes work and sometimes not? do you have any idea? if it doesn't have something to do with the table itself then it can't be the different content of the tables, or am i wrong?

anna-maria
Back to top
View user's profile Send private message
a:m



Joined: 06 Nov 2007
Posts: 3

PostPosted: Wed Nov 07, 2007 9:35 am    Post subject: Reply with quote

ok, i'm really really stupid.
i had an if-statement and i commented the line within it out but left the statement.
the next line is the line where the section with the table is added to the document. so if the if-statement is true, the table is added to the document, if not... it's not.

anna-maria
Back to top
View user's profile Send private message
Thomas Hoevel



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

PostPosted: Wed Nov 07, 2007 9:38 am    Post subject: Reply with quote

If you don't set the Style property, style "Normal" will be used.

Style is just a string, but you should only use style names that exist in Styles.

Creating a new style:
Code:

Styles styles = document.Styles;
Style style = styles.AddStyle("Table", StyleNames.Normal);

_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
trnilse



Joined: 26 May 2009
Posts: 6

PostPosted: Tue May 26, 2009 3:53 pm    Post subject: Reply with quote

I had the same problem only it happened every time (I got the message "Value of '0' is not valid for 'emSize'. 'emSize' should be greater than 0 and less than or equal to System.Single.MaxValue.
Parameter name: emSize").

I was adding one paragraph and one table to the PDF by using RenderObject. Turns out I then had to call DocRenderer.PrepareDocument() twice to get it to work (before each call to RenderObject).

Update: The problem was actually that i was 'newing' up the migradoc document for each object, but i didn't reinitialize the DocumentRenderer with the new document... ups Confused
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