JasperReports中的字符串中包含定界符时,如何抑制字符串引用?

时间:2018-10-01 12:15:40

标签: csv jasper-reports

对于一个csv输出,我不会用“”括起来, 如果字符串中有分隔符。

在最新版本6.4,旧版本(例如3. *)中(正确)发生了这种情况, 输出没有字符串。 我想要像旧版本一样:

Count

现在它在标准输出中用引号引起来:

...;-6.638,66;-6.806,72;18.571,43;....

如何禁止在jrxml文件中创建“”,或者如何覆盖net.sf.jasperreports.export.csv.field.enclosure-参数?

这是一个字符串Textfield,$ F {F_PeriodDistribution}

导出属性:...;"-6.638,66;-6.806,72;18.571,43";....

PS:在字符串字段中创建任何像string.Replace(“ \”“,”“);这样的压缩都不起作用,因为JasperReports稍后会由于字段封闭标志而在创建时生成引号...

1 个答案:

答案 0 :(得分:0)

我尝试将其替换为

       <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
            <reportElement key="textField" style="Arial_8_Normal" mode="Transparent" x="510" y="0" width="50" height="11" forecolor="#000000" backcolor="#FFFFFF" uuid="2d9e6183-f8ef-4fc4-b365-825a4c45f4f6">
                <printWhenExpression><![CDATA[$P{P_WithPeriodDistribution} && $F{F_PeriodDistributionDataSource} == null]]></printWhenExpression>
            </reportElement>
            <textElement textAlignment="Left" verticalAlignment="Top" rotation="None">
                <font size="5"/>
                <paragraph lineSpacing="Single"/>
            </textElement>
            <textFieldExpression><![CDATA[$F{F_PeriodDistribution.replace("\"", "")}]]></textFieldExpression>
        </textField>