PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 2:00 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Space before not applied
PostPosted: Thu Aug 24, 2017 8:14 am 
Offline

Joined: Tue Apr 26, 2016 8:24 pm
Posts: 20
Why is space before not applied to paragraphs with same style if space after is set?

I have defined space after as 15 and space before as 7, having multiple paragraphs with this style should have a gap of 23 between them

DDL:
Code:
\document
{
  \styles
  {
    Normal
    {
      Font
      {
        Name = "Times New Roman"
      }
      ParagraphFormat
      {
        LeftIndent = "0mm"
        FirstLineIndent = "0mm"
        RightIndent = "0mm"
        SpaceBefore = "7mm"
        SpaceAfter = "15mm"
        LineSpacing = "0mm"
      }
    }

    Paragraph : Normal
    {
    }

  }
  \section
  [
    PageSetup
    {
      PageHeight = 842
      PageWidth = 595
      Orientation = Portrait
      LeftMargin = "20mm"
      RightMargin = "16mm"
      TopMargin = "15mm"
      BottomMargin = "20mm"
      FooterDistance = "10mm"
      HeaderDistance = "8mm"
      OddAndEvenPagesHeaderFooter = false
      DifferentFirstPageHeaderFooter = false
      SectionStart = BreakNextPage
      PageFormat = A4
      MirrorMargins = false
      HorizontalPageBreak = false
    }
  ]
  {
    \paragraph
    [
      Style = "Paragraph"
      Format
      {
        LeftIndent = 0
        RightIndent = 0
        SpaceBefore = "0mm"
        Borders
        {
          Width = "1mm"
        }
      }
    ]
    {
      \font("Normal"){paragraph1}
    }
    \paragraph
    [
      Style = "Paragraph"
      Format
      {
        LeftIndent = 0
        RightIndent = 0
        Borders
        {
          Width = "1mm"
        }
      }
    ]
    {
      \font("Normal"){paragraph2}
    }
    \paragraph
    [
      Style = "Paragraph"
      Format
      {
        LeftIndent = 0
        RightIndent = 0
        Borders
        {
          Width = "1mm"
        }
      }
    ]
    {
      \font("Normal"){paragraph3}
    }
  }
}


Attachments:
Untitled.png
Untitled.png [ 14.08 KiB | Viewed 6249 times ]
Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 24, 2017 8:19 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
Hi!
MariusIonut wrote:
I have defined space after as 15 and space before as 7, having multiple paragraphs with this style should have a gap of 23 between them
As I understand it the gap should be 15 mm.

Try this with Microsoft Word (either render to RTF or try manually in Word). Do you get 15 mm with Word or do you get 23 mm?
MigraDoc should behave like Word.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 24, 2017 8:39 am 
Offline

Joined: Tue Apr 26, 2016 8:24 pm
Posts: 20
Dig up a little bit and I think I figured out and its not on same style as I thought.

When it comes to chose the space before an item it compares the space after the first with space before the next one and takes the one with bigger value?


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 24, 2017 8:43 am 
Offline

Joined: Tue Apr 26, 2016 8:24 pm
Posts: 20
The gap is 15 but I thought it should be 15(space after first paragraph)+7(space before second paragraph)

Thank you Thomas, that was quite a fast response. It is indeed as in Word/PDF but i thought the logic was if you specify the space after and before it will sum them both but it seems that it will take only the greater value from both.


Edit: I was expecting more of what is in expected side in the attached image.


Attachments:
Untitled.png
Untitled.png [ 10.09 KiB | Viewed 6247 times ]
Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 24, 2017 11:29 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
Actually SpaceBefore = "7mm" guarantees that there will be (at least) 7 mm space before that paragraph.
If the previous paragraph has SpaceAfter = "15mm" then were will be exactly 15 mm space if there is no pagebreak between the paragraphs.

That's how Word works and MigraDoc copies that behavior.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 24, 2017 6:53 pm 
Offline

Joined: Tue Apr 26, 2016 8:24 pm
Posts: 20
Thank you Thomas.

Thomas Hoevel wrote:
Actually SpaceBefore = "7mm" guarantees that there will be (at least) 7 mm space before that paragraph.
If the previous paragraph has SpaceAfter = "15mm" then were will be exactly 15 mm space if there is no pagebreak between the paragraphs.

That's how Word works and MigraDoc copies that behavior.


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

All times are UTC


Who is online

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