[reportlab-users] Style sheet for paragraphs

Andy Robinson reportlab-users@reportlab.com
Sun, 14 Sep 2003 21:34:40 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_000E_01C37B08.01454EA0
Content-Type: text/plain;
	charset="US-ASCII"
Content-Transfer-Encoding: 7bit

Either create or get hold of a ParagraphStyle and set its attributes as
you wish.  For example, if you want to change the Normal style,
add these two lines:

   styleN.alignment = 'justify'
   styleN.fontName = 'Helvetica-Bold'

To make a new one do
   from reportlab.lib.styles import ParagraphStyle
   myStyle = ParagraphStyle('fancy')
   myStyle.alignment = 'justify'
   ...
or whatever.

Paragraphs and ParagraphStyles are thoroughly documented in
Chapter 6 of our user guide. However, if you are new to Python or
object oriented programming I can see this might need
more examples.....

We'll try to get you some pointers on the chart tomorrow...

- Andy


  -----Original Message-----
  From: reportlab-users-admin@reportlab.com
[mailto:reportlab-users-admin@reportlab.com]On Behalf Of Proboscis Admin
  Sent: 12 September 2003 16:23
  To: reportlab-users@reportlab.com
  Subject: [reportlab-users] Style sheet for paragraphs



  I have the following code were it places my text in the frame but I have
no idea how to make it justify and change the font.any advice?code?
  I tried making my own style sheet but im getting too many errors.

  Thank you

  story = []
  c.translate(13.5*mm,159*mm)
  c.rotate(180)
  f = Frame(-85*mm, -100*mm, 85*mm,100*mm, showBoundary=0)
  styles = getSampleStyleSheet()
  styleN = styles['Normal']
  story.append(Paragraph(escape(blah fjgdlfjg& ...dgngjn fbfnbjf fnfjbn
mfnbm ,dgnf gm,nmgbnf b),styleN))

------=_NextPart_000_000E_01C37B08.01454EA0
Content-Type: text/html;
	charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D802472520-14092003><FONT face=3DArial color=3D#0000ff =
size=3D2>Either=20
create or get hold of a ParagraphStyle and set its attributes=20
as</FONT></SPAN></DIV>
<DIV><SPAN class=3D802472520-14092003><FONT face=3DArial color=3D#0000ff =
size=3D2>you=20
wish.&nbsp; For example, i</FONT></SPAN><SPAN =
class=3D802472520-14092003><FONT=20
face=3DArial color=3D#0000ff size=3D2>f you want to change the Normal =
style,=20
</FONT></SPAN></DIV>
<DIV><SPAN class=3D802472520-14092003><FONT face=3DArial color=3D#0000ff =
size=3D2>add=20
these two lines:&nbsp;</FONT></SPAN></DIV>
<DIV><SPAN class=3D802472520-14092003><FONT face=3DArial color=3D#0000ff =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D802472520-14092003><FONT face=3DArial color=3D#0000ff =

size=3D2>&nbsp;&nbsp; styleN.alignment =3D 'justify'</FONT></SPAN></DIV>
<DIV><SPAN class=3D802472520-14092003><FONT face=3DArial color=3D#0000ff =

size=3D2>&nbsp;&nbsp; styleN.fontName =3D =
'Helvetica-Bold'</FONT></SPAN></DIV>
<DIV><SPAN class=3D802472520-14092003><FONT face=3DArial color=3D#0000ff =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D802472520-14092003><FONT face=3DArial color=3D#0000ff =
size=3D2>To=20
make a new one do</FONT></SPAN></DIV>
<DIV><SPAN class=3D802472520-14092003><FONT face=3DArial color=3D#0000ff =

size=3D2>&nbsp;&nbsp; from reportlab.lib.styles import=20
ParagraphStyle</FONT></SPAN></DIV>
<DIV><SPAN class=3D802472520-14092003><FONT face=3DArial color=3D#0000ff =

size=3D2>&nbsp;&nbsp; myStyle =3D =
ParagraphStyle('fancy')</FONT></SPAN></DIV>
<DIV><SPAN class=3D802472520-14092003><FONT face=3DArial color=3D#0000ff =

size=3D2>&nbsp;&nbsp; myStyle.alignment =3D =
'justify'</FONT></SPAN></DIV>
<DIV><SPAN class=3D802472520-14092003><FONT face=3DArial color=3D#0000ff =

size=3D2>&nbsp;&nbsp; ...</FONT></SPAN></DIV>
<DIV><SPAN class=3D802472520-14092003><FONT face=3DArial color=3D#0000ff =
size=3D2>or=20
whatever.</FONT></SPAN></DIV>
<DIV><SPAN class=3D802472520-14092003><FONT face=3DArial color=3D#0000ff =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D802472520-14092003><FONT face=3DArial color=3D#0000ff =

size=3D2>Paragraphs and ParagraphStyles are thoroughly documented=20
in</FONT></SPAN></DIV>
<DIV><SPAN class=3D802472520-14092003><FONT face=3DArial color=3D#0000ff =

size=3D2>Chapter 6 of our user guide. However, if you are new to Python=20
or</FONT></SPAN></DIV>
<DIV><SPAN class=3D802472520-14092003><FONT face=3DArial color=3D#0000ff =
size=3D2>object=20
oriented programming I can see this might need</FONT></SPAN></DIV>
<DIV><SPAN class=3D802472520-14092003><FONT face=3DArial color=3D#0000ff =
size=3D2>more=20
examples.....</FONT></SPAN></DIV>
<DIV><SPAN class=3D802472520-14092003><FONT face=3DArial color=3D#0000ff =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D802472520-14092003><FONT face=3DArial color=3D#0000ff =
size=3D2>We'll=20
try to get you some pointers on the chart =
tomorrow...</FONT></SPAN></DIV>
<DIV><SPAN class=3D802472520-14092003><FONT face=3DArial color=3D#0000ff =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D802472520-14092003><FONT face=3DArial color=3D#0000ff =
size=3D2>-=20
Andy</FONT></SPAN></DIV>
<DIV><SPAN class=3D802472520-14092003><FONT face=3DArial color=3D#0000ff =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D802472520-14092003><FONT face=3DArial color=3D#0000ff =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<BLOCKQUOTE=20
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px =
solid">
  <DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DTahoma=20
  size=3D2>-----Original Message-----<BR><B>From:</B>=20
  reportlab-users-admin@reportlab.com=20
  [mailto:reportlab-users-admin@reportlab.com]<B>On Behalf Of =
</B>Proboscis=20
  Admin<BR><B>Sent:</B> 12 September 2003 16:23<BR><B>To:</B>=20
  reportlab-users@reportlab.com<BR><B>Subject:</B> [reportlab-users] =
Style sheet=20
  for paragraphs<BR><BR></FONT></DIV><BR>I have the following code were =
it=20
  places my text in the frame but I have no idea how to make it justify =
and=20
  change the font.any advice?code?<BR>I tried making my own style sheet =
but im=20
  getting too many errors.<BR><BR>Thank=20
  you<BR><BR><?fontfamily><?param Geneva>story =3D=20
  []<BR>c.translate(13.5*mm,159*mm)<BR>c.rotate(180)<BR>f =3D =
Frame(-85*mm,=20
  -100*mm, 85*mm,100*mm, showBoundary=3D0)<BR>styles =3D=20
  getSampleStyleSheet()<BR>styleN =3D=20
  styles['Normal']<BR>story.append(Paragraph(escape(blah fjgdlfjg&amp; =
...dgngjn=20
  fbfnbjf fnfjbn mfnbm ,dgnf gm,nmgbnf=20
b),styleN))<?/fontfamily></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_000E_01C37B08.01454EA0--