1.全部沿用了上例的Treelist和Freeform,但本页面中引入了硕正报表(Report)组件;
2.可以直接, 也可以切换:,您在输入时可直接查看报表打印效果;



1.页面中安置了3个实例组件:
<div id='div1' style="position:relative;width:800;height:180px">
  <script>insertFreeForm('AFmaster', '')</script>
</div>
<div id='div2' style="position:relative;width:800;height:200px">
  <script>insertTreeList('AFdetail', '')</script>
</div>
<div id='div3' style="position:relative;width:800px;height:1px">  //注意:高度为1px表示可见,以保证触发OnReady()事件
  <script>insertReport('report', '')</script>
</div>

2.Report在OnReady( )时加载了模板:
function OnReady(id)
{
  ...
  report.func("build", "report/report0.xml");		//加载报表模板
  ...(略)
可见报表的模板是需要另外单独设计的.

3.该报表模板中有2个临时数据源,一个为表头(ds0),另一个为表体(ds1),页面和Report交互的关键代码如下:
//数据传递给report
function initReport()
{
 //取得表头的XML数据,作为数据源传递给Report
 report.func("SetSource", "ds0 \r\n " + AFmaster.func("Export", ""));
 //取得表体的XML数据,作为数据源传递给Report
 report.func("SetSource", "ds1 \r\n " + AFdetail.func("Export", ""));
 //填数、计算
 report.func("Calc", "");
}

4.该Report模板设置了若干较高深的打印选项,例如:


5.如果您想设计出灵活的自定义打印方案,请深入了解Report的功能.