本文整理汇总了Python中reportlab.platypus.TableStyle类的典型用法代码示例。如果您正苦于以下问题:Python TableStyle类的具体用法?Python TableStyle怎么用?Python TableStyle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TableStyle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: table
def table(data):
"""
return list, so "extend" method should be used.
"""
"""
para_style = STYLES["BodyText"]
para_style.wordWrap = 'CJK'
para_style.backColor = colors.red
table_data = [[Paragraph(cell, para_style) for cell in row] for row in data]
"""
table_data = data
table_style = TableStyle([
('ALIGN',(0,0),(-1,0),'CENTER'),
('ALIGN',(0,1),(0,-1),'LEFT'),
('ALIGN',(1,1),(-1,-1),'RIGHT'),
('VALIGN',(0,0),(-1,-1),'MIDDLE'),
('BOX', (0,0), (-1,0), 2, colors.black),
('LINEBELOW', (0,-1), (-1,-1), 2, colors.black),
('TEXTCOLOR',(1,1),(-2,-2),colors.red),
('BACKGROUND', (0,0), (-1,0), colors.black),
('TEXTCOLOR',(0,0),(-1,0),colors.white),
('TEXTCOLOR',(0,1),(-1,-1),colors.black),
#('VALIGN',(0,0),(0,-1),'TOP'),
#('TEXTCOLOR',(0,0),(0,-1),colors.blue),
])
for i in range(1, len(table_data)):
if i%2 == 0:
table_style.add('BACKGROUND', (0,i), (-1,i),
colors.Color(.835,.91,.976))
t = Table(table_data)
t.setStyle(table_style)
return [t]
开发者ID:graphy21,项目名称:pathogen,代码行数:33,代码来源:reportlabExam.py
示例2: buildTable
def buildTable(data):
doc = SimpleDocTemplate("MOOSE_requirements_tracability.pdf", pagesize=A4, rightMargin=30,leftMargin=30, topMargin=30,bottomMargin=18)
doc.pagesize = landscape(A4)
elements = []
#Configure style and word wrap
s = getSampleStyleSheet()
s = s["BodyText"]
s.wordWrap = 'CJK'
pdf_data = [["Requirement", "Description", "Test Case(s)"]]
#TODO: Need a numerical sort here
keys = sorted(data.keys())
for key in keys:
data[key][2] = '\n'.join(data[key][2])
pdf_data.append([Paragraph(cell, s) for cell in data[key]])
# Build the Table and Style Information
tableThatSplitsOverPages = Table(pdf_data, repeatRows=1)
tableThatSplitsOverPages.hAlign = 'LEFT'
tblStyle = TableStyle([('TEXTCOLOR',(0,0),(-1,-1),colors.black),
('VALIGN',(0,0),(-1,-1),'TOP'),
('LINEBELOW',(0,0),(-1,-1),1,colors.black),
('INNERGRID', (0,0), (-1,-1),1,colors.black),
('BOX',(0,0),(-1,-1),1,colors.black),
('BOX',(0,0),(0,-1),1,colors.black)])
tblStyle.add('BACKGROUND',(0,0),(-1,-1),colors.lightblue)
tblStyle.add('BACKGROUND',(0,1),(-1,-1),colors.white)
tableThatSplitsOverPages.setStyle(tblStyle)
elements.append(tableThatSplitsOverPages)
doc.build(elements)
开发者ID:bggaston,项目名称:moose,代码行数:35,代码来源:tracability_matrix.py
示例3: make_table
def make_table(printable):
style = TableStyle()
style.add('VALIGN', (0,0), (-1,-1), 'TOP')
style.add('GRID', (0,0), (-1,-1), 1, colors.black)
table = Table(printable, [col_width*0.4,col_width*0.6])
table.setStyle(style)
return table
开发者ID:jsharkey,项目名称:chaptools,代码行数:7,代码来源:completeunique.py
示例4: gather_elements
def gather_elements(self, client, node, style):
if node.children and isinstance(node.children[0], docutils.nodes.title):
title=[]
else:
title= [Paragraph(client.text_for_label(node.tagname, style),
style=client.styles['%s-heading'%node.tagname])]
rows=title + client.gather_elements(node, style=style)
st=client.styles[node.tagname]
if 'commands' in dir(st):
t_style = TableStyle(st.commands)
else:
t_style = TableStyle()
t_style.add("ROWBACKGROUNDS", [0, 0], [-1, -1],[st.backColor])
t_style.add("BOX", [ 0, 0 ], [ -1, -1 ], st.borderWidth , st.borderColor)
if client.splittables:
node.elements = [MySpacer(0,st.spaceBefore),
SplitTable([['',rows]],
style=t_style,
colWidths=[0,None],
padding=st.borderPadding),
MySpacer(0,st.spaceAfter)]
else:
padding, p1, p2, p3, p4=tablepadding(padding=st.borderPadding)
t_style.add(*p1)
t_style.add(*p2)
t_style.add(*p3)
t_style.add(*p4)
node.elements = [MySpacer(0,st.spaceBefore),
DelayedTable([['',rows]],
style=t_style,
colWidths=[0,None]),
MySpacer(0,st.spaceAfter)]
return node.elements
开发者ID:Mrt134,项目名称:Experimental,代码行数:34,代码来源:genelements.py
示例5: second_paragraph
def second_paragraph(self):
self.story.append(myParagraph(u"Nom du bénéficiaire : <b>" + self.facture_view.nom_prenom() + u"</b>", 'style1', spaceAfter=10))
self.story.append(myParagraph(u"Montant de la prestation", 'style1'))
self.story.append(myParagraph(u"<b>(" + self.facture_view.jours_prestation_string() + u")</b> Jours....................................<b>%.2f " % (self.facture_view.montant_presta()) + u"</b>€uros", 'style1', spaceAfter=25))
self.story.append(myParagraph(u"Arrêtée et certifiée conforme la présente facture à la somme de :", 'style1', spaceAfter=25))
table_style = TableStyle([('BOX', (0,0), (-1,-1), 0.25, black),
('BOX', (0,0), (-1,-1), 0.25, black),])
table_style.spaceAfter=25
table_data = [[myParagraph(u"<b>" + self.facture_view.montant_presta_word().upper() + u"</b>", 'style1', alignment=TA_CENTER),],]
self.story.append(Table(data=table_data, style=table_style))
开发者ID:cazino,项目名称:Formation,代码行数:11,代码来源:facture.py
示例6: print_entries
def print_entries(self, eh, ehds):
buffer = self.buffer
styles = getSampleStyleSheet()
data = []
ts = TableStyle()
d = []
hs = styles['Heading1']
hs.alignment = TA_CENTER
d.append(Paragraph('<b>Producto</b>', hs))
d.append(Paragraph('<b>Descripción</b>', hs))
d.append(Paragraph('<b>Cantidad</b>', hs))
if eh.printed:
if(eh.action == 'altas'):
title = Paragraph('<b> Entrada de Mercancía - REIMPRESIÓN</b>', hs)
else:
title = Paragraph('<b> Salida de Mercancía - REIMPRESIÓN</b>', hs)
else:
if(eh.action == 'altas'):
title = Paragraph('<b> Entrada de Mercancía </b>', hs)
else:
title = Paragraph('<b> Salida de Mercancía </b>', hs)
data.append(d)
total_qty = 0
sp = styles['BodyText']
sp.alignment = TA_CENTER
sq = styles['BodyText']
sq.alignment = TA_RIGHT
spb = styles['Heading3']
spb.alignment = TA_RIGHT
sl = styles['Normal']
sl.alignment = TA_CENTER
for ehd in ehds:
d = []
d.append(ehd.product.name)
p = Paragraph(ehd.product.description.encode('utf-8'), sp)
d.append(p)
pq = Paragraph(str(ehd.quantity), sq)
d.append(pq)
data.append(d)
total_qty += ehd.quantity
t = Table(data, colWidths = [(letter[0] * .20), (letter[0] * .50), (letter[0] * .20)])
ts.add('LINEBELOW', (0,1), (-1,-1), 0.25, colors.black)
t.setStyle(ts)
elements = []
elements.append(title)
elements.append(t)
elements.append(Paragraph('<br /><p> <b>Cantidad total de artículos:</b> ' + str(total_qty) + '</p>', spb))
if(eh.action == 'altas'):
elements.append(Paragraph('<br /><p> Al firmar este documento acepto que estoy recibiendo la mercancía listada y me responsabilizo por la mercancía. <br /><br /><br/> Nombre:_____________________ Firma: _____________________________</p>',sl))
else:
elements.append(Paragraph('<br /><p> Al firmar este documento acepto la salida de esta mercancía. <br /><br /><br/> Nombre:_____________________ Firma: _____________________________</p>',sl))
doc = SimpleDocTemplate(buffer, pagesize=letter)
doc.build(elements, onFirstPage=self._header_footer, onLaterPages=self._header_footer, canvasmaker = NumberedCanvas)
return buffer
开发者ID:xirdneh,项目名称:oposum,代码行数:54,代码来源:reporter.py
示例7: generate_monthly_summary_table
def generate_monthly_summary_table(huc12):
"""Make a table of monthly summary stats."""
data = []
data.append(['Year', 'Month', 'Precip', "Runoff", "Loss", "Delivery",
'2+" Precip', 'Events'])
data.append(['', '', '[inch]', "[inch]", "[tons/acre]", "[tons/acre]",
"[days]", "[days]"])
pgconn = get_dbconn('idep')
huc12col = "huc_12"
if len(huc12) == 8:
huc12col = "substr(huc_12, 1, 8)"
df = read_sql("""
WITH data as (
SELECT extract(year from valid)::int as year,
extract(month from valid)::int as month, huc_12,
(sum(qc_precip) / 25.4)::numeric as sum_qc_precip,
(sum(avg_runoff) / 25.4)::numeric as sum_avg_runoff,
(sum(avg_loss) * 4.463)::numeric as sum_avg_loss,
(sum(avg_delivery) * 4.463)::numeric as sum_avg_delivery,
sum(case when qc_precip >= 50.8 then 1 else 0 end) as pdays,
sum(case when avg_loss > 0 then 1 else 0 end) as events
from results_by_huc12 WHERE scenario = 0 and
""" + huc12col + """ = %s
and valid >= '2016-01-01'
GROUP by year, month, huc_12)
SELECT year, month,
round(avg(sum_qc_precip), 2),
round(avg(sum_avg_runoff), 2),
round(avg(sum_avg_loss), 2),
round(avg(sum_avg_delivery), 2),
round(avg(pdays)::numeric, 1),
round(avg(events)::numeric, 1)
from data GROUP by year, month ORDER by year, month
""", pgconn, params=(huc12, ), index_col=None)
for _, row in df.iterrows():
vals = [int(row['year']), calendar.month_abbr[int(row['month'])]]
vals.extend(["%.2f" % (f, ) for f in list(row)[2:-2]])
vals.extend(["%.0f" % (f, ) for f in list(row)[-2:]])
data.append(vals)
data[-1][1] = "%s*" % (data[-1][1], )
totals = df.iloc[:-1].mean()
vals = ['', 'Average']
vals.extend(["%.2f" % (f, ) for f in list(totals[2:])])
data.append(vals)
style = TableStyle(
[('LINEBELOW', (2, 1), (-1, 1), 0.5, '#000000'),
('LINEAFTER', (1, 2), (1, -2), 0.5, '#000000'),
('LINEABOVE', (2, -1), (-1, -1), 0.5, '#000000'),
('ALIGN', (0, 0), (-1, -1), 'RIGHT')]
)
for rownum in range(3, len(data)+1, 2):
style.add('LINEBELOW', (0, rownum), (-1, rownum), 0.25, '#EEEEEE')
return Table(data, style=style, repeatRows=2)
开发者ID:akrherz,项目名称:idep,代码行数:54,代码来源:huc12report.py
示例8: frein_type_result
def frein_type_result(self, frein_type, resultat_list):
en_tete = ((StatParagraph("<b><i>" + frein_type + "</i></b>", 'style3'),
StatParagraph("<b><i>" + u"Frein le plus important" + "</i></b>", 'style3'),
StatParagraph("<b><i>" + u"Frein présent" + "</i></b>", 'style3')),)
data = tuple([(StatParagraph(categorie, 'style3'),
StatParagraph(str(nb_plus_imp), 'style3'),
StatParagraph(str(nb_all), 'style3'))
for (categorie, nb_plus_imp, nb_all) in resultat_list])
table_data = en_tete + data
table_style = TableStyle([('GRID', (0,0), (-1,-1), 0.25, black),])
table_style.spaceAfter=25
table_style.spaceBefore=25
self.story.append(Table(data=table_data, style=table_style))
开发者ID:cazino,项目名称:Formation,代码行数:13,代码来源:sortie.py
示例9: get_underline
def get_underline():
data = [[None], [None]]
line = Table(
data,
colWidths=[6.2 * inch],
rowHeights=[0.03 * inch, 0.14 * inch])
table_style = TableStyle()
table_style.add('LINEBELOW', (0, 0), (0, 0), 1, colors.black)
line.setStyle(table_style)
return line
开发者ID:bigbag,项目名称:archive_term-flask,代码行数:13,代码来源:payment_account.py
示例10: getTableStyle
def getTableStyle():
ts = TableStyle([('TEXTCOLOR', (0, 0), (-1, -1), colors.black),
('VALIGN', (0, 0), (-1, -1), 'TOP'),
('LINEBELOW', (0, 0), (-1, -1), 0.8, colors.black),
('BOX', (0, 0), (-1, -1), 0.75, colors.black),
('BOX', (0, 0), (0, -1), 0.75, colors.black),
('BOX', (1, 0), (1, -1), 0.75, colors.black),
('ALIGN', (0, 0), (-1, -1), 'RIGHT'),
('FONTNAME', (0, 0), (-1, -1), 'Arabic'),
('FONTSIZE', (0, 0), (-1, -1), TABLE_FONT_SIZE),
])
ts.add('BACKGROUND', (0, 0), (-1, 1), colors.lightgrey) # header lightgrey
ts.add('BACKGROUND', (0, 1), (-1, -1), colors.white) # rest of table
return ts
开发者ID:chaabni,项目名称:SmartElect,代码行数:14,代码来源:pdf_canvas.py
示例11: _new_style
def _new_style(self, header_line_idx=None, header_line_width=1, header_line_color="black", debug_grid=False):
ts = TableStyle()
if debug_grid:
ts.add("GRID", (0, 0), (-1, -1), 1, colors.red)
if isinstance(header_line_color, str):
try:
header_line_color = getattr(colors, header_line_color)
except AttributeError:
header_line_color = colors.black
if header_line_idx is not None:
ts.add("LINEBELOW", (0, header_line_idx), (-1, header_line_idx), header_line_width, header_line_color)
return ts
开发者ID:jirhiker,项目名称:pychron,代码行数:16,代码来源:base_table_pdf_writer.py
示例12: getTableStyleThreeCol
def getTableStyleThreeCol():
ts = TableStyle([('TEXTCOLOR', (0, 0), (-1, -1), colors.black),
('VALIGN', (0, 0), (-1, -1), 'TOP'),
('LINEBELOW', (0, 0), (-1, -1), 0.8, colors.black),
('BOX', (0, 0), (-1, -1), 0.75, colors.black),
('BOX', (0, 0), (0, -1), 0.75, colors.black),
('BOX', (1, 0), (1, -1), 0.75, colors.black),
('ALIGN', (0, 0), (0, -1), 'CENTER'), # center number column
('ALIGN', (1, 0), (1, -1), 'RIGHT'), # right align name column
('ALIGN', (2, 0), (2, -1), 'CENTER'), # center number column
('FONTNAME', (0, 0), (-1, -1), 'Arabic'),
('FONTSIZE', (0, 0), (-1, -1), TABLE_FONT_SIZE),
])
ts.add('BACKGROUND', (0, 0), (-1, 1), colors.lightgrey) # header lightgrey
ts.add('BACKGROUND', (0, 1), (-1, -1), colors.white) # rest of table
return ts
开发者ID:chaabni,项目名称:SmartElect,代码行数:16,代码来源:pdf_canvas.py
示例13: tableau_intro
def tableau_intro(self):
style_tableau = TableStyle([('BOX', (0,0), (0,-1), 0.25, black),
('BOX', (1,0), (1,-1), 0.25, black),
('BOX', (2,0), (2,-1), 0.25, black),
('BOX', (0,0), (-1,0), 0.25, black),
('VALIGN',(0,0),(-1,-1),'TOP'),
])
style_tableau.spaceAfter = 10
tableau_data = [[MyParagraph(style='style3', text=u"<b>Bénéficiaire</b>"), MyParagraph(style='style3', text=u"<b>Référent</b>"), MyParagraph(style='style3', text=u"<b>Correspondant ALE</b>")],
[MyParagraph(style='style3', text=u"<b>Nom Prénom : <font color=black>"+self.bilanView.nomprenom()+"</font></b>"), MyParagraph(style='style3', text=u"<b>Nom Prénom : <font color=black>"+self.bilanView.CInomprenom()+"</font></b>"), MyParagraph(style='style3', text=u"<b>Nom Prénom : <font color=black>"+self.bilanView.ALEnomprenom()+"</font></b>")],
[MyParagraph(style='style3', text=u"<b>Identifiant n° : <font color=black>"+self.bilanView.idALE()+"</font></b>"), MyParagraph(style='style3', text=u"<b>Organisme : <font color=black>"+self.bilanView.organismeReferent()+"</font></b>"), MyParagraph(style='style3', text=u"<b>ALE : <font color=black>"+self.bilanView.ALEnom()+"</font></b>")],
[MyParagraph(style='style3', text=u"<b>Inscrit à ALE de: <font color=black>"+self.bilanView.incritALE()+"</font></b>"), MyParagraph(style='style3', text=u"<b>Tél : <font color=black>"+self.bilanView.refTel()+"</font></b>"), MyParagraph(style='style3', text=u"<b>Tél : <font color=black>"+self.bilanView.ALEtel()+"</font></b>")],
[MyParagraph(style='style3', text=u"<b>Tél : <font color=black>"+self.bilanView.LCtel()+"</font></b>"), MyParagraph(style='style3', text=u"<b>Mel : <font color=black>"+self.bilanView.refMail()+"</font></b>"), MyParagraph(style='style3', text=u"<b>Mel : <font color=black>"+self.bilanView.ALEmail()+"</font></b>")],
[MyParagraph(style='style3', text=u"<b>Mel : <font color=black>"+self.bilanView.LCmail()+"</font></b>"), None, None],
]
tableau = Table(data=tableau_data, style=style_tableau)
self.story.append(tableau)
开发者ID:cazino,项目名称:Formation,代码行数:17,代码来源:bilanPdf.py
示例14: print_inventory_surplus
def print_inventory_surplus(self, entries, title):
buffer = self.buffer
styles = getSampleStyleSheet()
data = []
ts = TableStyle()
d = []
hs = styles['Heading1']
hs.alignment = TA_CENTER
d.append(Paragraph('<b>Código</b>', styles['Normal']))
d.append(Paragraph('<b>Descripción</b>', styles['Normal']))
d.append(Paragraph('<b>Existencia</b>', styles['Normal']))
d.append(Paragraph('<b>Sistema</b>', styles['Normal']))
d.append(Paragraph('<b>Sobrante</b>', styles['Normal']))
title = Paragraph('<b> ' + title + '</b>', hs)
data.append(d)
total_qty = 0
sp = styles['BodyText']
sp.alignment = TA_CENTER
sq = styles['BodyText']
sq.alignment = TA_RIGHT
spb = styles['Heading3']
spb.alignment = TA_RIGHT
sl = styles['Normal']
sl.alignment = TA_CENTER
for e in entries:
if e['entry'].product is None:
continue
d = []
d.append(e['entry'].product.name)
p = Paragraph(e['entry'].product.description.encode('utf-8'), sp)
d.append(p)
pq = Paragraph(str(e['entry'].quantity), sq)
d.append(pq)
d.append(Paragraph(str(e['tcount']), sq))
d.append(Paragraph(str(e['diff'] * -1), sq))
data.append(d)
t = Table(data, colWidths = [(letter[0] * .15), (letter[0] * .45), (letter[0] * .12), (letter[0] * .12), (letter[0] * .12)])
ts.add('LINEBELOW', (0,1), (-1, -1), 0.25, colors.black)
t.setStyle(ts)
elements = []
elements.append(title)
elements.append(t)
doc = SimpleDocTemplate(buffer, pagesize=letter)
doc.build(elements, onFirstPage=self._header_footer_inventory, onLaterPages=self._header_footer_inventory, canvasmaker = NumberedCanvas)
return buffer
开发者ID:xirdneh,项目名称:oposum,代码行数:45,代码来源:reporter.py
示例15: print_inventory_existence
def print_inventory_existence(self, entries, title):
buffer = self.buffer
styles = getSampleStyleSheet()
data = []
ts = TableStyle()
d = []
hs = styles['Heading1']
hsc = styles['Heading3']
hs.alignment = TA_CENTER
d.append(Paragraph('<b>Código</b>', styles['Normal']))
d.append(Paragraph('<b>Descripción</b>', styles['Normal']))
d.append(Paragraph('<b>Cantidad</b>', styles['Normal']))
title = Paragraph('<b> ' + title + '</b>', styles['Normal'])
data.append(d)
total_qty = 0
sp = styles['BodyText']
sp.alignment = TA_CENTER
sq = styles['BodyText']
sq.alignment = TA_RIGHT
spb = styles['Heading3']
spb.alignment = TA_RIGHT
sl = styles['Normal']
sl.alignment = TA_CENTER
for e in entries:
if e.quantity == 0:
continue
d = []
d.append(e.product.name)
p = Paragraph(e.product.description.encode('utf-8'), sp)
d.append(p)
pq = Paragraph(str(e.quantity), sq)
d.append(pq)
data.append(d)
total_qty += e.quantity
t = Table(data, colWidths = [(letter[0] * .20), (letter[0] * .50), (letter[0] * .20)])
ts.add('LINEBELOW', (0,1), (-1, -1), 0.25, colors.black)
t.setStyle(ts)
elements = []
elements.append(title)
elements.append(t)
elements.append(Paragraph('<br /><p> <b>Cantidad total de artículos:</b> ' + str(total_qty) + '</p>', spb))
doc = SimpleDocTemplate(buffer, pagesize=letter)
doc.build(elements, onFirstPage=self._header_footer_inventory, onLaterPages=self._header_footer_inventory, canvasmaker = NumberedCanvas)
return buffer
开发者ID:xirdneh,项目名称:oposum,代码行数:44,代码来源:reporter.py
示例16: buildTable
def buildTable(data):
style = TableStyle()
style.add('VALIGN', (0,0), (-1,-1), 'TOP')
style.add('GRID', (0,0), (-1,-1), 1, colors.black)
style.add('ALIGN', (1,0), (1,-1), 'RIGHT')
table = Table(data, [width*0.2,width*0.4,width*0.4])
table.setStyle(style)
return table
开发者ID:jsharkey,项目名称:chaptools,代码行数:8,代码来源:oflist.py
示例17: __type_prestation_firstrow
def __type_prestation_firstrow(self):
self.elements.append(Paragraph("<u>Type de prestation</u>", styles.getSampleStyleSheet()['Heading2']))
typePresta_data = [self.__typepresta_checkbox()]
colonnesWidths = (20, 40, 20, 45, 20, 60, 20, 45, 20, 45, 20, 40, 20, 40, 20, 35, 20, 45)
#colonnesWidths = (20, 40, 20, 45, 20, 60, 20, 45, 20, 45, 20, 40, 20, 40)
typePresta_style = TableStyle([self.fontsize_style,
('VALIGN',(1,0),(1,0),'MIDDLE'),
('VALIGN',(3,0),(3,0),'MIDDLE'),
('VALIGN',(5,0),(5,0),'MIDDLE'),
('VALIGN',(7,0),(7,0),'MIDDLE'),
('VALIGN',(9,0),(9,0),'MIDDLE'),
('VALIGN',(11,0),(11,0),'MIDDLE'),
('VALIGN',(13,0),(13,0),'MIDDLE'),
('VALIGN',(13,0),(13,0),'MIDDLE'),
('VALIGN',(15,0),(15,0),'MIDDLE'),
('VALIGN',(17,0),(17,0),'MIDDLE'),
])
typePresta_style.spaceAfter = 10
typePresta_table = Table(data=typePresta_data, colWidths=colonnesWidths, style=typePresta_style)
self.elements.append(typePresta_table)
开发者ID:cazino,项目名称:Formation,代码行数:20,代码来源:base_evenement.py
示例18: _build_spectrum_table_style
def _build_spectrum_table_style(self):
tblstyle = TableStyle([
('SPAN', (0, 0), (-1, 0)),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (-1, -1), 9),
('TEXTCOLOR', (0, 0), (-1, -1), colors.black),
('LINEBELOW', (0, 0), (-1, 0), 1, colors.black),
('LINEBELOW', (0, 1), (-1, 1), 1, colors.black),
# ('ALIGN', (2, 0), (2, 0), 'LEFT'),
('LINEBELOW', (0, 3), (-1, 3), 1.5, colors.black),
# ('LINEBELOW', (0, 0), (-1, -1), 1, colors.red),
# ('LINEBEFORE', (0, 0), (-1, -1), 1, colors.black),
('ALIGN', (2, 0), (-1, -1), 'CENTER')
])
for ir in self.int_plat_age_rowids:
tblstyle.add('SPAN', (1, ir), (3, ir))
tblstyle.add('SPAN', (1, ir + 1), (2, ir + 1))
for si in self.sample_rowids:
tblstyle.add('SPAN', (1, si), (-1, si))
return tblstyle
开发者ID:softtrainee,项目名称:arlab,代码行数:24,代码来源:report.py
示例19: drawTable
def drawTable(self, group=None, monocell=None, reiter = None):
""" Drawing a table """
matrix = []
lst = []
matrix2 = []
vector = []
# Total of element's table
cells = int(self.tablesPropertie['cells'])
columns = int(self.tablesPropertie['columns'])
rows = int(self.tablesPropertie['rows'])
widths = self.tablesPropertie['widths']
heights = self.tablesPropertie['heights']
xpos = self.tablesPropertie['xpos']
ypos = self.tablesPropertie['ypos']
# print "DATI", cells, columns, rows, group, heights, widths
contColumns = 0
ch = ''
col = 0
cycle = False
vector = []
alignment= None
itexts = self.tablesPropertie['itextsobj']
paras = self.tablesPropertie['parasobj']
stile = TableStyle([])
stile.add('VALIGN',(0,0),(-1,-1),'TOP')
tblprop = self.tablesPropertie['cellProperties']
if monocell==True:
cells = 1
columns=1
rows = 1
for v in xrange(0,cells):
if v == 0:
contRows = 0
contColumns = 0
elif columns==1:
contColumns = -1
contRows= int(v/columns)
else:
contRows= int(v/columns)
contColumns = ((v)%columns)
background = self.backgroundFunc(tblprop[v])# Finding background
hexBorderColor = self.hexBorderColorFunc(tblprop[v]['borderColor'])
stile.add('ROWBACKGROUNDS', (contColumns,contRows),
(contColumns,contRows),
(background, background))
cellpr = tblprop[v]
cellpict = cellpr['cellPicture']
cellIMGHeight = cellpr['cellHeight']
cellIMGWidth = cellpr['cellWidth']
if (cellpr['bottomLine'] == 1 and cellpr['topLine'] == 1 and\
cellpr['leftLine'] == 1 and cellpr['rightLine'] == 1):
stile.add('BOX', (contColumns,contRows),
(contColumns,contRows),
cellpr['lineWidth'],
hexBorderColor)
else:
if cellpr['bottomLine'] == 1:
stile.add('LINEBELOW', (contColumns,contRows),
(contColumns,contRows),
cellpr['lineWidth'],
hexBorderColor)
elif cellpr['topLine'] == 1:
stile.add('LINEABOVE', (contColumns,contRows),
(contColumns,contRows),
cellpr['lineWidth'],
hexBorderColor)
if cellpr['leftLine'] == 1:
stile.add('LINEBEFORE', (contColumns,contRows),
(contColumns,contRows),
cellpr['lineWidth'],
hexBorderColor)
if cellpr['rightLine'] == 1:
stile.add('LINEAFTER', (contColumns,contRows),
(contColumns,contRows),
cellpr['lineWidth'],
hexBorderColor)
if not monocell:
ch = self.chFunc(itexts[v])[0]
itext = self.chFunc(itexts[v])[1]
else:
try:
itext = itexts[0]
ch = itexts[0].get('CH')
except:
itext = None
ch = ""
# self.chFunc(itexts[0])[1]
actualPageObject = self.tablesPropertie# Borders
uff = self.tablesPropertie['iterproper']
if uff != [] and v > columns:
pdfAlignment = self.alignmentFunc(self.tablesPropertie['iterproper'][contColumns],v, reiter=True)
else:
pdfAlignment = self.alignmentFunc(paras, v, monocell) #alignment
stile.add('ALIGN', (contColumns,contRows),
(contColumns,contRows),
pdfAlignment)
if itext != None:
fontName = self.fontNameFunc(itext) # Font name
stile.add('FONT', (contColumns,contRows),
#.........这里部分代码省略.........
开发者ID:Alwnikrotikz,项目名称:promogest,代码行数:101,代码来源:Sla2Pdf_ng.py
示例20: evenement_est
def evenement_est(response, lettre_commande):
# Our container for 'Flowable' objects
elements = []
# Main TableFontsize
petitePolice = 10
basePolice = 12
grandePolice = 14
fontsize_style = ("FONTSIZE", (0, 0), (-1, -1), basePolice)
rootPath = "/var/www/vhosts/backupmix.com/httpdocs/greta/administration/pdf/img/"
# Empty checkbox
empty_checkbox = Image(rootPath + "checkbox_empty.jpg", width=18, height=18)
# Checked checkbox
checked_checkbox = Image(rootPath + "checkbox_checked.jpg", width=18, height=18)
checks_box = (empty_checkbox, checked_checkbox)
# A basic document for us to write to 'rl_hello_platypus.pdf'
# doc = SimpleDocTemplate("fiche_evenemment.pdf", rightMargin=10, leftMargin=10, topMargin=0, bottomMargin=5)
doc = SimpleDocTemplate(response, rightMargin=10, leftMargin=10, topMargin=0, bottomMargin=5)
# Image en-tête
evenementEst_Image = Image(rootPath + "evenement_est.jpg", width=573, height=159)
evenementEst_Image.spaceAfter = 30
elements.append(evenementEst_Image)
# Create two 'Paragraph' Flowables and add them to our 'elements'
# elements.append(Paragraph("The Platypus", styles['Heading1']))
elements.append(Paragraph("<u>Type de prestation</u>", styles.getSampleStyleSheet()["Heading2"]))
# Tableau type de prestations
typePresta_data = [
[
empty_checkbox,
"BCA",
checked_checkbox,
"CIBLE",
empty_checkbox,
"OP CREA",
empty_checkbox,
"ECCP",
empty_checkbox,
"MOB",
empty_checkbox,
"STR",
empty_checkbox,
"EPCE",
]
]
colonnesWidths = (20, 55, 20, 65, 20, 80, 20, 55, 20, 55, 20, 50, 20, 50)
typePresta_style = TableStyle(
[
fontsize_style,
("VALIGN", (1, 0), (1, 0), "MIDDLE"),
("VALIGN", (3, 0), (3, 0), "MIDDLE"),
("VALIGN", (5, 0), (5, 0), "MIDDLE"),
("VALIGN", (7, 0), (7, 0), "MIDDLE"),
("VALIGN", (9, 0), (9, 0), "MIDDLE"),
("VALIGN", (11, 0), (11, 0), "MIDDLE"),
("VALIGN", (13, 0), (13, 0), "MIDDLE"),
]
)
typePresta_style.spaceAfter = 10
typePresta_table = Table(data=typePresta_data, colWidths=colonnesWidths, style=typePresta_style)
elements.append(typePresta_table)
location_style = styles.getSampleStyleSheet()["Normal"]
location_style.spaceAfter = 10
location_style.alignment = enums.TA_LEFT
elements.append(
Paragraph(
u"<font size='12'><b>Nom du prestataire: </b>%s</font>" % (lettre_commande.site.prestataire.nom,),
location_style,
)
)
elements.append(
Paragraph(
u"<font size='12'><b>Lieu de réalisation: </b>%s</font>" % (lettre_commande.site.nom,), location_style
)
)
elements.append(Paragraph(u"<font size='12'><b>Agence d'inscription: </b>%s</font>", location_style))
tableData = [
[
u"Nom-Prénom du DE:",
lettre_commande.nom + " " + lettre_commande.prenom,
"",
"",
u"N° Identifiant:",
lettre_commande.polemploi_id,
],
[
"Date du premier RDV:",
lettre_commande.ouverture_rdv.dateheure.date().strftime("%d/%m/%Y"),
"",
"",
#.........这里部分代码省略.........
开发者ID:cazino,项目名称:Formation,代码行数:101,代码来源:evenement.py
注:本文中的reportlab.platypus.TableStyle类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论