[go: up one dir, main page]

Menu

[599fc9]: / sqlutil / pdflettera.py  Maximize  Restore  History

Download this file

50 lines (41 with data), 1.5 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from reportlab.platypus import Paragraph
from reportlab.lib.styles import ParagraphStyle
from reportlab.lib.units import mm
import dtutil
import datetime
st = ParagraphStyle( 'lettera' )
st.fontSize = 12
class lt_indir (Paragraph):
def __init__( self, txt ):
ntxt = '<para leftIndent=90mm >%s</para>' % txt
Paragraph.__init__( self, ntxt, st, None )
class lt_data (Paragraph):
def __init__( self, dt=None, luogo='Modena' ):
if dt == None: dt = datetime.date.today()
sdt = dtutil.timedelta_serializer( dt )
txt = luogo + ', ' + sdt
ntxt = '<para leftIndent=90mm spaceBefore=1cm spaceAfter=1cm>'
ntxt += txt + '</para>'
Paragraph.__init__( self, ntxt, st, None )
class lt_oggetto (Paragraph):
def __init__( self, txt ):
ntxt = '<para spaceBefore=1cm spaceAfter=1cm>Oggetto: '
ntxt += txt + ' </para>'
Paragraph.__init__( self, ntxt, st, None )
class lt_firma (Paragraph):
def __init__( self, txt ):
ntxt = '<para leftIndent=90mm spaceBefore=1cm>%s</para>' % txt
Paragraph.__init__( self, ntxt, st, None )
class lt_body (Paragraph):
def __init__( self, txt ):
ntxt = '<para firstLineIndent=10mm spaceBefore=1cm spaceAfter=1cm>'
ntxt += txt + '</para>'
Paragraph.__init__( self, ntxt, st, None )
def lettera( ):
lf = []
lf.append( lt_indir( ) )
lf.append( lt_data( ) )
lf.append( lt_oggetto( ) )
lf.append( lt_body( ) )
lf.append( lt_firma( ) )
return lf