Jasper版本:6.0.1
我想知道每个关键字都改变了jasper的版本吗?
我去年在破解页面上使用此代码。
$V{COLUMN_NUMBER} == 6
但现在停止工作了。
示例:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.0.1.final using JasperReports Library version 6.0.0 -->
<!-- 2015-11-06T11:20:46 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report8" language="groovy" columnCount="5" printOrder="Horizontal" pageWidth="995" pageHeight="842" columnWidth="138" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="5e2835cc-bc36-4f77-8631-08a8deaa28d7">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="spaTd"/>
<queryString language="MongoDbQuery">
<![CDATA[{
collectionName: 'branch',
findFields: { _id:1, code:1, name:1 }
}]]>
</queryString>
<field name="_id" class="java.lang.String"/>
<field name="code" class="java.lang.String"/>
<field name="name" class="java.lang.String"/>
<detail>
<band height="22" splitType="Stretch">
<textField>
<reportElement x="30" y="0" width="50" height="20" uuid="76707cdd-7dbe-477e-b3a4-38f9ba3bd003"/>
<textFieldExpression><![CDATA[$F{code}]]></textFieldExpression>
</textField>
<break>
<reportElement x="0" y="19" width="100" height="1" uuid="4f383cfa-5b99-465d-9a35-ca598aed7a6f">
<printWhenExpression><![CDATA[$V{REPORT_COUNT} == 6]]></printWhenExpression>
</reportElement>
</break>
<textField>
<reportElement x="0" y="0" width="30" height="20" uuid="294bf799-580b-450e-9a04-a4c2f83ba296"/>
<textFieldExpression><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
***我仍然混淆为什么第6列没有移动到另一页?
答案 0 :(得分:1)
问题是jasperReport printOrder="Horizontal"
上的打印顺序,<break>
命令正常工作,您需要printOrder="Vertical"
但是,如果我希望在第6列之后使用printOrder="Horizontal"
进行分页,我会使用group并执行类似的操作。
<group name="ReportCount" isStartNewPage="true">
<groupExpression><![CDATA[new Boolean($V{REPORT_COUNT}<=6)]]></groupExpression>
<groupHeader>
<band height="2"></band>
</groupHeader>
</group>
因此,$ V {REPORT_COUNT}&gt; 6它从true切换 - &gt; false,执行isStartNewPage="true"
答案 1 :(得分:0)
最后!它现在正在工作!!!
public static void countArray(char ch1, char ch2, char[] character)
{
// Create an array with the letters you want to compare with: vowels
int[] vowels = {(int) 'a', (int) 'e', (int) 'i', (int) 'o', (int) 'u'};
// Create the array for the range between the two letters
int[] dictionary = new int[(int) ch2 - (int) ch1 + 1];
// Fill up the array with the ocurrence of each character
for(int i = 0; i < character.length; i++){
dictionary[((int)character[i] - (int) ch1)]++;
}
// Print the occurrence of each vowel
for(int j = 0; j < vowels.length; j++){
System.out.println((char) vowels[j] + ": " + dictionary[vowels[j] - (int)'a']);
}
}
结果: