How to avoid row splitting for jasper-report excel export - jasper-reports

I'm trying to create Jasper Report with 2 tables in Detail band and export it into 3 formats (PDF, DOCX and XLS), and there is an issue with 2nd table when exporting to XLS:
The table's row may take the height of 2 pages (last column field's content can be really large). So for DOCX and PDF formats it is totally okay that the export result has 2 pages containing similar row with the only difference in the last column value - first and second part of the column value after splitting. I am using pagination for this formats.
In XLS file such behavior is confusing - first column value is logically unique, but because of splitting it contains 2 lines in a row with the same 'unique' value. I set this property to avoid pagination for this format:
<property name="net.sf.jasperreports.export.xls.paginated" value="false"/>
The result looks like this:
duplicate for split row
I would like to join this to rows values. Maybe there is a way to merge such rows specially in XLS format. Please, help to find a workaround.
My report level properties are:
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.1" value="pageHeader"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.2" value="columnHeader"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.2" value="pageFooter"/>
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.rows" value="true"/>
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.columns" value="true"/>
<property name="net.sf.jasperreports.export.xls.exclude.key.padding"/>
<property name="net.sf.jasperreports.export.xls.exclude.key.pages"/>
<property name="net.sf.jasperreports.export.xls.collapse.row.span" value="false"/>
<property name="net.sf.jasperreports.export.xls.collapse.column.span" value="false"/>
<property name="net.sf.jasperreports.export.xls.white.page.background" value="false"/>
<property name="net.sf.jasperreports.export.xls.detect.cell.type" value="true"/>
<property name="net.sf.jasperreports.export.xls.ignore.cell.border" value="false"/>
<property name="net.sf.jasperreports.export.xls.font.size.fix.enabled" value="true"/>
<property name="net.sf.jasperreports.print.keep.full.text" value="true"/>
<property name="net.sf.jasperreports.consume.space.on.overflow" value="true"/>
<property name="net.sf.jasperreports.export.xls.paginated" value="false"/>
<property name="net.sf.jasperreports.export.docx.frames.as.tables" value="false"/>
Properties for the last column text field:
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/>
<property name="net.sf.jasperreports.export.xls.wrap.text" value="true"/>
Thanks in advance!

Set Detail band property "Split Type" to "Prevent"
https://community.jaspersoft.com/wiki/set-detail-band-property-split-type-prevent

Related

Understanding CQ5 Lucene indexing rule

Information:
I have provided an indexing configuration file to cq5. I have not indexed on the property cq:template by specifying the following rule:
<index-rule nodeType="nt:base">
<property nodeScopeIndex="false">cq:template</property>
</index-rule>
I rebuilt the index.The logs show re-indexing is properly done.
The problem I am facing:
When I execute the following SQL2 query, it gives me the same results as it would give without the above indexing rule:
SELECT s.[cq:template] FROM [nt:base] AS s WHERE s.[cq:template] like '/apps/geometrixx/templates/contentpage'
Your rule actually omits all properties from the index except for cq:template rule (and excludes cq:template from the fulltext index because you defined nodeScopeIndex="false"). See the jackrabbit documentation for more details.
When you define the element <property nodeScopeIndex="false">cq:template</property>, the system includes the property in the index. However, nodeScopeIndex="false" tells CRX/Jackrabbit not to include the property in the fulltext index. Meaning it would be available for all searches except for those using contains(...) in sql or jcr:contains(...) for xpath.
To avoid indexing a property entirely, omit it from the first index-rule with nodeType/condition attributes that match its node. It must be the first matching rule because the rules in index_config.xml file are processed top down.
So to remove the cq:template property from the index in CQ5, do the following:
Extract the out of the box CQ5 version of indexing_config.xml (See this documentation for instructions)
Remove the <property nodeScopeIndex="false">cq:tempate</property> from <index-rule nodeType="nt:base">
Change the regular expression in the last rule <property isRegexp="true"> from .*:.* to ^(?!cq:template).*:.*$:
After you make the changes, the index-rule should look like this:
<index-rule nodeType="nt:base">
<property nodeScopeIndex="false">analyticsProvider</property>
<property nodeScopeIndex="false">analyticsSnippet</property>
<property nodeScopeIndex="false">hideInNav</property>
<property nodeScopeIndex="false">offTime</property>
<property nodeScopeIndex="false">onTime</property>
<property nodeScopeIndex="false">cq:allowedTemplates</property>
<property nodeScopeIndex="false">cq:childrenOrder</property>
<property nodeScopeIndex="false">cq:cugEnabled</property>
<property nodeScopeIndex="false">cq:cugPrincipals</property>
<property nodeScopeIndex="false">cq:cugRealm</property>
<property nodeScopeIndex="false">cq:designPath</property>
<property nodeScopeIndex="false">cq:isCancelledForChildren</property>
<property nodeScopeIndex="false">cq:isDeep</property>
<property nodeScopeIndex="false">cq:lastModified</property>
<property nodeScopeIndex="false">cq:lastModifiedBy</property>
<property nodeScopeIndex="false">cq:lastPublished</property>
<property nodeScopeIndex="false">cq:lastPublishedBy</property>
<property nodeScopeIndex="false">cq:lastReplicated</property>
<property nodeScopeIndex="false">cq:lastReplicatedBy</property>
<property nodeScopeIndex="false">cq:lastReplicationAction</property>
<property nodeScopeIndex="false">cq:lastReplicationStatus</property>
<property nodeScopeIndex="false">cq:lastRolledout</property>
<property nodeScopeIndex="false">cq:lastRolledoutBy</property>
<property nodeScopeIndex="false">cq:name</property>
<property nodeScopeIndex="false">cq:parentPath</property>
<property nodeScopeIndex="false">cq:segments</property>
<property nodeScopeIndex="false">cq:siblingOrder</property>
<property nodeScopeIndex="false">cq:template</property>
<property nodeScopeIndex="false">cq:trigger</property>
<property nodeScopeIndex="false">cq:versionComment</property>
<property nodeScopeIndex="false">jcr:createdBy</property>
<property nodeScopeIndex="false">jcr:lastModifiedBy</property>
<property nodeScopeIndex="false">sling:alias</property>
<property nodeScopeIndex="false">sling:resourceType</property>
<property nodeScopeIndex="false">sling:vanityPath</property>
<property isRegexp="true">^(?!cq:template).*:.*$</property>
</index-rule>
Note of warning:
I'm not sure if it is safe to remove cq:template from the search index as the product code may use it in some way. As a best practice, it is recommended to only exclude custom application properties. Also, you must include properties in the fulltext index which contain references to other content paths. This is because when you move a page in CQ5 (AEM) then it does a jcr:contains search to see where that page is referenced. So if you exclude such properties with nodeScopeIndex="false" or by modifying the regular expression above to omit them then the reference search will fail. Then you end up with stale references to old paths.
References:
Official indexing_config.xml reference: http://wiki.apache.org/jackrabbit/IndexingConfiguration
Instructions on how to update indexing_config.xml in CQ5: http://helpx.adobe.com/experience-manager/kb/SearchIndexingConfig.html

Jasper Reports - Removing pageHeader/columnHeader from subreport

I have a master report with 2 subreports. I use the same report to generate PDF and xls. Pagination is enabled but for excel, i need to disable pagination, which i do by rendering all in one sheet. The page header/column header get repeat for each page. These page header/column header are from the sub reports. This is fine for PDF but in case of excel, i want to get rid of the repeating header.
I set these properties:
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.3" value="pageHeader" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.3" value="pageHeader" />
<property name="net.sf.jasperreports.export.pdf.exclude.origin.keep.first.band.1" value="pageHeader" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.1" value="columnHeader" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.1" value="columnHeader" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.2" value="pageFooter" />
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.rows" value="true" />
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.columns" value="true" />
But these arent reflected in the data rendered by the subreport. In xls, i still see the pageHeader/columnHeader gets repeated. Please let me know, how to fix this.
For XLS (and HTML) reports, you may want to set the parameter IS_IGNORE_PAGINATION to true. See http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRParameter.html for documentation.
I know this is an old question, but I keep forgetting how to do this myself and each time I search I seem to find this question so thought I'd put something so I find it next time.
In the main report file you also need to add the sub report to the filter:
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.1" value="columnHeader" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.1" value="columnHeader" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.report.1" value="sub-report-name" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.report.1" value="sub-report-name" />

Send data as XML, not PDF, to a JSP from form build in Form Builder

I have used a workflow-send button to submit form data in XML format to a JSP file. However, it saves data as a PDF as opposed to XML string.
I know it is PDF because I get <?xml version="1.0" encoding="UTF-8"?><url>/xforms-server/dynamic/e9002cb0ce38d116e3037bb622050a36</url> on sysout in the JSP.
My properties-local.xml contains the following entries:
<property as="xs:string" name="oxf.xforms.format.input.date" value="[D]/[M]/[Y]"/>
<property as="xs:boolean" name="oxf.fr.email.attach-pdf" value="false"/>
<property as="xs:boolean" name="oxf.fr.alfresco.send-pdf" value="false"/>
<property as="xs:boolean" name="oxf.fr.detail.send.pdf" value="false"/>
<property as="xs:boolean" name="oxf.fr.detail.send.alfresco" value="false"/>
<property as="xs:boolean" name="oxf.fr.detail.send.email" value="false"/>
<property as="xs:string" name="oxf.fr.detail.buttons.*.*" value="workflow-send"/>
<property as="xs:string" name="oxf.fr.detail.send.success.method.*.*" value="post"/>
<property as="xs:anyURI" name="oxf.fr.detail.send.uri.*.*" value="http://localhost:8080/orbeon/xforms-jsp/idm/idm-customer.jsp"/>
<property as="xs:NMTOKENS" name="oxf.xforms.logging.debug" value="document model submission control event action analysis server html submission-details"/>
How can I get the data in XML format instead of a PDF?
According to the documentation on the workflow-send, the PDF is generated if either one of the following properties is true: oxf.fr.detail.send.pdf, oxf.fr.email.attach-pdf, or oxf.fr.alfresco.send-pdf. You don't seem to have any of those properties set to true, so the XML (not the PDF) of the form should be sent to the service you specified. I suspect that you might be using a version of Orbeon Forms that pre-dates the introduction of some of those properties. If you are not on version 3.9, I would suggest you upgrade to 3.9 (or newer). If you are on 3.9 or newer, then please post a comment and we'll try to help.

How can I make a GtkTreeView work with a vertical scrollbar in Glade3?

I'm using glade 3, to create TreeView and successfully added row as algorithm done, but I had a little issue because treeview will add new row, thus my "GUI" will getting longer to the below, how could I add the scrollbar for this TreeView? in order to make my "GUI" not getting any longer?
Note: I have added "a new adjustment" and connected it for TreeView and ScrollBar vertical as well, but still not get the job done.
any idea?
Try putting your TreeView into a GtkScrolledWindow. E.g.:
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<child>
<object class="GtkTreeView" id="items_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">list_items</property>
</object>
</child>
</object>
</child>

Why is the first toolbar button automatically selected when my gtk application loads?

When my gtk application loads, the first item on the toolbar is automatically selected (it is highlighted, it is pressed when it hit enter). This is just a minor problem, but I would prefer for nothing to be selected by default.
Here is some basic sample code:
import gtk
import gtk.glade
window_tree = gtk.glade.XML('testtoolbar.glade')
gtk.main()
testtoolbar.glade
<?xml version="1.0"?>
<glade-interface>
<!-- interface-requires gtk+ 2.16 -->
<!-- interface-naming-policy project-wide -->
<widget class="GtkWindow" id="window1">
<property name="width_request">200</property>
<property name="visible">True</property>
<child>
<widget class="GtkToolbar" id="toolbar1">
<property name="visible">True</property>
<child>
<widget class="GtkToolButton" id="toolbutton1">
<property name="visible">True</property>
<property name="label" translatable="yes">toolbutton1</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-new</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton2">
<property name="visible">True</property>
<property name="label" translatable="yes">toolbutton2</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-open</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>
This is probably just GTK+ handing the focus to some widget, it likes to have a widget focused if possible.
You can use grab_focus() to move the focus elsewhere, to get the desired behavior. If the toolbar is all the widgetry you have, it might be hard to find a suitable focus "target", though.
gtk.ToolButton inherits gtk.Bin.
gtk.Bin is an abstract base class defining a widget that is a container with just one child.
So button is a container and
btn.set_can_focus(False)
will not work.
You need
btn.set_focus_chain([])
or for every button in toolbar
toolbar.foreach(lambda x: x.set_focus_chain([]))
You can always add a widget and make it invisible, and transfer focus to it. Though I don't really find this to be an issue or know of anyone else who did.
It has focus because it is the 1st widget in your app. If you use glade, you can set "Has focus" to 'Yes' to any other widget and the toolbar will automatically lose focus on startup.