6

I seen a few example code which add a horizontal line using a Table, however I was wondering if there a faster way using the Paragraph instead. I look into the reportlab docs, however I could find anything.

So my question is, is it possible to add a horizontal line using Paragraph instead?

1 Answers1

16

The fastest way is probably using the HRFlowable this flowable attempt to mimic the behavior of the HTML <HR> just to give you an indication, this is how it looks in HTML:


As this function is not documented the best I can do is refer you to the source code which show all options that are available.

Below my own attempt of documenting this flowable

HRFlowable(width="80%", thickness=1, lineCap='round', color=lightgrey, spaceBefore=1, spaceAfter=1, hAlign='CENTER', vAlign='BOTTOM', dash=None)

width: Width of the horizontal line
thickness: Height of the horizontal line
lineCap: Determines whether a terminating line ends in a square exactly at the vertex, a square over the vertex or a half circle over the vertex.
color: Straight forward
spaceBefore: ??? Isn't used in the source code
spaceAfter: ??? Isn't used in the source code
hAlign: ??? Isn't used in the source code
vAlign: ??? Isn't used in the source code
dash: Allows the line to be broken into dots or dashes.

Dfranc3373
  • 2,048
  • 4
  • 30
  • 44
B8vrede
  • 4,432
  • 3
  • 27
  • 40
  • 1
    Thank you, I notice they left quite alot out from the documentation. I probably start Reverse Engineering everything now. Thank for the answer ;) –  Mar 21 '16 at 10:58
  • 2
    spaceBefore/spaceAfter (and likely hAlign/vAlign) are used by the Flowable parent class – Dan Udey Feb 22 '17 at 19:23
  • Additional examples found online: https://programtalk.com/python-examples/reportlab.platypus.flowables.HRFlowable/ – Dfranc3373 Aug 11 '21 at 01:00