Jasper/iReport - Extra long text does not display properly in excel export - jasper-reports

I have a field with excessively long text. When I export the jasper report as xls, the row height does not extend to display the entire content.
Althought the text is present in the cell, the row height needs to be manually increased to see the entire content.
I am using Jasper report version 6.10 and have set the following properties
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="net.sf.jasperreports.export.xls.show.gridlines" value="true"/>
<property name="net.sf.jasperreports.export.xls.one.page.per.sheet" value="false"/>
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.columns" value="true"/>
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.rows" value="true"/>
<property name="net.sf.jasperreports.export.xls.white.page.background" value="true"/>
<property name="net.sf.jasperreports.export.xls.detect.cell.type" value="true"/>
<property name="net.sf.jasperreports.print.keep.full.text" value="true"/>
<property name="net.sf.jasperreports.export.xls.fit.width" value="1"/>
<property name="net.sf.jasperreports.export.xls.wrap.text" value="true"/>
<property name="net.sf.jasperreports.export.xls.print.page.top.margin" value="40"/>
<property name="net.sf.jasperreports.export.xls.print.page.bottom.margin" value="40"/>
<property name="net.sf.jasperreports.export.xls.print.page.left.margin" value="36"/>
<property name="net.sf.jasperreports.export.xls.print.page.right.margin" value="36"/>
<property name="net.sf.jasperreports.export.xls.freeze.row" value="2"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.page.height" value="false"/>
<property name="net.sf.jasperreports.export.xls.fit.height" value="0"/>
Please suggest how I can fix this issue.

Use following properties in Report Element
<staticText>
<reportElement x="0" y="100" width="100" height="20">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/>
</reportElement>
<textElement/>
<text>
<![CDATA[Your Static Text]]>
</text>
</staticText>
Also I'd recommend you to try using net.sf.jasperreports.export.xls.column.width property, which is more useful. Reference: http://jasperreports.sourceforge.net/config.reference.html

Related

JasperReports: xsd for custom component not found

I made a new chart type as custom component for JasperReports.
I inserted my custom component into the jrxml but Jaspersoft Studio says it cannot find the xsd:
net.sf.jasperreports.engine.JRRuntimeException: Unknown entity http://jasperreports.sourceforge.net/xsd/blockchart.xsd, not loading.
I checked that the jar file contains blockchart.xsd.
And the schema location is defined in the blockchart_beans.xml:
<bean id="xmlParser" class="net.sf.jasperreports.engine.component.DefaultComponentXmlParser">
<property name="namespace">
<value>http://jasperreports.sourceforge.net/jasperreports/blockchart</value>
</property>
<property name="publicSchemaLocation">
<value>http://jasperreports.sourceforge.net/xsd/blockchart.xsd</value>
</property>
<property name="internalSchemaResource">
<value>de/xyz/jasperreports/blockchart/blockchart.xsd</value>
</property>
<property name="digesterConfigurer">
<bean class="de.xyz.jasperreports.blockchart.BlockChartsDigester"/>
</property>
</bean>
My jrxml:
<componentElement>
<reportElement x="0" y="0" width="800" height="510" uuid="550e8442-e29b-11d4-a716-446655440042" />
<bc:blockChart evaluationTime="Group" evaluationGroup="mygroup"
xmlns:bc="http://jasperreports.sourceforge.net/jasperreports/blockchart"
xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/blockchart http://jasperreports.sourceforge.net/xsd/blockchart.xsd">
<bc:chartSettings customizerClass="de.xyz.jasper.Report1ChartCustomizer">
</bc:blockChart>
</componentElement>
Why does Jaspersoft Studio not find my xsd? Any idea what I could have missed?

gtk/glade expandable toolbar

I guess I have a unique problem.
I am trying to create a horizontal toolbar like widget that can can hold labels, buttons, and other gtk widgets. I want to pack as much info as I can but I also need it to work for various screen sizes.
Ultimately I'm trying to anticipate the GUI being ran on smaller screens so most of the widgets I want to use cannot actually fit because they take too much space all together.
But I still want to make them available to the user so I figured I could have two or three rows of widgets. Putting the most used at the top.
Ultimately, I'd like the user to be able to add different widgets at runtime depending on what they want(sort of like how you can sometimes customize headers for lists in some programs... e.g., windows explorer's file lists).
Now, I want some widgets to take up a lot of space if it is available and some are fixed in size. This way, the space is optimally used. If a person is running the app on a large LCD monitor, they could pack more widgets and if it is not, they could remove them.
Basically it sorta like a flow control but different. I was using a horizontal box but realized the limitations of this quickly. Mainly that I could not resize my window smaller than what the total width which might make the app too large to fit on a smaller window.
I'm trying to minimize the amount of work as I don't wanna reimplement glade in to the program. OTH, I suppose I could create different glade interfaces for different devices... probably be the easiest thing. If the user really wants to customize the interface they could do it manually. It requires extra programming work since I have to worry about missing widgets and all that but should be less worrying.
I'd rather have a more useful method though. Any ideas?
The widgets that make up my "toolbar" are images, buttons, labels, drawing areas, and a few other standard gtk widgets. Some will need to take up as much horizontal space as they can while others will be fixed in size. All will have the same vertical size.
Some elements will have fixed positions such as the far right and left and not change.
I should probably be a bit more clear
X Y Z * * * * A B C
* * * * * * * * * *
XYZ and ABC are going to be fixed widgets that must show up and to the far left and right resp.
are widgets I want to be configurable. Some will need to expand to use the maximum size they can(And share with others that also need to expand) and some will be fixed. Ultimately the user should be able to add and remove the * widgets without issue and reorder them if they want. They add to many they should flow down so that the X Y Z and A B C widgets always are shown.
Not sure about your goals but to get something similar to your drawing, an approach, would be, to use some GtkToolbar/Gtk.Toolbar packed on a GtkGrid/Gtk.Grid or GtkBox/Gtk.Box.
The first and the last Toolbars would have the show_arrow property set to False while the one(s) in the middle would have it set as True.
With a setup like this, the toolbar(s) in the middle would shrink and show an arrow that allows the user to select the packed widgets.
GtkToolbar/Gtk.Toolbar allows the use of all kinds of widgets even custom ones.
Here's a simple example:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkWindow">
<property name="can_focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkToolbar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="show_arrow">False</property>
<child>
<object class="GtkToolButton">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">__glade_unnamed_7</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-about</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">__glade_unnamed_8</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-add</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">__glade_unnamed_9</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-go-back</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkToolbar" id="10297 927030981 28.68">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkToolButton">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">buttonOrWidget</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">AnotherButton</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">YetAnotherButton</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkToolbar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="show_arrow">False</property>
<child>
<object class="GtkToolButton">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">__glade_unnamed_10</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-justify-center</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">__glade_unnamed_11</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-clear</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">__glade_unnamed_12</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-connect</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-missing-image</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
The result (with the middle toolbar totally shrinked):
Growing the application window will permit some of the widgets to start showing and if there are more, unshown, widgets then the expander sign will still show:
Resizing the window the window to full extent and beyond will spermit to show all the widgets and the expander will disappear:
You can pack Toolbars as needed to achieve your goals.
Not sure this is what you're after though.

how to exclude title band in jasper reports when exported as excel

I have this at top of my jrxml
<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="LineChart01" pageWidth="1400" pageHeight="842" columnWidth="1360" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="70d31602-bfb5-4388-9d80-87ea7a72f43d">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="NEW_DATAADAPTER.xml"/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
<property name="removeEmptySpaceBetweenRows" value="true"/>
<property name="removeEmptySpaceBetweenColumns" value="true"/>
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.title" value="title"/>
<!-- more records ... -->
</jasperReport>
How can I exclude the title band? I tried this. In that link question have few properties to hide some bands those didn't work for me.
Is your title band contains subreport? If yes then you need to use this
<property name="net.sf.jasperreports.export.xlsx.exclude.origin.report.(sameValue)" value="Actual Sub Report Name"/>
<property name="net.sf.jasperreports.export.xlsx.exclude.origin.band.(sameValue)" value="detail"/>
You can change xlsx with pdf, csv, xls etc. I have used detail as value in my second property because my subreport contains only detail band. You can change this with your subreport band.

How do I properly setup SQL logging for EclipseLink?

I want to see the generated SQL statements from EclipseLink. The persistence.xml contains the following properties:
<properties>
<property name="eclipselink.logging.file" value="/workspace/logs/JPA.log" />
<property name="eclipselink.logging.level" value="ALL" />
<property name="eclipselink.logging.level.sql" value="ALL" />
<property name="eclipselink.logging.logger" value="JavaLogger"/>
<property name="eclipselink.logging.parameters" value="true"/>
<property name="javax.persistence.jdbc.driver" value="org.mariadb.jdbc.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:mariadb://192.168.178.42:3306/halsol" />
<property name="javax.persistence.jdbc.user" value="user" />
<property name="javax.persistence.jdbc.password" value="pw" />
<property name="jdbc.persistence.logging" value="true" />
<property name="jdbc.persistence.logfile" value="/workspace/logs/JDBC.log" />
</properties>
The file "JPA.log" gets generated (as well as JDBC.log) but is has no contents after loading some rows from the database. I'm using EclipseLink 2.5.
I tried the same properties you have, it should work if you remove the following line:
<property name="eclipselink.logging.logger" value="JavaLogger"/>
The eclipselink.logging.logger parameter is provided for overriding default eclipselink logger.
Try either not setting this property or setting up java.util.logging within your application.

BIRT Report Unable to run

I'm completely new to BIRT, but I'm trying to integrate it into some testing software. I downloaded the all-in-one package from eclipse for BIRT reporting (Windows 7, 64 bit). I've just started on my first report and I can't get the preview tab to display anything nor the web viewer. The only content on my report is a simple label. Is there something I'm doing wrong?
Here's my source xml for the report:
<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.23" id="1">
<property name="createdBy">Eclipse BIRT Designer Version 4.3.1.v201309091055 Build <4.3.1.v20130917-1035></property>
<property name="units">in</property>
<property name="iconFile">/templates/blank_report.gif</property>
<property name="bidiLayoutOrientation">ltr</property>
<property name="imageDPI">96</property>
<styles>
<style name="report" id="4">
<property name="fontFamily">sans-serif</property>
<property name="fontSize">10pt</property>
</style>
<style name="crosstab-cell" id="5">
<property name="borderBottomColor">#CCCCCC</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">1pt</property>
<property name="borderLeftColor">#CCCCCC</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">1pt</property>
<property name="borderRightColor">#CCCCCC</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">1pt</property>
<property name="borderTopColor">#CCCCCC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">1pt</property>
</style>
<style name="crosstab" id="6">
<property name="borderBottomColor">#CCCCCC</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">1pt</property>
<property name="borderLeftColor">#CCCCCC</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">1pt</property>
<property name="borderRightColor">#CCCCCC</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">1pt</property>
<property name="borderTopColor">#CCCCCC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">1pt</property>
</style>
</styles>
<page-setup>
<simple-master-page name="Simple MasterPage" id="2">
<page-footer>
<text id="3">
<property name="contentType">html</property>
<text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property>
</text>
</page-footer>
</simple-master-page>
</page-setup>
<body>
<label id="7">
<text-property name="text">BRIEF PRODUCT TEST REPORT</text-property>
</label>
</body>
</report>
Found the issue, seems like BIRT uses Internet Explorer to render the report and is apparently incompatible with Internet Explorer 11. Downgrading IE solved my problem