All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
利用XML实现通用WEB报表打印实际使用中的例子_[XML教程]

Writer: 归海一刀 Article type: Programming skills(编程技巧) Time: 2014/3/20 5:15:37 Browse times: 278 Comment times: 0

利用XML实现通用WEB报表打印实际使用中的例子_[XML教程]


Head photo

Go homepage
Upload pictures
Write articles

利用XML实现通用WEB报表打印实际使用中的例子_[XML教程]

最近做的一个B/S项目,在打印时采用了在IE中嵌入.net winform控件和XML结合的方式(参见http://www.yesky.com/20030214/1652186.shtml),在实际应用过程中,有一些心得,和大家分享。
(一).使用通用模版格式化XML文件
系统****用到了三种单据,分别为出库单,入库单,送货单,因此,定义三个模版文件,格式如下:
chukudan.xsl:





false
Custom
800
600
0
0
0
0






车次号:

















































































其中,toptable是表头,detailtable是表格左边的产品明细,mastertable是表格右边的运输信息等,foottable是最下面制表人等信息。

然后,在asp.net页面中,将查询出的结果作如下转换

'是否取得了单据
If billInfoXml <> Nothing Then

billInfoDoc.LoadXml(billInfoXml)
'billInfoDoc.LoadXml("http://111.111.111.111/stockmg/test.xsl")
billTrans.Load(billFormatXmlUrl)

billXmlWr.Formatting = System.Xml.Formatting.Indented
billXmlWr.Indentation = 4
billXmlWr.IndentChar = " "

billTrans.Transform(billNav, Nothing, billXmlWr, Nothing)
billXmlWr.Flush()

End If

返回的信息用javascript代码加载到打印控件:
parent.frames.frmhidPrint.parent.frames.frmhidPrint.print1.SetXml(xmlResult); //SetMessage(xmlResult); parent.frames.frmhidPrint.parent.frames.frmhidPrint.print1.PrintAct();

注意,这里调用打印控件用了parent.frames....这是为了节省每次打开页面时加载打印控件的时间,使用了一个框架网页,把打印控件放在一个单独的页面中,从而不需每次加载。

第一次发帖,包涵,呵呵。

出处:品味技术 感受人生 BLOG





There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.