PDFsharp & MigraDoc Forum

PDFsharp - A .NET library for processing PDF & MigraDoc - Creating documents on the fly
It is currently Mon Sep 29, 2025 11:46 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  [ 5 posts ] 
Author Message
PostPosted: Mon Dec 17, 2012 11:49 am 
Offline

Joined: Fri Dec 14, 2012 10:28 am
Posts: 9
Hi everybody, this is my first post in the forum. So, first of all i wanna thank you all the team for this amazing and powerful library.

I was wondering (I searched in the forum before asking) if is it possible to define a Style with line breaks in it. Since .SpaceAfter seems to have no results for me. This is the way i define a style:

Code:
        style = document.Styles("Heading1")
        style.Font.Name = "Tahoma"
        style.Font.Size = 15
        style.Font.Bold = True
        style.Font.Color = Colors.DarkBlue
        style.ParagraphFormat.PageBreakBefore = True
        style.ParagraphFormat.SpaceAfter = 15


Thanks


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 17, 2012 1:40 pm 
Offline

Joined: Fri Dec 14, 2012 10:28 am
Posts: 9
The PageBreakBefore is also not working. What i'm doing wrong? I've tried to create a new style too, with no effects.

Code:
        style = document.AddStyle("MyHeading1", "Heading1")
        style.ParagraphFormat.PageBreakBefore = True
        style.Font.Bold = False
        style.ParagraphFormat.SpaceAfter = "15"



PD: Font color, size, name... are working as spected


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 17, 2012 3:56 pm 
Offline

Joined: Fri Dec 14, 2012 10:28 am
Posts: 9
I've just figured it out. If the style is used this way:

Code:
        Dim paragraphTitle As DOM.Paragraph = section.AddParagraph()
        paragraphTitle.AddFormattedText("Curabitur libero lacus")
        paragraphTitle.Style = "MyHeading1"


the ParagraphFormat properties defined in the style are ignored, but if you add the paragraph with the style this way, it works as expected:

Code:
      section.AddParagraph("Lore ipsum titolo tiulo", "MyHeading1")


I ignore if this is already defined somewhere in the wiki...i could not find it.

Thanks anyway


Top
 Profile  
Reply with quote  
PostPosted: Wed Dec 19, 2012 8:08 pm 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 354
Hi!
weilah wrote:
the ParagraphFormat properties defined in the style are ignored
Maybe because the formatted text also has a style. (Could be a feature, not a bug.)
You can use "var para = AddParagraph("Text goes here");" and then set the style of the paragraph.
AddFormattedText is only needed to mix several styles in a single paragraph.

_________________
Öhmesh Volta ("() => true")
PDFsharp Team Holiday Substitute


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 20, 2012 1:49 pm 
Offline

Joined: Fri Dec 14, 2012 10:28 am
Posts: 9
Ok, i understand. And when you use "AddFormattedText", just the "Font" properties of the defined style apply. And the "ParagraphFormat" properties have no effect.

Is that right?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 288 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