I am trying to export report to Excel (XLSX format) using jasper report, but get problems with stretching when text field is overflow.
I get just empty cells when value of textfield is bigger than textfield size.
I tried to use these parameters, but it isn't helping me:
<property name="net.sf.jasperreports.export.xls.collapse.row.span" value="true"/>
<property name="net.sf.jasperreports.print.keep.full.text" value="true"/>
<property name="net.sf.jasperreports.export.xls.detect.cell.type" value="true"/>
<property name="net.sf.jasperreports.export.xls.wrap.text" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/>
Here is refer to screenshot:
http://clip2net.com/s/39cbljj
In HTML it looks ok:
http://c2n.me/39cyhRf
Does anybody know how to fix this?
Thanks.
you should do the following to get it working:
Set isStretchWithOverflow="true" for all TextField elements on Detail
band (it will fix cutting of long text
values)
Set stretchType="RelativeToBandHeight" for all TextField elements on Detail band (It will fix the issue with empty cells - all TextFields will be rendered with the same height)
set the property <property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
on each TextField which may have long value. The point is that property net.sf.jasperreports.export.xls.auto.fit.row works on Element level only.Also please note that this property won't work for merged cells.
It works perfect in HTML, but during export in EXCEL format I get problem.
I looked stretch sample from jasper reports demo/samples folder and found out solution. I set horizontal alighment textfield parameter to "justify" and it will work in Excel and look perfect. Seems that without this parameter stretch does not work during export to Excel.
Thanks for the help, user1390785 !
I just got same issue and i solved it.
its simple. just open your report properties and set page height to 999999. convert again and see its just solved
Related
I am using the JasperReports 4.0.5. Trying to suppress group footer and headers while exporting to CSV.
I've tried the using of
net.sf.jasperreports.export.{format}.exclude.origin.{suffix}.{arbitrary_name} property.
It didn't work.
Any suggestions?
TU
For hiding only the groupHeader band you should add this two properties (both lines) to the jrxml file, for example:
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.1" value="groupHeader"/>
<property name="net.sf.jasperreports.export.csv.exclude.origin.group.1" value="GroupExpenses"/>
For hiding both groupHeader and groupFooter bands you should add all this properties to jrxml file:
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.1" value="groupHeader"/>
<property name="net.sf.jasperreports.export.csv.exclude.origin.group.1" value="GroupExpenses"/>
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.2" value="groupFooter"/>
<property name="net.sf.jasperreports.export.csv.exclude.origin.group.2" value="GroupExpenses"/>
In both samples the group name is GroupExpenses.
<group name="GroupExpenses">
For more details look at How can I suppress page headers and footers when exporting to XLS? topic.
I have a master report with 2 subreports. I use the same report to generate PDF and xls. Pagination is enabled but for excel, i need to disable pagination, which i do by rendering all in one sheet. The page header/column header get repeat for each page. These page header/column header are from the sub reports. This is fine for PDF but in case of excel, i want to get rid of the repeating header.
I set these properties:
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.3" value="pageHeader" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.3" value="pageHeader" />
<property name="net.sf.jasperreports.export.pdf.exclude.origin.keep.first.band.1" value="pageHeader" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.1" value="columnHeader" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.1" value="columnHeader" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.2" value="pageFooter" />
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.rows" value="true" />
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.columns" value="true" />
But these arent reflected in the data rendered by the subreport. In xls, i still see the pageHeader/columnHeader gets repeated. Please let me know, how to fix this.
For XLS (and HTML) reports, you may want to set the parameter IS_IGNORE_PAGINATION to true. See http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRParameter.html for documentation.
I know this is an old question, but I keep forgetting how to do this myself and each time I search I seem to find this question so thought I'd put something so I find it next time.
In the main report file you also need to add the sub report to the filter:
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.1" value="columnHeader" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.1" value="columnHeader" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.report.1" value="sub-report-name" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.report.1" value="sub-report-name" />
I have used a workflow-send button to submit form data in XML format to a JSP file. However, it saves data as a PDF as opposed to XML string.
I know it is PDF because I get <?xml version="1.0" encoding="UTF-8"?><url>/xforms-server/dynamic/e9002cb0ce38d116e3037bb622050a36</url> on sysout in the JSP.
My properties-local.xml contains the following entries:
<property as="xs:string" name="oxf.xforms.format.input.date" value="[D]/[M]/[Y]"/>
<property as="xs:boolean" name="oxf.fr.email.attach-pdf" value="false"/>
<property as="xs:boolean" name="oxf.fr.alfresco.send-pdf" value="false"/>
<property as="xs:boolean" name="oxf.fr.detail.send.pdf" value="false"/>
<property as="xs:boolean" name="oxf.fr.detail.send.alfresco" value="false"/>
<property as="xs:boolean" name="oxf.fr.detail.send.email" value="false"/>
<property as="xs:string" name="oxf.fr.detail.buttons.*.*" value="workflow-send"/>
<property as="xs:string" name="oxf.fr.detail.send.success.method.*.*" value="post"/>
<property as="xs:anyURI" name="oxf.fr.detail.send.uri.*.*" value="http://localhost:8080/orbeon/xforms-jsp/idm/idm-customer.jsp"/>
<property as="xs:NMTOKENS" name="oxf.xforms.logging.debug" value="document model submission control event action analysis server html submission-details"/>
How can I get the data in XML format instead of a PDF?
According to the documentation on the workflow-send, the PDF is generated if either one of the following properties is true: oxf.fr.detail.send.pdf, oxf.fr.email.attach-pdf, or oxf.fr.alfresco.send-pdf. You don't seem to have any of those properties set to true, so the XML (not the PDF) of the form should be sent to the service you specified. I suspect that you might be using a version of Orbeon Forms that pre-dates the introduction of some of those properties. If you are not on version 3.9, I would suggest you upgrade to 3.9 (or newer). If you are on 3.9 or newer, then please post a comment and we'll try to help.
<reportElement x="79" y="103" width="279" height="23" backcolor="#000000">
<propertyExpression name="width"><![CDATA["100"]]></propertyExpression>
</reportElement>
I am trying to set the width of a reportElement by using a propertyExpresssion, JasperReports is picking up the width as 279 instead of 100 in the code above, and if I remove the width attribute in the reportElement tag I will get an error.
What am I doing wrong? It compiles, fills and all, but the width in the expression is not being used.
JRElement element = jasperReport.getTitle().getElementByKey("graphWidthKey");
element.setWidth(100);
why not directly set 100 at reportElement tag, and i doubt whether is a solution to have width of text inside a box different of the box width. if you know, please share.
propertyExpression can not be used to set width that is an attribute. They are used to add property's for example during export or to pass value to a ChartCustomizer
These are the available properties for configuration jasper report properties
A typical property would be
<property name="net.sf.jasperreports.export.xls.break.after.row" value="true"/>
And you can create a propertyExpression for this:
<propertyExpression name="net.sf.jasperreports.export.xls.break.after.row"><![CDATA[$V{timeToBreak}?"true":"false"]]></propertyExpression>
We are using one template to render the report in CSV and PDF format. But the problem is we need to have report split into pages in PDF but not in CSV. Is it possible to alter the rendering options based on the format in one template. So that we have CSV without pagination information and PDF divided into page. In such a case 2 separate templates one for CSV and one for PDF should be used? or this can be achieved using one template?
Finally found the answer. In the template following properties need to be set
<property name="net.sf.jasperreports.export.csv.exclude.origin.keep.first.band.columnHeader" value="columnHeader" />
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.columnFooter" value="columnFooter" />
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.pageFooter" value="pageFooter" />
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.lastPageFooter" value="lastPageFooter" />
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.summary" value="summary" />
Using JRCsvMetadataExporter solved similar problem. This class extracts the data from the template ignoring the rendering part. Check out the sample here