Jasper Book Table of content navigation in Docx export -
i generating jasper book table of contents , need export docx. problem when click on first level bookmark in toc, nothing happens. , when click second level label in toc jasper jumps cover page (in pdf export clicking second level label jumps right anchor in report). have anchor levels 1 , 2 , link target self type none. toc jrxml
<?xml version="1.0" encoding="utf-8"?> <!-- created jaspersoft studio version 6.4.0.final using jasperreports library version 6.4.1 --> <jasperreport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="tocreport"> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="dbone"/> <property name="com.jaspersoft.studio.unit." value="cm"/> <property name="net.sf.jasperreports.print.create.bookmarks" value="false"/> <template><![cdata[$p{resourcepath}+"berichtsformatvorlagen.jrtx"]]> </template> <parameter name="resourcepath" class="java.lang.string" isforprompting="false"> <defaultvalueexpression><![cdata[""]]></defaultvalueexpression> </parameter> <parameter name="stand" class="java.lang.string" isforprompting="false"/> <parameter name="erfassungsjahr" class="java.lang.string" isforprompting="false"/> <querystring> <![cdata[]]> </querystring> <field name="level" class="java.lang.integer"/> <field name="label" class="java.lang.string"/> <field name="pageindex" class="java.lang.integer"/> <variable name="level2index" class="java.lang.integer"> <variableexpression><![cdata[$f{level} == 1 ? 0 : ($f{level} == 2 ? ($v{level2index} + 1) : $v{level2index})]]></variableexpression> </variable> <background> <band splittype="stretch"/> </background> <pageheader> <band height="50"> <textfield> <reportelement style="formatvorlage standard (kleiner) + 9 pt." x="0" y="0" width="133" height="30" uuid="d0084fee-c683-41f4-b554-e86d94ed78e5"/> <textfieldexpression><![cdata["qa indicator"]]></textfieldexpression> </textfield> </band> </pageheader> <columnheader> <band height="50"> <textfield> <reportelement x="0" y="1" width="469" height="49" forecolor="#000000" uuid="24731f07-d115-4be4-a22c-aa9a4c3fc786"> <property name="local_mesure_unitwidth" value="pixel"/> <property name="com.jaspersoft.studio.unit.width" value="px"/> </reportelement> <box> <toppen linecolor="#a0d042"/> </box> <textelement textalignment="left"> <font size="35" isbold="true"/> </textelement> <textfieldexpression><![cdata["inhaltsverzeichnis"]]></textfieldexpression> </textfield> </band> </columnheader> <detail> <band height="20" splittype="stretch"> <property name="local_mesure_unitheight" value="pixel"/> <property name="com.jaspersoft.studio.unit.height" value="px"/> <printwhenexpression><![cdata[$f{level}==1]]></printwhenexpression> <textfield isstretchwithoverflow="true" evaluationtime="report"> <reportelement isprintrepeatedvalues="false" mode="opaque" x="10" y="0" width="389" height="20" uuid="b19a02f7-3d3f-4086-86ed-5dc6859e5fd1"/> <textelement textalignment="left"/> <textfieldexpression><![cdata[$f{label}]]></textfieldexpression> </textfield> <textfield> <reportelement x="399" y="0" width="70" height="20" uuid="bc43bd36-7466-457c-95e6-384410c05cbe"/> <textelement textalignment="right"/> <textfieldexpression><![cdata[$v{page_number} + ($f{pageindex}+2 )]]></textfieldexpression> </textfield> </band> <band height="28" splittype="stretch"> <property name="local_mesure_unitheight" value="pixel"/> <property name="com.jaspersoft.studio.unit.height" value="px"/> <printwhenexpression><![cdata[$f{level}==2]]></printwhenexpression> <textfield isstretchwithoverflow="true" hyperlinktype="localanchor"> <reportelement mode="opaque" x="21" y="5" width="376" height="20" uuid="379fcff2-021d-4761-a89a-eeb772723b1b"> <property name="local_mesure_unitheight" value="pixel"/> <property name="com.jaspersoft.studio.unit.height" value="px"/> <property name="com.jaspersoft.studio.unit.y" value="px"/> </reportelement> <box> <toppen linewidth="0.0" linestyle="solid" linecolor="#000000"/> <leftpen linewidth="0.0" linestyle="solid" linecolor="#000000"/> <bottompen linewidth="0.0" linestyle="solid" linecolor="#000000"/> <rightpen linewidth="0.0" linestyle="solid" linecolor="#000000"/> </box> <textelement textalignment="left" markup="styled"/> <textfieldexpression><![cdata[$f{label}]]></textfieldexpression> <hyperlinkanchorexpression><![cdata[$f{label}]]></hyperlinkanchorexpression> </textfield> <textfield> <reportelement x="398" y="4" width="71" height="21" uuid="207a4316-1f91-4886-91f9-9a86c788a83f"/> <textelement textalignment="right"/> <textfieldexpression><![cdata[($v{page_number} + $f{pageindex} + 2)]]></textfieldexpression> </textfield> </band> </detail> <pagefooter> <band height="15" splittype="stretch"> <textfield evaluationtime="master"> <reportelement style="fußzeile " isprintrepeatedvalues="false" x="389" y="2" width="80" height="12" uuid="f9665296-c4e6-4f16-9b33-50619eac6150"> <property name="com.jaspersoft.studio.unit.x" value="cm"/> </reportelement> <textelement textalignment="right"> <font size="7"/> </textelement> <textfieldexpression><![cdata[$v{master_current_page} != null ? $v{master_current_page} : $v{page_number}]]></textfieldexpression> </textfield> <textfield> <reportelement style="fußzeile " x="0" y="1" width="140" height="14" uuid="df8b430d-9e08-4c4d-9735-58c22a2332aa"/> <textfieldexpression><![cdata["© inst "+$p{year}]]></textfieldexpression> </textfield> <textfield isstretchwithoverflow="true"> <reportelement style="fußzeile " x="184" y="1" width="100" height="12" uuid="1dccae39-e129-4892-81cb-0a36e493b0ca"/> <textelement textalignment="left"/> <textfieldexpression><![cdata[" stand: " + $p{stand}]]></textfieldexpression> </textfield> </band> </pagefooter>
first level anchor part snippet:
<textfield isstretchwithoverflow="true" bookmarklevel="1"> <reportelement style="Überschrift 1" x="10" y="0" width="448" height="20" uuid="9c245808-6844-4ba6-a5b2-23e476834efb"/> <textelement textalignment="left"/> <textfieldexpression><![cdata[$f{ueberschrift}]]></textfieldexpression> <anchornameexpression><![cdata[$f{ueberschrift}]]></anchornameexpression> </textfield>
second level example:
<textfield isstretchwithoverflow="true" bookmarklevel="2"> <reportelement style="Überschrift 2" x="0" y="0" width="469" height="20" uuid="d6fbfb76-a764-4752-a996-95c1589a1ad5"> <property name="com.jaspersoft.studio.unit.width" value="cm"/> </reportelement> <box leftpadding="2"/> <textelement textalignment="left"/> <textfieldexpression><![cdata[$f{ueberschrift}]]></textfieldexpression> <anchornameexpression><![cdata[$f{ueberschrift}]]></anchornameexpression> <hyperlinkanchorexpression><![cdata[$f{qiid}]]></hyperlinkanchorexpression> </textfield>
the problem text shown in toc long jasper (longer 40 chars). toc label set bookmark level 0 , set hyperlink anchor expression to
$f{title}.length()>40?$f{title}.substring(0,39):$f{title}
text field looks like:
<textfield isstretchwithoverflow="true" isblankwhennull="true" hyperlinktype="localanchor"> <reportelement key="" style="standard 10pt." x="0" y="0" width="410" height="20" isremovelinewhenblank="true" uuid="b19a02f7-3d3f-4086-86ed-5dc6859e5fd1"/> <textelement textalignment="left"/> <textfieldexpression><![cdata[$f{label}]]></textfieldexpression> <hyperlinkanchorexpression><![cdata[$f{label}.length()>40?$f{label}.substring(0,39):$f{label}]]></hyperlinkanchorexpression> </textfield>
and need create text field without text , level 0 beside text field real text , set anchor name expression
$f{title}.length()>40?$f{title}.substring(0,39):$f{title}
now works docx export
Comments
Post a Comment