kmarchewa Posted April 21, 2020 Share Posted April 21, 2020 Greetings all:I have created a report, intended for export to spreadsheet format, that utilizes a supreport in the summary section. When exporting to XLS, I noticed the cells/columns for the main report were merged. After experimenting with the report, I discoved the cause was the subreport. If I removed the summary section/subreport, each field appears in its own column as expected. Additionally, if I export the subreport separately, everything is in its proper column to - no merging. It is only when the two reports are combined that the issue occurs.Example when subreport is included (merged - not what I want, Descr should be in A, PLU in B, Breakfast in C, etc)This is how the summary report appears when exported alongside the main report - also with merged cells and starting in Column B. The base width of each field in both the main and summary reports is identical - 60px. Snippet from main report<band height="56"> <property name="com.jaspersoft.studio.unit.height" value="px"/> <textField> <reportElement style="pageFooter" x="0" y="0" width="60" height="56" uuid="466db352-cb97-40be-a05e-e00d93decf96"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="14" isBold="true"/> </textElement> <textFieldExpression><![CDATA["Summary for " + $F{prop_id}]]></textFieldExpression> </textField> <staticText> <reportElement style="pageFooter" x="60" y="0" width="60" height="14" uuid="3b1efc63-23dd-437c-856f-5bbb48c96baf"/> <textElement> <font isBold="true"/> </textElement> <text><![CDATA[size]]></text> </staticText>[/code]Snippet from subreport: <group name="PropGroup"> <groupExpression><![CDATA[$F{prop_id}]]></groupExpression> <groupHeader> <band height="48"> <textField> <reportElement style="pageFooter" x="0" y="0" width="60" height="48" uuid="48d5010b-8f9c-49bf-a74d-a95de999335e"> <property name="net.sf.jasperreports.export.xls.sheet.name" value="Summary"/> </reportElement> <textElement textAlignment="Left" verticalAlignment="Middle"> <font size="14" isBold="true"/> </textElement> <textFieldExpression><![CDATA[$F{prop_id}]]></textFieldExpression> </textField> <staticText> <reportElement style="pageFooter" x="60" y="0" width="60" height="16" uuid="e176b300-abae-4451-8227-29c9f324b8a1"/> <textElement> <font isBold="true"/> </textElement> <text><![CDATA[sM]]></text> </staticText>[/code]The main report contains groups, and each of one of these groups appears on a separate page (by setting "net.sf.jasperreports.export.xls.break.after.row" to true in the footer). The summary section/subreport also appears on a separate page and is defined as follows: <summary> <band height="231"> <property name="com.jaspersoft.studio.unit.height" value="px"/> <property name="net.sf.jasperreports.export.xls.sheet.name" value="Summary"/> <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/> <subreport> <reportElement x="0" y="0" width="480" height="231" uuid="d98acdcd-f5bb-4ed5-aabe-96e57efd014b"> <property name="net.sf.jasperreports.export.xls.sheet.name" value="Summary"/> </reportElement> <parametersMapExpression><![CDATA[new HashMap($P{REPORT_PARAMETERS_MAP})]]></parametersMapExpression> <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> <subreportExpression><![CDATA["combo_summary.jasper"]]></subreportExpression> </subreport> </band> </summary>[/code] Both the sub and main report have the same width (520) and same column width (480). Any guidance would be appreciated. Link to comment Share on other sites More sharing options...
mlopez_1 Posted April 24, 2020 Share Posted April 24, 2020 When you design report units thinking in excel downloads , you must delete page headers and footers and try to put only the columns you want.Each other things cause the exporter to try adjust columns how it can, causing this problems.If you are using subreports, you must size columns equals than master reports or locate ir at the top right page, after last column master report.Regards,Mariano Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now