1

Hi i want create invoice like this image i want create invoice like this

i use Reportlap and for my header i use SPAN but my output is it : my output is this my code is :

from reportlab.lib import colors
from reportlab.lib.pagesizes import letter, inch,A5
from reportlab.platypus import Image, Paragraph, SimpleDocTemplate, Table
from reportlab.lib.styles import getSampleStyleSheet

doc = SimpleDocTemplate("complex_cell_values.pdf", pagesize=A5)
elements = []
styleSheet = getSampleStyleSheet()

I = Image('replogo.gif')
I.drawHeight = 1.6*inch
I.drawWidth = 5*inch
data= [['','',I,'',''],
   ['Total Price', 'Price', 'QTY','Description', 'S.No'],
   ['00', 'rial 360,000', '02', '05', '04'],
   ['10', '11', '12', '06', '14'],
   ['20', '21', '22', '23', '24'],
   ['30', '31', '32', '33', '34']]
t=Table(data,style=[('BOX',(0,0),(-1,-1),2,colors.black),
                ('GRID',(0,1),(-1,-1),0.5,colors.black),
                ('SPAN',(0,0),(1,0)),
                ('SPAN',(3,0),(4,0)),
                ('ALIGN',(1,0),(4,-1),'CENTER')
                ])
t._argW[3]=1.5*inch
elements.append(t) 
doc.build(elements)

anybody have ab idea how can i fix this ?

RezaOptic
  • 310
  • 1
  • 4
  • 16
  • I couldn't find the doc for the SPAN parameter, but this is what I'd try to fiddle with. According to [this](http://two.pairlist.net/pipermail/reportlab-users/2004-September/003397.html), I'd try `('SPAN',(0,0),(4,0))`. Just a guess, hence the comment instead of answer. – Jérôme Mar 11 '16 at 08:41
  • if i use ('SPAN',(0,0),(4,0)) cant insert any Text or image. – RezaOptic Mar 11 '16 at 08:45
  • OK, this was just a guess. I couldn't find any doc. Assuming the SPAN parameter is the issue, you could try different values and see what happens, find other examples on the net or peak into the [code](https://bitbucket.org/rptlab/reportlab/src/89ea1d46b4a0af9fd10bd4c684d55b1f4d478730/src/reportlab/platypus/tables.py?at=default&fileviewer=file-view-default) to see how it is used. – Jérôme Mar 11 '16 at 09:12

1 Answers1

0

i find answer if i use t._argW[X] x=Column for all Column i can have this output.enter image description here

i add this code:

t._argW[4]=0.4*inch
t._argW[3]=2*inch
t._argW[2]=0.6*inch
t._argW[1]=1*inch
t._argW[0]=1.3*inch
RezaOptic
  • 310
  • 1
  • 4
  • 16