PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Space before not applied
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3647
Page 1 of 1

Author:  MariusIonut [ Thu Aug 24, 2017 8:14 am ]
Post subject:  Space before not applied

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 6320 times ]

Author:  Thomas Hoevel [ Thu Aug 24, 2017 8:19 am ]
Post subject:  Re: Space before not applied

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.

Author:  MariusIonut [ Thu Aug 24, 2017 8:39 am ]
Post subject:  Re: Space before not applied

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?

Author:  MariusIonut [ Thu Aug 24, 2017 8:43 am ]
Post subject:  Re: Space before not applied

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 6318 times ]

Author:  Thomas Hoevel [ Thu Aug 24, 2017 11:29 am ]
Post subject:  Re: Space before not applied

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.

Author:  MariusIonut [ Thu Aug 24, 2017 6:53 pm ]
Post subject:  Re: Space before not applied

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.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/