动态报表弄得头都大了
先上文件再说,一天偶然看了一篇文章,用程序动态控制,设计任意报表,文章没有看太懂,大致意思知道了,想操练一下试试,呵呵,怎么也预览不出来,老大们看看为什么啥也显不出来?
report.zip
(5.39 KB)
程序代码:
you_bb="动态报表.frx" USE dyjl n_zdzs =afields(ss_text) USE &you_bb. IN 2 EXCLUSIVE IF n_zdzs>0 &&判断是否有字段 FOR jsk_i=1 TO n_zdzs &&添加标题行 APPEND BLANK REPLACE objtype WITH 5 replace objcode WITH 0 replace expr with ["]+ss_text[jsk_i,1]+["] &&输入带双引号的 replace fontsize WITH 12 &&标题行用小四 replace height WITH 2000 replace width WITH 1562.5*4 &&一个四号字是1562.5 replace vpos WITH 12266 replace hpos WITH 2000*jsk_i replace penred WITH -1,pengreen WITH -1 ,penblue WITH -1,fillred WITH -1,fillblue WITH -1,fillgreen WITH -1 replace timestamp WITH VAL(SYS(3)), platform WITH "windows",supalways WITH .T.,suprpcol WITH 3 REPLACE supvalchng WITH .f. replace uniqueid WITH "ziduan"+ALLTRIM(STR(jsk_i)) ENDFOR FOR jsk_j=1 TO n_zdzs &&添加细节区 APPEND BLANK REPLACE objtype WITH 8 replace objcode WITH 0 replace name WITH ss_text[jsk_j,1] replace expr with "dyjl."+ss_text[jsk_j,1] replace fontsize WITH 11 &&内容用五号字 replace height WITH 2000 replace width WITH 5000 replace vpos WITH 12266+2000 replace hpos WITH 2000*jsk_J*2000 replace fillchar WITH "c" replace stretch WITH .T. &&溢出时伸展 replace penred WITH -1,pengreen WITH -1 ,penblue WITH -1,fillred WITH -1,fillblue WITH -1,fillgreen WITH -1 replace timestamp WITH VAL(SYS(3)), platform WITH "windows",supalways WITH .T.,suprpcol WITH 3 REPLACE supvalchng WITH .f. replace uniqueid WITH "bianliang"+ALLTRIM(STR(jsk_J)) ENDFOR ENDIF Use SELE dyjl REPORT FORM &YOU_BB TO PRINT PROMPT PREVIEW &&打印报表 Use &YOU_BB..FRX中间的宽高是我随便设的,我看其他报表文件中的不知道都是什么单位,有说MM,有说CM。还有说是点。真是搞不懂呀