Jasper:如何调整交叉表列(单元格)的大小?

时间:2018-02-13 11:24:29

标签: jasper-reports crosstab

我很难使用交叉表布局 我遇到的主要问题是我无法调整列的大小。我按照jasper页面here上的说明进行操作。

我试图通过拖动列单元格来完成此操作:

enter image description here

但是在调整大小并释放缩放器后,该列会回到之前的宽度。

其次,在细胞上获得上述亮点并不容易;有时它有时它没有。

编辑源XML似乎不起作用,任何提示?

更新: 这是交叉表的代码,完整代码为here

<crosstab ignoreWidth="true">
                <reportElement x="0" y="96" width="1000" height="200" isPrintWhenDetailOverflows="true" uuid="d0989877-57c2-4a90-a79f-177b1666eed6">
                    <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
                    <property name="com.jaspersoft.studio.crosstab.style.header" value="Crosstab_CH"/>
                    <property name="com.jaspersoft.studio.crosstab.style.group" value="Crosstab_CG"/>
                    <property name="com.jaspersoft.studio.crosstab.style.total" value="Crosstab_CT"/>
                    <property name="com.jaspersoft.studio.crosstab.style.detail" value="Crosstab_CD"/>
                </reportElement>
                <rowGroup name="territorySalesStructureGroupName" width="110" totalPosition="End">
                    <bucket class="java.lang.String">
                        <bucketExpression><![CDATA[$F{territorySalesStructureGroupName}]]></bucketExpression>
                    </bucket>
                    <crosstabRowHeader>
                        <cellContents mode="Opaque" style="Crosstab_CH">
                            <textField>
                                <reportElement style="Crosstab_CD" stretchType="RelativeToTallestObject" x="0" y="0" width="110" height="60" uuid="7fcdef39-875d-4bab-a4db-211ae9a5b72f">
                                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                                </reportElement>
                                <box>
                                    <pen lineColor="#F2F1F0"/>
                                    <leftPen lineWidth="1.0"/>
                                </box>
                                <textFieldExpression><![CDATA[$V{territorySalesStructureGroupName}]]></textFieldExpression>
                            </textField>
                        </cellContents>
                    </crosstabRowHeader>
                    <crosstabTotalRowHeader>
                        <cellContents mode="Opaque" style="Crosstab_CT">
                            <textField>
                                <reportElement style="Crosstab_CT" x="0" y="0" width="270" height="30" uuid="0eb8883f-eee9-4287-a7dd-83b09a7f623d"/>
                                <box>
                                    <leftPen lineWidth="1.0" lineColor="#F2F1F0"/>
                                </box>
                                <textFieldExpression><![CDATA[$R{ui.report.detailed.market.share.report.column.title.total}]]></textFieldExpression>
                            </textField>
                        </cellContents>
                    </crosstabTotalRowHeader>
                </rowGroup>
                <rowGroup name="agentName" width="80" totalPosition="End">
                    <bucket class="java.lang.String">
                        <bucketExpression><![CDATA[$F{agentName}]]></bucketExpression>
                    </bucket>
                    <crosstabRowHeader>
                        <cellContents mode="Opaque" style="Crosstab_CH">
                            <textField>
                                <reportElement style="Crosstab_CD" x="0" y="0" width="80" height="30" uuid="2a632b95-52fb-44ce-bc14-4b064b5e7a76"/>
                                <textFieldExpression><![CDATA[$V{agentName}]]></textFieldExpression>
                            </textField>
                        </cellContents>
                    </crosstabRowHeader>
                    <crosstabTotalRowHeader>
                        <cellContents mode="Opaque" style="Crosstab_CG">
                            <textField>
                                <reportElement style="Crosstab_CT" x="0" y="0" width="160" height="30" uuid="c51326fe-7541-4fa9-af16-fede9fe481d5"/>
                                <textFieldExpression><![CDATA[$R{ui.report.detailed.market.share.report.column.title.total}]]></textFieldExpression>
                            </textField>
                        </cellContents>
                    </crosstabTotalRowHeader>
                </rowGroup>
                <rowGroup name="outletName" width="80">
                    <bucket class="java.lang.String">
                        <bucketExpression><![CDATA[$F{outletName}]]></bucketExpression>
                    </bucket>
                    <crosstabRowHeader>
                        <cellContents mode="Opaque" style="Crosstab_CH">
                            <textField>
                                <reportElement style="Crosstab_CD" x="0" y="0" width="80" height="30" uuid="c5772672-795e-4673-ac62-725b7c3d48df"/>
                                <textFieldExpression><![CDATA[$V{outletName}]]></textFieldExpression>
                            </textField>
                        </cellContents>
                    </crosstabRowHeader>
                    <crosstabTotalRowHeader>
                        <cellContents mode="Opaque" style="Crosstab_CG">
                            <staticText>
                                <reportElement x="0" y="0" width="60" height="30" uuid="3209fce3-dbd4-4ffc-bd2c-77147090a324"/>
                                <text><![CDATA[Total outletName]]></text>
                            </staticText>
                        </cellContents>
                    </crosstabTotalRowHeader>
                </rowGroup>
                <columnGroup name="productManufacturer" height="30" totalPosition="End">
                    <bucket class="java.lang.String">
                        <bucketExpression><![CDATA[$F{productManufacturer}]]></bucketExpression>
                        <orderByExpression><![CDATA[$V{manfacturerOrder_MEASURE}]]></orderByExpression>
                    </bucket>
                    <crosstabColumnHeader>
                        <cellContents mode="Opaque" style="Crosstab_CH">
                            <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
                            <textField>
                                <reportElement style="Crosstab_CH" x="0" y="0" width="220" height="30" uuid="5880c63b-2c31-4395-bcf1-3231234e24a0"/>
                                <box>
                                    <pen lineColor="#F2F1F0"/>
                                    <leftPen lineWidth="1.0"/>
                                </box>
                                <textFieldExpression><![CDATA[$V{productManufacturer}]]></textFieldExpression>
                            </textField>
                        </cellContents>
                    </crosstabColumnHeader>
                    <crosstabTotalColumnHeader>
                        <cellContents mode="Opaque" style="Crosstab_CT">
                            <textField>
                                <reportElement style="Crosstab_CH" stretchType="RelativeToTallestObject" x="0" y="0" width="60" height="120" uuid="d8f0f97e-9f98-49fe-ba7e-1cbcf365a509"/>
                                <box>
                                    <pen lineColor="#F2F1F0"/>
                                    <topPen lineWidth="1.0"/>
                                    <leftPen lineWidth="1.0"/>
                                    <bottomPen lineWidth="1.0"/>
                                </box>
                                <textFieldExpression><![CDATA[$R{ui.report.detailed.market.share.report.column.title.total}]]></textFieldExpression>
                            </textField>
                        </cellContents>
                    </crosstabTotalColumnHeader>
                </columnGroup>
                <columnGroup name="productUnit" height="30" totalPosition="End">
                    <bucket class="java.lang.String">
                        <bucketExpression><![CDATA[$F{productUnit}]]></bucketExpression>
                    </bucket>
                    <crosstabColumnHeader>
                        <cellContents mode="Opaque" style="Crosstab_CH">
                            <textField>
                                <reportElement style="Crosstab_CH" x="0" y="0" width="160" height="30" uuid="f6b0a177-55ec-43a5-9376-c5a5f4d1d809"/>
                                <box>
                                    <pen lineColor="#F2F1F0"/>
                                    <leftPen lineWidth="1.0"/>
                                </box>
                                <textFieldExpression><![CDATA[$V{productUnit}]]></textFieldExpression>
                            </textField>
                        </cellContents>
                    </crosstabColumnHeader>
                    <crosstabTotalColumnHeader>
                        <cellContents mode="Opaque" style="Crosstab_CG">
                            <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/>
                            <textField>
                                <reportElement style="Crosstab_CH_3" positionType="FixRelativeToBottom" x="0" y="0" width="30" height="90" uuid="5dbeb270-7e9d-4294-a711-e5aef111fe7e">
                                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                                </reportElement>
                                <box topPadding="5">
                                    <pen lineColor="#F2F1F0"/>
                                    <leftPen lineWidth="1.0"/>
                                </box>
                                <textElement verticalAlignment="Top"/>
                                <textFieldExpression><![CDATA[$R{ui.report.detailed.market.share.report.column.title.total} + " "]]></textFieldExpression>
                            </textField>
                            <textField isStretchWithOverflow="true">
                                <reportElement style="Crosstab_CH_3" x="30" y="0" width="30" height="90" uuid="d1ad1ae2-c592-4723-9968-ab55c99758aa"/>
                                <box topPadding="5"/>
                                <textElement verticalAlignment="Top"/>
                                <textFieldExpression><![CDATA[$R{ui.report.detailed.market.share.report.column.title.total}]]></textFieldExpression>
                            </textField>
                        </cellContents>
                    </crosstabTotalColumnHeader>
                </columnGroup>
                <columnGroup name="productName" height="30">
                    <bucket class="java.lang.String">
                        <bucketExpression><![CDATA[$F{productName}]]></bucketExpression>
                    </bucket>
                    <crosstabColumnHeader>
                        <cellContents mode="Opaque" style="Crosstab_CH">
                            <textField>
                                <reportElement style="Crosstab_CH_3" x="0" y="0" width="160" height="30" uuid="0d66778e-8489-4e1b-855e-85eecca5ed1e"/>
                                <box>
                                    <pen lineColor="#F2F1F0"/>
                                    <leftPen lineWidth="1.0"/>
                                </box>
                                <textFieldExpression><![CDATA[$V{productName}]]></textFieldExpression>
                            </textField>
                        </cellContents>
                    </crosstabColumnHeader>
                    <crosstabTotalColumnHeader>
                        <cellContents mode="Opaque" style="Crosstab_CG">
                            <staticText>
                                <reportElement x="0" y="0" width="60" height="40" uuid="2a0bd209-de1f-4471-9587-9fa782e48843">
                                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                                </reportElement>
                                <text><![CDATA[Total productName]]></text>
                            </staticText>
                        </cellContents>
                    </crosstabTotalColumnHeader>
                </columnGroup>
                <columnGroup name="quantityHeader" height="30" totalPosition="End">
                    <bucket class="java.lang.String">
                        <bucketExpression><![CDATA[$F{quantityHeader}]]></bucketExpression>
                    </bucket>
                    <crosstabColumnHeader>
                        <cellContents mode="Opaque" style="Crosstab_CH">
                            <textField>
                                <reportElement style="Crosstab_CH_2" x="0" y="0" width="100" height="30" uuid="512f4e2e-597c-46a2-ab88-37167f5e94c9"/>
                                <box>
                                    <pen lineColor="#F2F1F0"/>
                                    <leftPen lineWidth="1.0"/>
                                </box>
                                <textFieldExpression><![CDATA[$R{ui.report.detailed.market.share.report.column.title.units.sold}]]></textFieldExpression>
                            </textField>
                        </cellContents>
                    </crosstabColumnHeader>
                    <crosstabTotalColumnHeader>
                        <cellContents mode="Opaque" style="Crosstab_CG">
                            <textField>
                                <reportElement key="" style="Crosstab_CH_2" stretchType="RelativeToTallestObject" x="0" y="0" width="60" height="30" uuid="f5aa05ae-73d4-47d1-a190-d7eb48f071e6"/>
                                <box>
                                    <pen lineColor="#F2F1F0"/>
                                    <leftPen lineWidth="1.0"/>
                                </box>
                                <textElement>
                                    <font size="12"/>
                                </textElement>
                                <textFieldExpression><![CDATA[$R{ui.report.detailed.market.share.report.column.title.market.share}]]></textFieldExpression>
                            </textField>
                        </cellContents>
                    </crosstabTotalColumnHeader>
                </columnGroup>
                <measure name="qantity_MEASURE" class="java.lang.Double" calculation="Sum">
                    <measureExpression><![CDATA[$F{qantity}]]></measureExpression>
                </measure>
                <measure name="manfacturerOrder_MEASURE" class="java.lang.String">
                    <measureExpression><![CDATA[$F{manufacturerOrder}]]></measureExpression>
                </measure>
                <crosstabCell width="100" height="30">
                    <cellContents mode="Opaque" style="Crosstab_CD">
                        <textField>
                            <reportElement style="Crosstab_CD" x="0" y="0" width="100" height="30" uuid="b05fd30a-8e2c-4cc7-9100-c5e6f62ad771"/>
                            <textFieldExpression><![CDATA[$V{qantity_MEASURE}]]></textFieldExpression>
                        </textField>
                    </cellContents>
                </crosstabCell>
                <crosstabCell width="60" height="30" columnTotalGroup="productManufacturer">
                    <cellContents mode="Opaque" style="Crosstab_CT">
                        <textField>
                            <reportElement style="Crosstab_CD" x="0" y="0" width="60" height="30" uuid="f4ba8559-c94b-4d8f-b801-29eab5533b85"/>
                            <textFieldExpression><![CDATA[$V{qantity_MEASURE}]]></textFieldExpression>
                        </textField>
                    </cellContents>
                </crosstabCell>
                <crosstabCell width="60" height="30" columnTotalGroup="productUnit">
                    <cellContents mode="Opaque" style="Crosstab_CG">
                        <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/>
                        <textField>
                            <reportElement style="Crosstab_CD" x="0" y="0" width="30" height="30" uuid="88578ed2-5641-4ba1-aa86-a0688741043f"/>
                            <textFieldExpression><![CDATA[$V{qantity_MEASURE}]]></textFieldExpression>
                        </textField>
                        <textField pattern="#,##0.00%">
                            <reportElement style="Crosstab_CD" x="30" y="0" width="30" height="30" uuid="4ea636d2-4913-42a2-be9c-dcf61e223587"/>
                            <textFieldExpression><![CDATA[$V{qantity_MEASURE}/$V{qantity_MEASURE_productManufacturer_ALL}]]></textFieldExpression>
                        </textField>
                    </cellContents>
                </crosstabCell>
                <crosstabCell width="60" height="30" columnTotalGroup="quantityHeader">
                    <cellContents mode="Opaque" style="Crosstab_CG">
                        <textField pattern="#,##0.00%">
                            <reportElement style="Crosstab_CD" x="0" y="0" width="60" height="30" uuid="f5ff7479-c507-4ca1-8ec1-17b004485ff6"/>
                            <textFieldExpression><![CDATA[$V{qantity_MEASURE}/$V{qantity_MEASURE_productManufacturer_ALL}]]></textFieldExpression>
                        </textField>
                    </cellContents>
                </crosstabCell>
                <crosstabCell width="100" height="30" rowTotalGroup="territorySalesStructureGroupName">
                    <cellContents mode="Opaque" style="Crosstab_CT">
                        <textField>
                            <reportElement style="Crosstab_CT" x="0" y="0" width="100" height="30" uuid="15735372-980f-4ea2-aa12-5083967d181a"/>
                            <textFieldExpression><![CDATA[$V{qantity_MEASURE}]]></textFieldExpression>
                        </textField>
                    </cellContents>
                </crosstabCell>
                <crosstabCell width="60" height="30" rowTotalGroup="territorySalesStructureGroupName" columnTotalGroup="productManufacturer">
                    <cellContents mode="Opaque" style="Crosstab_CT">
                        <textField>
                            <reportElement style="Crosstab_CT" x="0" y="0" width="60" height="30" uuid="3db35d77-f993-46db-a599-706770b38e58"/>
                            <textFieldExpression><![CDATA[$V{qantity_MEASURE}]]></textFieldExpression>
                        </textField>
                    </cellContents>
                </crosstabCell>
                <crosstabCell width="60" height="30" rowTotalGroup="territorySalesStructureGroupName" columnTotalGroup="productUnit">
                    <cellContents mode="Opaque" style="Crosstab_CT">
                        <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/>
                        <textField>
                            <reportElement style="Crosstab_CT" x="0" y="0" width="30" height="30" uuid="b80ddbfd-45ae-4de4-a45d-ea51bc62ad9b"/>
                            <textFieldExpression><![CDATA[$V{qantity_MEASURE}]]></textFieldExpression>
                        </textField>
                        <textField pattern="#,##0.00%">
                            <reportElement style="Crosstab_CT" x="30" y="0" width="30" height="30" uuid="24a30dff-a017-4dc5-91d7-92e0b590821d"/>
                            <textFieldExpression><![CDATA[$V{qantity_MEASURE}/$V{qantity_MEASURE_productManufacturer_ALL}]]></textFieldExpression>
                        </textField>
                    </cellContents>
                </crosstabCell>
                <crosstabCell width="60" height="30" rowTotalGroup="territorySalesStructureGroupName" columnTotalGroup="quantityHeader">
                    <cellContents mode="Opaque" style="Crosstab_CT">
                        <textField pattern="#,##0.00%">
                            <reportElement style="Crosstab_CT" x="0" y="0" width="60" height="30" uuid="7843d1ae-b001-4c7f-9c86-b6e08f6e2797"/>
                            <textFieldExpression><![CDATA[$V{qantity_MEASURE}/$V{qantity_MEASURE_productManufacturer_ALL}]]></textFieldExpression>
                        </textField>
                    </cellContents>
                </crosstabCell>
                <crosstabCell width="100" height="30" rowTotalGroup="agentName">
                    <cellContents mode="Opaque" style="Crosstab_CG">
                        <textField>
                            <reportElement style="Crosstab_CT" x="0" y="0" width="100" height="30" uuid="56c7d07c-1305-4f41-9b88-660b77a5aa19"/>
                            <textFieldExpression><![CDATA[$V{qantity_MEASURE}]]></textFieldExpression>
                        </textField>
                    </cellContents>
                </crosstabCell>
                <crosstabCell width="60" height="30" rowTotalGroup="agentName" columnTotalGroup="productManufacturer">
                    <cellContents mode="Opaque" style="Crosstab_CT">
                        <textField>
                            <reportElement style="Crosstab_CT" x="0" y="0" width="60" height="30" uuid="4095cb8d-552e-4d77-968c-8906d29c7c61"/>
                            <textFieldExpression><![CDATA[$V{qantity_MEASURE}]]></textFieldExpression>
                        </textField>
                    </cellContents>
                </crosstabCell>
                <crosstabCell width="60" height="30" rowTotalGroup="agentName" columnTotalGroup="productUnit">
                    <cellContents mode="Opaque" style="Crosstab_CG">
                        <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/>
                        <textField>
                            <reportElement style="Crosstab_CT" x="0" y="0" width="30" height="30" uuid="17706060-ba92-4698-9bf9-314f561af8ab"/>
                            <textFieldExpression><![CDATA[$V{qantity_MEASURE}]]></textFieldExpression>
                        </textField>
                        <textField pattern="#,##0.00%">
                            <reportElement style="Crosstab_CT" x="30" y="0" width="30" height="30" uuid="383976c4-5661-4af5-9fce-e5edd6bdb7f7"/>
                            <textFieldExpression><![CDATA[$V{qantity_MEASURE}/$V{qantity_MEASURE_productManufacturer_ALL}]]></textFieldExpression>
                        </textField>
                    </cellContents>
                </crosstabCell>
                <crosstabCell width="60" height="30" rowTotalGroup="agentName" columnTotalGroup="quantityHeader">
                    <cellContents mode="Opaque" style="Crosstab_CG">
                        <textField pattern="#,##0.00%">
                            <reportElement style="Crosstab_CT" x="0" y="0" width="60" height="30" uuid="fc02bf32-c824-4570-82a8-01338b8621f8"/>
                            <textFieldExpression><![CDATA[$V{qantity_MEASURE}/$V{qantity_MEASURE_productManufacturer_ALL}]]></textFieldExpression>
                        </textField>
                    </cellContents>
                </crosstabCell>
                <crosstabCell width="60" height="30" rowTotalGroup="outletName">
                    <cellContents mode="Opaque" style="Crosstab_CG">
                        <textField>
                            <reportElement x="0" y="0" width="60" height="30" uuid="583662f4-b600-4c2d-bc60-f8b8d6b16262"/>
                            <textFieldExpression><![CDATA[$V{qantity_MEASURE}]]></textFieldExpression>
                        </textField>
                    </cellContents>
                </crosstabCell>
                <crosstabCell width="60" height="30" rowTotalGroup="outletName" columnTotalGroup="productManufacturer">
                    <cellContents mode="Opaque" style="Crosstab_CT">
                        <textField>
                            <reportElement x="0" y="0" width="60" height="30" forecolor="#FFFFFF" uuid="65f3942b-a2a9-4987-825c-5a3ae6fde415"/>
                            <textFieldExpression><![CDATA[$V{qantity_MEASURE}]]></textFieldExpression>
                        </textField>
                    </cellContents>
                </crosstabCell>
                <crosstabCell width="60" height="30" rowTotalGroup="outletName" columnTotalGroup="productUnit">
                    <cellContents mode="Opaque" style="Crosstab_CG">
                        <textField>
                            <reportElement x="0" y="0" width="60" height="30" uuid="b9bbe843-a534-438e-b9ee-0fcc602002d3"/>
                            <textFieldExpression><![CDATA[$V{qantity_MEASURE}]]></textFieldExpression>
                        </textField>
                    </cellContents>
                </crosstabCell>
                <crosstabCell width="60" height="30" rowTotalGroup="outletName" columnTotalGroup="quantityHeader">
                    <cellContents mode="Opaque" style="Crosstab_CG">
                        <textField>
                            <reportElement x="0" y="0" width="60" height="30" uuid="81ea452b-5369-4676-87b9-a6da5c23cde3"/>
                            <textFieldExpression><![CDATA[$V{qantity_MEASURE}]]></textFieldExpression>
                        </textField>
                    </cellContents>
                </crosstabCell>
                <crosstabCell width="60" height="30" columnTotalGroup="productName">
                    <cellContents mode="Opaque" style="Crosstab_CG">
                        <textField>
                            <reportElement x="0" y="0" width="60" height="30" uuid="174abc9a-0aad-417f-a0eb-a14e26d28c9c"/>
                            <textFieldExpression><![CDATA[$V{qantity_MEASURE}]]></textFieldExpression>
                        </textField>
                    </cellContents>
                </crosstabCell>
                <crosstabCell width="60" height="30" rowTotalGroup="territorySalesStructureGroupName" columnTotalGroup="productName">
                    <cellContents mode="Opaque" style="Crosstab_CT">
                        <textField>
                            <reportElement x="0" y="0" width="60" height="30" forecolor="#FFFFFF" uuid="8100cedd-2457-4d0e-bc83-7c1fc42a254a"/>
                            <textFieldExpression><![CDATA[$V{qantity_MEASURE}]]></textFieldExpression>
                        </textField>
                    </cellContents>
                </crosstabCell>
                <crosstabCell width="60" height="30" rowTotalGroup="agentName" columnTotalGroup="productName">
                    <cellContents mode="Opaque" style="Crosstab_CG">
                        <textField>
                            <reportElement x="0" y="0" width="60" height="30" uuid="6e6821b0-6a54-42e6-94ae-9934b11b2354"/>
                            <textFieldExpression><![CDATA[$V{qantity_MEASURE}]]></textFieldExpression>
                        </textField>
                    </cellContents>
                </crosstabCell>
                <crosstabCell width="60" height="30" rowTotalGroup="outletName" columnTotalGroup="productName">
                    <cellContents mode="Opaque" style="Crosstab_CG">
                        <textField>
                            <reportElement x="0" y="0" width="60" height="30" uuid="55ec083a-1bef-4000-ac90-4b05261f3da0"/>
                            <textFieldExpression><![CDATA[$V{qantity_MEASURE}]]></textFieldExpression>
                        </textField>
                    </cellContents>
                </crosstabCell>
            </crosstab>

0 个答案:

没有答案