今天看啥
热点:

BIRT报表script,birtscript


1.隔行高亮显示

1. 在布局(Layout)中,选择TableDetail的行。如下图:

 

2. 然后选择Script,打开脚本窗口顶部的方法列表并选择onPrepare,如图所示。

var count=0;

 


3. 最后打开脚本窗口顶部的方法列表并选择 onCreate,如图所示:

count++;
if (count % 2 != 0) {
  style.setBackgroundColor(silver);
 }

 

 

4. 保存,点击Preview预览结果如下图。


这是网上找别人的案例来的,然后就照着做,就出现问题了

报了一大堆问题:

Multiple annotations found at this line:
	- org.eclipse.birt.report.engine.api.EngineException: There are errors evaluating script "count++; if (count % 2 != 0) 
	 {   style.setBackgroundColor("#000000"); }": ReferenceError: "count" is not defined. (/report/body/grid[@id="43"]/row[@id="45"]/cell[@id="46"]/
	 table[@id="49"]/detail/row[@id="54"]/method[@name="onCreate"]#1) at 
	 org.eclipse.birt.report.engine.script.internal.ScriptExecutor.addException(ScriptExecutor.java:249) at 
	 org.eclipse.birt.report.engine.script.internal.RowScriptExecutor.handleOnCreate(RowScriptExecutor.java:64) at 
	 org.eclipse.birt.report.engine.script.internal.OnCreateScriptVisitor.visitRow(OnCreateScriptVisitor.java:167) at 
	 org.eclipse.birt.report.engine.ir.RowDesign.accept(RowDesign.java:108) at 
	 org.eclipse.birt.report.engine.script.internal.OnCreateScriptVisitor.onCreate(OnCreateScriptVisitor.java:73) at 
	 org.eclipse.birt.report.engine.executor.ReportItemExecutor.handleOnCreate(ReportItemExecutor.java:917) at 
	 org.eclipse.birt.report.engine.executor.RowExecutor.execute(RowExecutor.java:83) at 
	 org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46) at 
	 org.eclipse.birt.report.engine.internal.executor.emitter.ReportItemEmitterExecutor.execute(ReportItemEmitterExecutor.java:46) at 
	 org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor.java:43) at 
	 org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46) at 
	 org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:34) at 
	 org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:65) at 
	 org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26) at 
.
.
.
 ReferenceError: "count" is not defined表示说我的count未定义,我不是明明定义了吗。

又到网上搜了,然后就说:

不是在明细行的script里定义count,定义count也不能使用var哦。
要在表格的onprepare里定义count=0;

貌似在明细里还是在表格的script定义都一样,然后把它修整过来,竟然可以了。

www.bkjia.comtruehttp://www.bkjia.com/webzh/972385.htmlTechArticleBIRT报表script,birtscript 1.隔行高亮显示 1.在布局( Layout )中 , 选择 Table - Detail 的行。如下图: 2.然后选择Script,打开脚本窗口顶部的方法...

相关文章

帮客评论

视觉看点