2017-12-06 34 views
1

jasper studio 6.4.3에서 목차를 만들려고합니다. 점으로 구분 된 TOC 여야합니다. 즉 레이블 텍스트 필드와 점으로 채워진 페이지 번호 텍스트 사이의 공백을 채워야합니다. 내가 가진 해결책은 두 가지 문제가 있습니다.점선이있는 Jaspersoft 스튜디오에서 목차 만들기

첫째 : 필드 둘째

에있는 텍스트의 길이를 따라 볼 수있는 반 점이있다 : 내가 스트레칭 후 레이블 정렬 된 점과 페이지 번호 필드를 얻을 수 없습니다. 점에 대한 해결책은 텍스트 필드 뒤의 정적 인 텍스트 필드를 사용하고 텍스트 필드 배경을 with로 설정하여 텍스트 뒤에있는 점들을 포함합니다.

enter image description here

<band height="31" splitType="Stretch"> 
     <property name="local_mesure_unitheight" value="pixel"/> 
     <property name="com.jaspersoft.studio.unit.height" value="px"/> 
     <printWhenExpression><![CDATA[$F{level} == 1]]></printWhenExpression> 
     <staticText> 
      <reportElement style="InhaltsverzeichnisPunkte" mode="Transparent" x="0" y="1" width="440" height="18" uuid="b08b479c-10a8-4d87-8507-4f32fd50004f"/> 
      <text><![CDATA[. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .]]></text> 
     </staticText> 
     <textField isStretchWithOverflow="true"> 
      <reportElement style="InhaltsverzeichnisPunkte" x="396" y="1" width="45" height="18" uuid="bc43bd36-7466-457c-95e6-384410c05cbe"/> 
      <textElement textAlignment="Right"/> 
      <textFieldExpression><![CDATA["<style backcolor='white'>"+($V{PAGE_NUMBER} + $F{pageIndex} + 3)+"</style>"]]></textFieldExpression> 
     </textField> 
     <textField isStretchWithOverflow="true" hyperlinkType="LocalAnchor"> 
      <reportElement style="Formatvorlage Standard (kleiner) + 10 Pt." mode="Transparent" x="0" y="3" width="396" height="15" uuid="b19a02f7-3d3f-4086-86ed-5dc6859e5fd1"/> 
      <textElement textAlignment="Left" markup="styled"/> 
      <textFieldExpression><![CDATA["<style backcolor='white'>"+$F{label}+"</style>"]]></textFieldExpression> 
      <hyperlinkAnchorExpression><![CDATA[$F{label}]]></hyperlinkAnchorExpression> 
     </textField> 
    </band> 

당신은 사진, 페이지 번호 6 필요에 볼 수 있으며 점은 텍스트 필드에서 두 번째 줄에 정렬 나타납니다되어야하고, 문자 g 후 점은입니다으로 절단.

답변

1

당신은 거의 당신이 원하는 것을 얻을 수 있습니다

  • verticalAlignment 설정합니다 '점선'STATICTEXT하고 '페이지 인덱스'의 TextField 요소에 대한
  • stretchType 세트 ContainerBottom 모든 텍스트 요소에 대한 Bottom

과 같이 :

<band height="39" splitType="Stretch"> 
<staticText> 
    <reportElement stretchType="ContainerBottom" mode="Transparent" x="0" y="1" width="440" height="18" uuid="b08b479c-10a8-4d87-8507-4f32fd50004f"/> 
    <textElement verticalAlignment="Bottom"/> 
    <text><![CDATA[. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .]]></text> 
</staticText> 
<textField isStretchWithOverflow="true"> 
    <reportElement stretchType="ContainerBottom" x="396" y="1" width="45" height="18" uuid="bc43bd36-7466-457c-95e6-384410c05cbe"/> 
    <textElement textAlignment="Right" verticalAlignment="Bottom" markup="styled"/> 
    <textFieldExpression><![CDATA["<style backcolor='white'>"+($V{PAGE_NUMBER} + $F{pageIndex} + 3)+"</style>"]]></textFieldExpression> 
</textField> 
<textField isStretchWithOverflow="true" hyperlinkType="LocalAnchor"> 
    <reportElement mode="Transparent" x="0" y="3" width="396" height="16" uuid="b19a02f7-3d3f-4086-86ed-5dc6859e5fd1"> 
     <property name="com.jaspersoft.studio.unit.height" value="px"/> 
    </reportElement> 
    <textElement textAlignment="Left" verticalAlignment="Bottom" markup="styled"/> 
    <textFieldExpression><![CDATA["<style backcolor='white'>"+$F{label}+"</style>"]]></textFieldExpression> 
    <hyperlinkAnchorExpression><![CDATA[$F{label}]]></hyperlinkAnchorExpression> 
</textField> 

출력 : enter image description here

참고 : 텍스트 요소가 겹쳐 있기 때문에

  • 당신은 아직 경험 점 '잘라 내기'를 할 수 있습니다. 나는 이것을위한 다른 접근법을 생각할 수 없다.
  • 스타일을 제거하고 요소의 높이를 적절하게 조정하여 코드를 조정했습니다.