Jasper report using same template to render in CSV and PDF formats - jasper-reports

We are using one template to render the report in CSV and PDF format. But the problem is we need to have report split into pages in PDF but not in CSV. Is it possible to alter the rendering options based on the format in one template. So that we have CSV without pagination information and PDF divided into page. In such a case 2 separate templates one for CSV and one for PDF should be used? or this can be achieved using one template?

Finally found the answer. In the template following properties need to be set
<property name="net.sf.jasperreports.export.csv.exclude.origin.keep.first.band.columnHeader" value="columnHeader" />
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.columnFooter" value="columnFooter" />
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.pageFooter" value="pageFooter" />
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.lastPageFooter" value="lastPageFooter" />
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.summary" value="summary" />

Using JRCsvMetadataExporter solved similar problem. This class extracts the data from the template ignoring the rendering part. Check out the sample here

Related

In Filemaker, is it possible to import into Container fields from XML?

The XML FMPXMLRESULT grammar documentation states:
XML export does not support exporting container field data.
which seems to imply that it's possible to import (it does also specify that you can denote a field as type "CONTAINER" in the XML). However, I have found zero documentation as to how this might be done.
Is it possible? I get that there are ways of getting e.g. an image file into Filemaker after the fact, but can I just specify it in the XML beforehand, negating the need to have additional scripts or post-processing the import (not to mention something that works in Filemaker 11 or below)?
You can import file references, but not binary data. (And you'll have to specify the field as TEXT type in the XML file.) For example:
<?xml version="1.0" encoding="UTF-8"?>
<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
<ERRORCODE>0</ERRORCODE>
<PRODUCT BUILD="01-25-2011" NAME="FileMaker"
VERSION="ProAdvanced 11.0v3" />
<DATABASE DATEFORMAT="M/d/yyyy" TIMEFORMAT="h:mm:ss a"
LAYOUT="" NAME="" RECORDS="" />
<METADATA>
<FIELD EMPTYOK="YES" MAXREPEAT="1" TYPE="TEXT" NAME="Path" />
</METADATA>
<RESULTSET FOUND="">
<ROW>
<COL>
<DATA>image:test.jpg</DATA>
</COL>
</ROW>
</RESULTSET>
</FMPXMLRESULT>
The path must be in FileMaker format; here I used a relative path to test.jpg in the same directory as the file (will only work for local files), but it can also be an absolute path, e.g.:
imagewin:/C:/Some/Path/test.jpg
Your best option is probably to import Base64-encoded data, then use the Base64Decode function to decode it.
importing images, preferably from http
I am not sure what exactly that means. If your XML contains a link to an image, then the only thing you can do with it is import the link as text. If you are using version 12 or higher, you can follow this with the Insert From URL script step (for each imported record).

Can I use css3 in my Birt Report?

I want to use CSS3 in my Birt Report. But its showing the problem of CSS2.
A BIRT exception occurred.
Plug-in Provider:Eclipse BIRT Project
Plug-in Name:BIRT Model
Plug-in ID:org.eclipse.birt.report.model
Version:4.3.1.v201308301349
Error Code:Error.StyleSheetException.SYNTAX_ERROR
Error Message:There are some syntax errors inconsistent with CSS2.
So can anyone help me like how can I use my CSS3 file for my report. Is there any plugin or some steps then please let me know.
You can use css3 in html format only, by including the css file at viewtime. But it would be ignored by pdf & other formats.
For example, we are going to include this jquery-mobile theme at viewtime:
//ajax.googleapis.com/ajax/libs/jquerymobile/1.4.2/jquery.mobile.min.css
To test this example, add a BIRT text element in the report, set type to HTML and include fragment below:
<button data-icon="star" data-theme="a" data-form="ui-btn-up-a" class=" ui-btn ui-btn-a ui-icon-star ui-btn-icon-left ui-shadow ui-corner-all">Button</button>
Run the report, you will see a great jqueryMobile-like css3 button!
You can also load the external files in the clientScripts of the report using head.js. For example, in a report's clientScripts > clientInitialize event, add:
head.js("http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js",
"http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css");
In the XML source, this appears as the last line in the following code.
<?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.4.0.v20150206-1039 Build <4.2.3.v20150206-1039></property>
<property name="units">in</property>
<method name="clientInitialize"><![CDATA[head.js("http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js", "http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css");
]]></method>

Avoid generating header comments with Hibernate generation tools

When generating DTO objects, hibernate tools generate comments in the header:
// Generated 22 avr. 2013 20:29:27 by Hibernate Tools 3.4.0.CR1
Every generation the comments change (as they contains the generation date/time).
The problem is that in my SVN I end up having many non-usefull changes, so I have to check every single generated file to see whether to commit (if it contains actuals changes) or override it (if it's only the header).
Is there a way to avoid generating said header ?
Thank you.
You would have to customize the Freemarker template which is found in hibernate-tools.jar. Navigate to the /pojo/Pojo.ftl and remove the line // Generated ${date} by Hibernate Tools ${version}.
Checking this out might help: https://forum.hibernate.org/viewtopic.php?f=6&t=989777&view=next
An example of a Hibernate tool Ant task (by specifying templatepath and hbmtemplate attributes:
<hibernatetool destdir="hibernate-model-gen/pojo" templatepath="hibernate-model-gen/customized-templates">
<jdbcconfiguration configurationfile="hibernate-model-gen/hibernate.cfg.xml" packagename="open.pub.proto.core.model" revengfile="hibernate-model-gen\gen-conf\hibernate.reveng.xml" detectmanytomany="true" />
<hbmtemplate templateprefix="pojo/" template="pojo/Pojo.ftl" filepattern="{package-name}/{class-name}.java">
<property key="jdk5" value="true" />
<property key="ejb3" value="true" />
</hbmtemplate>
</hibernatetool>

Alfresco Share constraint default empty value

i have a simple question.
Is there a simple config file or line that can be edited in order to achieve this:
I need that constraints from Alfresco content model have an empty field (like "unselected") in Advanced Search and Edit Metadata forms.
So a constraint of:
<constraint name="custom:customList" type="LIST">
<parameter name="allowedValues">
<list>
<value>first type</value>
<value>second type</value>
</list>
</parameter>
</constraint>
I need to view these in a "SELECT" form but with the first selection empty, like:
<select>
<value></value>
<value>first type</value>
<value>second type</value>
</select>
Hope I made that clear.
P.S. I don't want to insert a in the custom content model XML file. There should be another way to achieve this.
Thanks to all.
You need to override the presentation logic, i.e. customize or create a new form control template. The default one is implemented in selectone.ftl, you can customize it or start from it for a brand new control template which you can later assign to your metadata field in the forms configuration.

removing group while doing CSV export in JasperReports 4.0.5

I am using the JasperReports 4.0.5. Trying to suppress group footer and headers while exporting to CSV.
I've tried the using of
net.sf.jasperreports.export.{format}.exclude.origin.{suffix}.{arbitrary_name} property.
It didn't work.
Any suggestions?
TU
For hiding only the groupHeader band you should add this two properties (both lines) to the jrxml file, for example:
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.1" value="groupHeader"/>
<property name="net.sf.jasperreports.export.csv.exclude.origin.group.1" value="GroupExpenses"/>
For hiding both groupHeader and groupFooter bands you should add all this properties to jrxml file:
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.1" value="groupHeader"/>
<property name="net.sf.jasperreports.export.csv.exclude.origin.group.1" value="GroupExpenses"/>
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.2" value="groupFooter"/>
<property name="net.sf.jasperreports.export.csv.exclude.origin.group.2" value="GroupExpenses"/>
In both samples the group name is GroupExpenses.
<group name="GroupExpenses">
For more details look at How can I suppress page headers and footers when exporting to XLS? topic.