本文整理汇总了Python中reportlab.platypus.Table.leftPadding方法的典型用法代码示例。如果您正苦于以下问题:Python Table.leftPadding方法的具体用法?Python Table.leftPadding怎么用?Python Table.leftPadding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reportlab.platypus.Table
的用法示例。
在下文中一共展示了Table.leftPadding方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: toPDF
# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import leftPadding [as 别名]
def toPDF(self):
pdfSet = PDFSettings()
pdfSet.pdfDir=self.pdfDir
pdfSet.addStyles()
cW = pdfSet.cW
pdfSet.GCN = self.GCN
pdfSet.TCN = self.TCN
pdfSet.verNum = self.verNum
pdfSet.subDate = self.subDate
pdfSet.subTime = self.subTime
pdfSet.inFileName = self.inFileName
pdfSet.testProd = self.testProd
#fileNameBase = pdfSet.pdfDir + os.sep + '277-' + self.TCN
fileNameBase = pdfSet.pdfDir + os.sep + '277-' + self.subDateTime
fileName = fileNameBase + '.pdf'
doc = SimpleDocTemplate(fileName, pagesize=letter,
leftMargin=pdfSet.marginSize, rightMargin=pdfSet.marginSize,
topMargin=pdfSet.marginSize + pdfSet.lineHeight*2,
bottomMargin=pdfSet.marginSize + pdfSet.lineHeight*2)
doc.leftPadding = 0
Story = []
stylesheet=getSampleStyleSheet()
style1 = stylesheet['Normal']
style1.fontName = pdfSet.regFont
style1.fontSize = pdfSet.fontSize
style1.borderPadding = 0
#codeStyle.leading = 8
style2 = copy.copy(style1)
style2.firstLineIndent = -15
style2.leftIndent = 20
style3 = copy.copy(style1)
style3.fontName = pdfSet.boldFont
tmpPara = "Payor: %s [%s] - Received %s, processed %s" % (self.payor.Name, self.payor.ID, self.date837Rec, self.date837Rec)
Story.append(Paragraph(tmpPara, style1))
Story.append(Spacer(1,pdfSet.lineHeight*.5))
tmpPara = "Submitter: %s [%s] %s - %s" % (self.submitter.Name, self.submitter.ID, self.submitter.amount, self.submitter.action)
Story.append(Paragraph(tmpPara, style1))
if len(self.submitter.amtString) > 1:
Story.append(Paragraph(self.submitter.amtString, style1))
tmpPara = self.submitter.qtyString + ' - Status code: ' + self.submitter.statusCode
Story.append(Paragraph(tmpPara, style1))
Story.append(Spacer(1,pdfSet.lineHeight*.5))
for billProv in self.bP:
#bpSection = []
tmpPara = "Billing Provider: %s [%s] %s - %s" % (billProv.Name, billProv.ID, billProv.amount, billProv.action)
Story.append(Paragraph(tmpPara, style1))
if len(billProv.amtString) > 1:
Story.append(Paragraph(billProv.amtString, style1))
tmpPara = billProv.qtyString + ' - Status code: ' + billProv.statusCode
Story.append(Paragraph(tmpPara, style1))
#bpSec.append(Spacer(1,pdfSet.lineHeight*.5))
if len(billProv.claim) > 0:
statWidths = [26*cW, 18*cW, 9*cW, 8*cW, 8*cW, 5*cW, 3*cW, 9*cW, 18*cW, 9*cW]
statStyle = TableStyle([('VALIGN', (0,0), (-1,-1), 'TOP'),
('ALIGN', (0,0), (-1,-1), 'LEFT'),
('FONT', (0,0), (-1,-1), pdfSet.regFont, pdfSet.fontSize),
('BOTTOMPADDING',(0,0),(-1,-1),pdfSet.pad),
('TOPPADDING', (0,0),(-1,-1),pdfSet.pad),
('RIGHTPADDING', (0,0),(-1,-1),pdfSet.pad),
('LEFTPADDING', (0,0),(-1,-1),pdfSet.pad),
('LINEBELOW', (0,1), (-1,1), 1, (0,0,0,1))])
statStyle.add('ALIGN', (4,0), (4,-1), 'DECIMAL')
errStyle = copy.copy(statStyle)
errStyle.add('FONT', (0,0), (-1,-1), pdfSet.regFont, pdfSet.fontSize)
statLines = [(None, None, None, None, None, None, None, None, 'Status codes', None),
("Patient", "Claim Number", None, None, None, None, None, "Action", 'Cat. Code Source', None)]
for clm in billProv.claim:
for clmLine in clm.line:
if clmLine.action == 'Accept':
statLines.append([clmLine.Name, clmLine.ID, clmLine.date1, clmLine.date2, clmLine.amount, None, None, clmLine.action, clmLine.statusCode, None])
else:
statLines.append([clmLine.Name, clmLine.ID, clmLine.date1, clmLine.date2, clmLine.amount, None, '**', clmLine.action, clmLine.statusCode, '**'])
tbl = Table(statLines, colWidths=statWidths, rowHeights=None, style=statStyle)
tbl.hAlign = 'LEFT'
tbl.leftPadding = 0
Story.append(tbl)
Story.append(Spacer(1,pdfSet.lineHeight*2))
#Story.append(KeepTogether(bpSection))
glossary = []
glossary.append(Paragraph("GLOSSARY: Code categories, status codes, and entities", style3))
for gloss in (self.catGlossary, self.codeGlossary, self.srcGlossary):
if len(gloss) > 0:
for code, message in gloss.iteritems():
tmpPara = "%s: %s " % (code, message)
glossary.append(Paragraph(tmpPara, style2))
Story.append(KeepTogether(glossary))
attempt = 1
while attempt > 0: #avoid blowing up due to duplicate filename
try:
open(fileName, 'wb')
doc.build(Story, onFirstPage=pdfSet.firstPage, onLaterPages=pdfSet.laterPages)
attempt = 0
except IOError:
#.........这里部分代码省略.........