Табличный отчет — произвольный заголовок с переменной размерностью

def approve():
	numCols=grid.numCols
	colWidth=grid.colWidth
	report=u"""<!DOCTYPE zzReport>
			<zzReport format="font-family:Arial;font-size:10pt;text-align:left;border-width:0 0 0 0;vertical-align:top;margin:0.1 0.1 0.1 0.1;" prog="" psetup="" name="firstReport">
			   <Page pageLeftMargin="2" pageRightMargin="1" pageWidth="21" pageTopMargin="1" pageHeight="29.7" pageBottomMargin="1"/>
			   <params/>
			   <Grid calcAfter="" 
						colWidth="%(colWidth)s" 
						format="" 
						rowHeight="{0: '0.0-0.0', 1: '0.0-0.0', 2: '0.0-0.0', 3: '0.0-0.0', 4: '0.0-0.0'}" 
						role="" 
						printWhen="" 
						npp="0" 
						printOnNewPage="False" 
						numRows="5" 
						numCols="%(numCols)s" 
						ejectPageAfter="False">
				  <Cells>
					 <cell picture="" row="1" format="text-align:right;font-weight:bold;margin: 0.10  5.10  0.10  0.10;" dataLabel="Утверждаю" col="1" name=""/>
					 <cell picture="" row="1" format="" dataLabel="" col="2" name=""/>
					 <cell picture="" row="2" format="text-align:right;" dataLabel="Гл. инженер ф-ла ___________" col="1" name=""/>
					 <cell picture="" row="3" format="text-align:right;" dataLabel="[dateprop(DATE)]" col="1" name=""/>
					 <cell picture="" row="4" format="text-align:center;font-size:12pt;font-weight:bold;" dataLabel="Заявка" col="1" name=""/>
					 <cell picture="" row="5" format="text-align:center;" dataLabel="на материалы на [zzCMonth(DATE)] месяц [zzYear(DATE)] г." col="1" name=""/>
				  </Cells>
				  <Spans>
					 <span value="[1, 1, 1,%(numCols)s ]"/>
					 <span value="[2, 1, 2, %(numCols)s]"/>
					 <span value="[3, 1, 3, %(numCols)s]"/>
					 <span value="[4, 1, 4, %(numCols)s]"/>
					 <span value="[5, 1, 5, %(numCols)s]"/>
				  </Spans>
			   </Grid>
			</zzReport>"""  % (locals())
	rep=zzPrintDoc().load(report)
	rep.param['DATE']=mem.param['date']
	rep.go(mem.pdf, showProgressBar=False)
	return ""

p1

p2