2012-08-14 18 views
0

報告的頭由10個元素就應該是這樣的:JasperReports的:頭不在同一行

|1 2 3 4 5 6 7 8 9 10| 
|--------------------| 

在現實中,它看起來像這樣:

|1 2   8 9 10| 
|---3 4 5 6 7 ------| 

這是東西用verticalAligment做什麼?我已將它設置爲底部。

從我的JRXML文件的片段:

<pageHeader> 
    <band height="0" isSplitAllowed="true" > 
    </band> 
</pageHeader> 
<columnHeader> 
    <band height="39" isSplitAllowed="true" > 
     <rectangle> 
      <reportElement 
       x="0" 
       y="1" 
       width="780" 
       height="30" 
       backcolor="#999999" 
       key="rectangle-1"/> 
      <graphicElement stretchType="NoStretch"/> 
     </rectangle> 
     <staticText> 
      <reportElement 
       x="0" 
       y="0" 
       width="40" 
       height="30" 
       key="staticText-1"/> 
      <box></box> 
      <textElement verticalAlignment="Bottom"> 
       <font size="8"/> 
      </textElement> 
     <text><![CDATA[Holder Id]]></text> 
     </staticText> 
     <staticText> 
      <reportElement 
       x="40" 
       y="0" 
       width="50" 
       height="30" 
       key="staticText-2"/> 
      <box></box> 
      <textElement verticalAlignment="Bottom"> 
       <font size="8"/> 
      </textElement> 
     <text><![CDATA[Shell Id ]]></text> 
     </staticText> 
     <staticText> 
      <reportElement 
       x="100" 
       y="1" 
       width="50" 
       height="30" 
       key="staticText-3"/> 
      <box></box> 
      <textElement verticalAlignment="Bottom"> 
       <font size="8"/> 
      </textElement> 
     <text><![CDATA[Product Id]]></text> 
     </staticText> 
     <staticText> 
      <reportElement 
       x="160" 
       y="1" 
       width="40" 
       height="30" 
       key="staticText-4"/> 
      <box></box> 
      <textElement verticalAlignment="Bottom"> 
       <font size="8"/> 
      </textElement> 
     <text><![CDATA[SPID]]></text> 
     </staticText> 
     <staticText> 
      <reportElement 
       x="200" 
       y="1" 
       width="40" 
       height="30" 
       key="staticText-5"/> 
      <box></box> 
      <textElement verticalAlignment="Bottom"> 
       <font size="8"/> 
      </textElement> 
     <text><![CDATA[Loc- 
ation]]></text> 
     </staticText> 
     <staticText> 
      <reportElement 
       x="300" 
       y="1" 
       width="50" 
       height="30" 
       key="staticText-6"/> 
      <box></box> 
      <textElement verticalAlignment="Bottom"> 
       <font size="8"/> 
      </textElement> 
     <text><![CDATA[Date]]></text> 
     </staticText> 
     <staticText> 
      <reportElement 
       x="350" 
       y="1" 
       width="30" 
       height="30" 
       key="staticText-7"/> 
      <box></box> 
      <textElement verticalAlignment="Bottom"> 
       <font size="8"/> 
      </textElement> 
     <text><![CDATA[Normal Fare]]></text> 
     </staticText> 
     <staticText> 
      <reportElement 
       x="380" 
       y="1" 
       width="30" 
       height="30" 
       key="staticText-8"/> 
      <box></box> 
      <textElement verticalAlignment="Bottom"> 
       <font size="8"/> 
      </textElement> 
     <text><![CDATA[Actual Fare]]></text> 
     </staticText> 
     <staticText> 
      <reportElement 
       x="410" 
       y="1" 
       width="40" 
       height="30" 
       key="staticText-9"/> 
      <box></box> 
      <textElement verticalAlignment="Bottom"> 
       <font size="8"/> 
      </textElement> 
     <text><![CDATA[Currency Code]]></text> 
     </staticText> 
     <staticText> 
      <reportElement 
       x="450" 
       y="1" 
       width="30" 
       height="30" 
       key="staticText-10"/> 
      <box></box> 
      <textElement verticalAlignment="Bottom"> 
       <font size="8"/> 
      </textElement> 
     <text><![CDATA[Staff Id]]></text> 
     </staticText> 
     <staticText> 
      <reportElement 
       x="250" 
       y="1" 
       width="40" 
       height="30" 
       key="staticText-11"/> 
      <box></box> 
      <textElement verticalAlignment="Bottom"> 
       <font size="8"/> 
      </textElement> 
     <text><![CDATA[Dest- 
ination]]></text> 
     </staticText> 
     <staticText> 
      <reportElement 
       x="750" 
       y="0" 
       width="30" 
       height="30" 
       key="staticText-12"/> 
      <box></box> 
      <textElement verticalAlignment="Bottom"> 
       <font size="8"/> 
      </textElement> 
     <text><![CDATA[ISAM Seq.]]></text> 
     </staticText> 
     <staticText> 
      <reportElement 
       x="700" 
       y="0" 
       width="50" 
       height="30" 
       key="staticText-13"/> 
      <box></box> 
      <textElement verticalAlignment="Bottom"> 
       <font size="8"/> 
      </textElement> 
     <text><![CDATA[ISAM Id]]></text> 
     </staticText> 
     <staticText> 
      <reportElement 
       x="670" 
       y="0" 
       width="30" 
       height="30" 
       key="staticText-14"/> 
      <box></box> 
      <textElement verticalAlignment="Bottom"> 
       <font size="8"/> 
      </textElement> 
     <text><![CDATA[Trans. Type]]></text> 
     </staticText> 
     <staticText> 
      <reportElement 
       x="630" 
       y="1" 
       width="40" 
       height="30" 
       key="staticText-15"/> 
      <box></box> 
      <textElement verticalAlignment="Bottom"> 
       <font size="8"/> 
      </textElement> 
     <text><![CDATA[CPICC]]></text> 
     </staticText> 
     <staticText> 
      <reportElement 
       x="510" 
       y="1" 
       width="30" 
       height="30" 
       key="staticText-16"/> 
      <box></box> 
      <textElement verticalAlignment="Bottom"> 
       <font size="8"/> 
      </textElement> 
     <text><![CDATA[Conc. Auth]]></text> 
     </staticText> 
     <staticText> 
      <reportElement 
       x="480" 
       y="1" 
       width="30" 
       height="30" 
       key="staticText-17"/> 
      <box></box> 
      <textElement verticalAlignment="Bottom"> 
       <font size="8"/> 
      </textElement> 
     <text><![CDATA[Suppl. Info.]]></text> 
     </staticText> 
     <staticText> 
      <reportElement 
       x="540" 
       y="1" 
       width="40" 
       height="30" 
       key="staticText-18"/> 
      <box></box> 
      <textElement verticalAlignment="Bottom"> 
       <font size="8"/> 
      </textElement> 
     <text><![CDATA[Trans. Seq. No]]></text> 
     </staticText> 
     <staticText> 
      <reportElement 
       x="580" 
       y="1" 
       width="40" 
       height="30" 
       key="staticText-19"/> 
      <box></box> 
      <textElement verticalAlignment="Bottom"> 
       <font size="8"/> 
      </textElement> 
     <text><![CDATA[Rem. Uses]]></text> 
     </staticText> 
    </band> 
</columnHeader> 
+2

你能告訴我們一些你的jrxml代碼片段嗎? – 2012-08-14 16:34:42

+0

@shanyangqu你爲什麼添加**動態碧玉**標籤?你在使用Java代碼嗎? – 2012-08-14 19:48:16

+0

@AlexK目前還沒有明確規定人們應該使用哪些標籤,dynamic-jasper!= jasper報告,但它們密切相關,擁有動態碧玉知識的人可能也會提供幫助,希望這有意義 – 2012-08-15 14:47:18

回答

0

我已經試過了拉伸類型,位置類型,海軍報等....底部,asTallest,所有諸如此類的事情,似乎沒有什麼工作

我所做的就是

  • 改變的高度圍繞所有我的頭球39 20
  • ReportElements和30至15
  • 增加一些寬度每個高度,確保它們足夠寬

高度15種強迫文本留在一行,給他們沒有空間浮動, 我覺得它是一種醜陋的修復,我的直覺告訴我,它不應該是最好的解決方案,但它的工作原理和我需要今天完成它。免費發佈答案,如果有效,我會接受你的,並且更優雅。

0

沒有看到您的JRXML文件,最好的猜測是兩件事情之一(或組合):

  • 你不必垂直對於字段1,2,8,9,10,對齊設置爲Bottom
  • 您沒有爲1,2,8,9,10設置相同的高度。

除了這兩者之外,您還沒有爲所有元素設置相同Top值的頂部。如果不能看到你的JRXML,這又是一個最好的猜測。如果這不是您需要發佈的內容之一,那麼我們可以提供幫助。

+0

nah,全部設置爲底部,但很棒的東西@jschoen,我的第一種方法是調整標誌和屬性,沒有工作,然後我試着用高度,它工作,但不是很好。 – 2012-08-15 14:49:48

0

請參閱Y位置。所有標題都不一樣。您將Y位置0設置爲1,2,8,9,10,並且y = 1表示剩餘項目。請確保所有位置相同。

相關問題