本文整理汇总了Python中reportlab.platypus.Table._argW[5]方法的典型用法代码示例。如果您正苦于以下问题:Python Table._argW[5]方法的具体用法?Python Table._argW[5]怎么用?Python Table._argW[5]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reportlab.platypus.Table
的用法示例。
在下文中一共展示了Table._argW[5]方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GenerarListaAsistencia
# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[5] [as 别名]
def GenerarListaAsistencia (self,estudiantes,Curso, paralelo):
namefile = "ListaAsistencia_%s%s.pdf"%(Curso,paralelo)
doc = SimpleDocTemplate(namefile, pagesize=letter)
elements = []
styleSheet = getSampleStyleSheet()
titulo = Paragraph('''<b>Escuela Particular Dr. Jaime Aspiazu Seminario </b>''',styleSheet["BodyText"])
stringCurso = u"<b>Curso: %s año básico, Paralelo: %s</b>"%(Curso,paralelo)
subtitulo = Paragraph(stringCurso,styleSheet["BodyText"])
fecha = time.strftime("%d/%m/%y")
stringfecha = "Fecha: %s"%fecha
datosHeader = [[titulo],[subtitulo],[stringfecha],[]]
tablaHeader = Table(datosHeader)
tablaHeader.setStyle(TableStyle([ ('ALIGN',(0,0),(-1,-1),'CENTER'),
('VALIGN',(0,0),(-1,-1),'MIDDLE'),
('TEXTCOLOR',(0,0),(-1,-1),colors.black),
]))
#este es la etiqueta de la columna de enumeracion
N = Paragraph('''<b>N</b><super><font color=black>o</font></super>''', styleSheet["BodyText"])
datosEstudiante = [[N,u"Nómina Estudiantes", "1","2","3","4","5"]]
cont =1
for e in estudiantes:
aux = []
aux.append(str(cont))
aux.append(e)
aux.append(" ")
aux.append(" ")
aux.append(" ")
aux.append(" ")
aux.append(" ")
datosEstudiante.append(aux)
cont= cont + 1
tablaEstudiante = Table(datosEstudiante)
nFila = len(datosEstudiante)
tablaEstudiante.setStyle(TableStyle([ ('ALIGN',(0,0),(-1,-1),'LEFT'),
('VALIGN',(0,0),(-1,-1),'MIDDLE'),
('TEXTCOLOR',(0,0),(-1,-1),colors.black),
('INNERGRID', (0,0), (-1,-1), 0.25, colors.black),
('BOX', (0,0), (-1,-1), 0.25, colors.black),
('BACKGROUND',(0,0),(0,nFila),colors.beige),
('BACKGROUND',(0,0),(6,0),colors.beige)
]))
tablaEstudiante._argW[0]=0.5*inch
tablaEstudiante._argW[1]=3*inch
tablaEstudiante._argW[2]=0.5*inch
tablaEstudiante._argW[3]=0.5*inch
tablaEstudiante._argW[4]=0.5*inch
tablaEstudiante._argW[5]=0.5*inch
tablaEstudiante._argW[6]=0.5*inch
elements.append(tablaHeader)
elements.append(tablaEstudiante)
doc.build(elements)
示例2: genInvoice
# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[5] [as 别名]
#.........这里部分代码省略.........
c.setFont("Times-Roman" , 12)
c.drawString(5*cm, 27.35*cm , "Contact us : 1800 1234 5678 | [email protected]")
styles=getSampleStyleSheet()
sead = se.address # service provide address
serAddress = '<p><font size=14>%s.</font><font size=10> 34, %s , %s, %s, Pin : %s</font></p>' %(se.name , sead.street , sead.city , sead.state , sead.pincode)
p = Paragraph( serAddress , styles['Normal'])
p.wrapOn(c, 15*cm, 1*cm)
p.drawOn(c, 5*cm, 26.3*cm)
c.setDash(6,3)
c.rect(14.4*cm, 27.2*cm, 5.5*cm, 0.6*cm )
c.drawString(14.5*cm, 27.35*cm , "Invoice # DEL-%s" %(o.pk))
pSrc = '''
<font size=10>
<strong>Order ID: OD%s</strong><br/><br/>
<strong>Order Date : </strong> %s <br/>
<strong>Invoice Date : </strong> %s <br/>
<strong>VAT/TIN : </strong> %s <br/>
<strong>CST# : </strong> %s <br/>
</font>
''' % (o.pk , o.created.date() , o.created.date() , se.tin , se.tin)
p = Paragraph( pSrc , styles['Normal'])
p.wrapOn(c, 6*cm, 5*cm)
p.drawOn(c, 1*cm, 22.4*cm)
custAdd = o.address # customer address
cust = o.user
pSrc = '''
<font size=10>
<strong>Billing Address</strong><br/><br/>
%s %s<br/>
%s,<br/>
%s Pin : %s,<br/>
%s<br/>
Phone : %s <br/>
</font>
''' % (cust.first_name , cust.last_name , custAdd.street ,custAdd.city , custAdd.pincode , custAdd.state , o.mobile )
p = Paragraph( pSrc , styles['Normal'])
p.wrapOn(c, 6*cm, 5*cm)
p.drawOn(c, 7.5*cm, 22*cm)
pSrc = '''
<font size=10>
<strong>Shipping Address</strong><br/><br/>
%s %s<br/>
%s,<br/>
%s Pin : %s,<br/>
%s<br/>
Phone : %s <br/>
</font>
''' % (cust.first_name , cust.last_name , custAdd.street ,custAdd.city , custAdd.pincode , custAdd.state , o.mobile )
p = Paragraph( pSrc , styles['Normal'])
p.wrapOn(c, 6*cm, 5*cm)
p.drawOn(c, 14*cm, 22*cm)
c.setDash()
pHeadProd = Paragraph('<strong>Product</strong>' , styles['Normal'])
pHeadDetails = Paragraph('<strong>Details</strong>' , styles['Normal'])
pHeadQty = Paragraph('<strong>Qty</strong>' , styles['Normal'])
pHeadPrice = Paragraph('<strong>Price</strong>' , styles['Normal'])
pHeadTax = Paragraph('<strong>Tax</strong>' , styles['Normal'])
pHeadTotal = Paragraph('<strong>Total</strong>' , styles['Normal'])
bookingTotal , bookingHrs = getBookingAmount(o)
pSrc = ''''<strong>%s</strong><br/>(5.00%sCST) <br/><strong>Start : </strong> %s <br/>
<strong>End : </strong> %s <br/><strong>Booking Hours : </strong> %s Hours <br/>
''' %(it.description[0:40] , '%' , o.start.strftime('%Y-%m-%d , %H:%M %p'), o.end.strftime('%Y-%m-%d , %H:%M %p'), bookingHrs)
pBodyProd = Paragraph('%s <strong>VB%s</strong>' %(it.title , it.pk) , styles['Normal'])
pBodyTitle = Paragraph( pSrc , styles['Normal'])
pBodyQty = Paragraph('%s' % (o.quantity) , styles['Normal'])
pBodyPrice = Paragraph('<strong> %s </strong>/ Hr' % (ofr.rate) , styles['Normal'])
tax = 0.05*bookingTotal
pBodyTax = Paragraph('%s' % (tax) , styles['Normal'])
pBodyTotal = Paragraph('%s' %(bookingTotal) , styles['Normal'])
pFooterQty = Paragraph('%s' % (o.quantity) , styles['Normal'])
pFooterTax = Paragraph('%s' %(tax) , styles['Normal'])
pFooterTotal = Paragraph('%s' % (bookingTotal) , styles['Normal'])
pFooterGrandTotal = Paragraph('%s' % (bookingTotal) , styles['Normal'])
data = [[ pHeadProd, pHeadDetails, pHeadPrice , pHeadQty, pHeadTax , pHeadTotal],
[pBodyProd, pBodyTitle, pBodyPrice, pBodyQty, pBodyTax , pBodyTotal],
['', '', '', pFooterQty, pFooterTax , pFooterTotal],
['', '', '', 'Grand Total', '' , pFooterGrandTotal]]
t=Table(data)
ts = TableStyle([('ALIGN',(1,1),(-2,-2),'RIGHT'),
('SPAN',(-3,-1),(-2,-1)),
('LINEABOVE',(0,0),(-1,0),0.25,colors.gray),
('LINEABOVE',(0,1),(-1,1),0.25,colors.gray),
('LINEABOVE',(-3,-2),(-1,-2),0.25,colors.gray),
('LINEABOVE',(0,-1),(-1,-1),0.25,colors.gray),
('LINEBELOW',(0,-1),(-1,-1),0.25,colors.gray),
])
t.setStyle(ts)
t._argW[0] = 3*cm
t._argW[1] = 8*cm
t._argW[2] = 2*cm
t._argW[3] = 2*cm
t._argW[4] = 2*cm
t._argW[5] = 2*cm
t.wrapOn(c, 19*cm, 6*cm)
t.drawOn(c, 1*cm, 18*cm)
示例3: Table
# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[5] [as 别名]
#Style the table
t = Table(data,style=[
('GRID', (0, 0), (-1, -1), 1, colors.black),
('FONTSIZE',(0, 0), (-1, -1), 7),
#('ALIGN', (0,0), (-1,1), 'LEFT'),
#('BACKGROUND',(0,2),(-1,-1),colors.green)
#('LINEABOVE',(0,1),(-1,1),1,colors.rgb2cmyk(1,1,1)),
#('SPAN',(0,1),(-1,1)),
])
# Fixed column widths
t._argW[0] = 50.8*mm #Perf Mgmt
t._argW[1] = 12.7*mm #Total N
t._argW[2] = 63.5*mm # % Resp
t._argW[3] = 12.7*mm # % Fav
t._argW[4] = 38.1*mm # % Dist
t._argW[5] = 10.922*mm # Mean
c = canvas.Canvas(buffer, pagesize=letter)
t.wrapOn(c, width, height)
t.drawOn(c, *coord(5, 60, mm))
#drawGrid(c)
c.save()
#Write the buffer to disk and close the file
pdf = buffer.getvalue()
file.write(pdf)
buffer.close()
file.close()
示例4: ImprimirVentasCreditos
# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[5] [as 别名]
def ImprimirVentasCreditos(request, fechaI, fechaF):
response = HttpResponse(content_type='application/pdf')
finicio = datetime.fromtimestamp(int(fechaI) / 1e3)
ffin = datetime.fromtimestamp(int(fechaF) / 1e3)
pdf_name = "ventasacredito.pdf"
buff = BytesIO()
doc = SimpleDocTemplate(buff,
pagesize=letter,
rightMargin=50,
leftMargin=50,
topMargin=20,
bottomMargin=18,
)
doc.pagesize = landscape(A4)
ventas = []
totales = Venta.objects.filter(fecha__gte = finicio, fecha__lte = ffin, credito = True , estado = 'ACTIVO').aggregate(precio_total=Sum(F('total')))
ventas.append(Spacer(1, 0.05 * inch))
header = Paragraph("GRUPOEJ - SRL." , getStyleSheet()['Title'])
subtitel = Paragraph("Ventas al credito." , getStyleSheet()['Subtitle'])
ventas.append(header)
ventas.append(Spacer(1, 0.05 * inch))
ventas.append(subtitel)
ventas.append(Spacer(1, 0.05 * inch))
ventas.append(Paragraph("<para>Fecha Inicio: "+finicio.strftime('%d/%m/%Y')+" "+" Fecha Fin:"+ffin.strftime('%d/%m/%Y')+"</para>", getStyleSheet()['TopicTitle8']))
ventas.append(Spacer(1, 0.05 * inch))
ventas.append(Paragraph("DETALLE", getStyleSheet()['TopicTitle10']))
ventas.append(Spacer(1, 0.1 * inch))
styles = getSampleStyleSheet()
headings = ('DNI/RUC', 'CLIENTE', "RESPONSABLE", 'NRO_VENTA','FECHA' ,'TOTAL')
venta = [(str(v.pedido.cliente.nro_documento), str(v.pedido.cliente.nombres)+"/"+str(v.pedido.cliente.apellidos), str(v.pedido.cliente.responsable), str(v.numero_correlativo)+"-"+str(v.numero_documento), str(v.fecha), str(v.total)) for v in Venta.objects.filter(fecha__gte = finicio, fecha__lte = ffin, credito = True , estado = 'ACTIVO')]
data = ([headings] + venta)
data2 = [[Paragraph(cell, getStyleSheet()['TopicItemq0']) for cell in row] for row in data]
t=Table(data2)
style = TableStyle(
[
('BACKGROUND', (0, 0), (-1, 0), colors.gray),
('LINEABOVE', (0,0), (-1,0), 2, colors.green),
('LINEABOVE', (0,1), (-1,-1), 0.25, colors.black),
('LINEBELOW', (0,-1), (-1,-1), 2, colors.green),
('ALIGN', (1,1), (-1,-1), 'CENTER'),
]
)
t.setStyle(style)
t._argW[0]=0.8*inch
t._argW[1]=2.8*inch
t._argW[2]=2.8*inch
t._argW[3]=0.9*inch
t._argW[4]=0.9*inch
t._argW[5]=0.9*inch
ventas.append(t)
ventas.append(Paragraph("Total: S/ "+str(totales['precio_total']), getStyleSheet()['TopicTitle8Right']))
# ventas.append(Paragraph("IGV:___"+str(venta.igv)+" S/", getStyleSheet()['TopicTitle8Right']))
# ventas.append(Paragraph("Total:__ "+str(venta.total)+" S/", getStyleSheet()['TopicTitle8Right']))
doc.build(ventas)
response.write(buff.getvalue())
buff.close()
return response
示例5: GeraLista2
# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[5] [as 别名]
def GeraLista2(fileName, listaProdutos, opcoes):
"""
"""
# opcoes[0] == "Tick"
# opcoes[1] == "CodProd"
# opcoes[2] ==
# opcoes[3]
# opcoes[4]
# opcoes[5]
# opcoes[6]
print len(opcoes)
for aux in opcoes:
if aux.get() == "Tick":
print "Achei o Tick"
doc = SimpleDocTemplate(fileName,
pagesize=landscape(A4),
rightMargin=1*cm,
leftMargin=1*cm,
topMargin=0.3*cm,
bottomMargin=0.3*cm)
# container for the 'Flowable' objects
elements = []
dados = []
styleSheet = getSampleStyleSheet()
#######
ok = Image('ok.gif')
ok.drawHeight = 0.3*cm
ok.drawWidth = 0.3*cm
a = 0
for i in listaProdutos.produtos:
descr = Paragraph('''<b><font size=7>''' + str(i.descricao) + '''</font></b>''', styleSheet["BodyText"])
cod = Paragraph('''<b><font size=7>''' + str(i.cod_produto) + '''</font></b>''', styleSheet["BodyText"])
barras = Paragraph('''<b><font size=7>''' + str(i.cod_barras) + '''</font></b>''', styleSheet["BodyText"])
if a%2 == 0:
#dados.append([ok, descr, cod, barras])
dados.append([ok])
dados[-1].append(descr)
dados[-1].append(cod)
dados[-1].append(barras)
else:
dados[-1].append(ok)
dados[-1].append(descr)
dados[-1].append(cod)
dados[-1].append(barras)
a = a + 1
#tabela=Table(dados, 13*cm, 3.1*cm)
tabela=Table(dados)
estilo = []
for i in range(len(dados)):
estilo.append(('BOX', (0,i), (3, i), 1, colors.black))
estilo.append(('BOX', (4,i), (7, i), 1, colors.black))
tabela.setStyle(TableStyle(
estilo
))
tabela._argW[1]=9*cm
tabela._argW[5]=9*cm
#tabela = Table(dados, style=[
# ('GRID', (0,0), (-1, -1), 2, colors.black)
# ])
elements.append(tabela)
#####
# write the document to disk
doc.build(elements)
示例6: ImprimirReporteEnvacePorProducto
# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[5] [as 别名]
def ImprimirReporteEnvacePorProducto(request, idcliente,idproducto):
response = HttpResponse(content_type='application/pdf')
pdf_name = "reporte_producto.pdf"
buff = BytesIO()
doc = SimpleDocTemplate(buff,
pagesize=letter,
rightMargin=50,
leftMargin=50,
topMargin=20,
bottomMargin=18,
)
# doc.pagesize = landscape(A4)
doc.pagesize = portrait(A4)
productos = []
cliente = Cliente.objects.get(id = idcliente)
# prod = Prestamo.objects.filter(id = idproducto)
# produc = Producto.objects.filter(id = prod[0].producto.id)
totales = Prestamo.objects.filter(cliente__id = idcliente, producto__id= idproducto).aggregate(
total_entregado=Sum(F('entregado'),output_field=FloatField()),
total_devuelto=Sum(F('devuelto'),output_field=FloatField())
)
# aggregate(total = Sum(F('cantidad')*F('precio'), output_field=FloatField())
# extra(select = {'total_entregado': 'SUM(entregado)','total_devuelto': 'SUM(devuelto)'})
styles = getSampleStyleSheet()
header = Paragraph("GRUPOEJ - SRL." , getStyleSheet()['Title'])
cli = Paragraph(str(cliente.nombres)+" "+str(cliente.apellidos)+" / "+str(cliente.area)+ " / "+ str(cliente.responsable), getStyleSheet()['TopicTitle8'])
productos.append(header)
productos.append(Spacer(1, 0.2 * inch))
productos.append(Paragraph("REPORTE TOTAL." , getStyleSheet()['TopicTitle14']))
productos.append(Spacer(1, 0.05 * inch))
productos.append(cli)
productos.append(Paragraph("DETALLE", getStyleSheet()['TopicTitle10']))
productos.append(Spacer(1, 0.1 * inch))
headings = ("PRODUCTO","FECHA","NRO DOCUMENTO","ENTREGADA ", 'DEVUELTA', 'DEBE')
detalleventa = [
(str(dv.producto.descripcion),str(dv.fecha),str(dv.nro_documento) ,str(dv.entregado), str(dv.devuelto), str(dv.entregado - dv.devuelto))
for dv in Prestamo.objects.filter(cliente__id = idcliente, producto__id= idproducto)]
data = ([headings] + detalleventa)
data2 = [[Paragraph(cell, getStyleSheet()['TopicItemq0']) for cell in row] for row in data]
t=Table(data2)
style = TableStyle(
[
('BACKGROUND', (0, 0), (-1, 0), colors.gray),
('LINEABOVE', (0,0), (-1,0), 2, colors.green),
('LINEABOVE', (0,1), (-1,-1), 0.25, colors.black),
('LINEBELOW', (0,-1), (-1,-1), 2, colors.green),
('ALIGN', (1,1), (-1,-1), 'CENTER'),
]
)
t.setStyle(style)
t._argW[0]=2.5*inch
t._argW[1]=1.0*inch
t._argW[2]=1.2*inch
t._argW[3]=0.9*inch
t._argW[4]=0.8*inch
t._argW[5]=0.7*inch
productos.append(t)
productos.append(
Paragraph("Total Entregado "
+str(int(totales['total_entregado']))
+" "
+"Total Devuelto "
+str(int(totales['total_devuelto']))
+" "
+"TOTAL DEBE: "
+str(int(totales['total_entregado']) - int(totales['total_devuelto'])), getStyleSheet()['TopicTitle8Right']))
doc.build(productos)
response.write(buff.getvalue())
buff.close()
return response