Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.6.0 -->
<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="ShapesReportMSOffice2007" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30" uuid="02560bcc-b1b2-464f-90a0-1e56616b66e1">
<property name="net.sf.jasperreports.export.xls.compatibility" value="msoffice2007"/>
<title>
<band height="782">
<line>
<reportElement x="0" y="50" width="200" height="1" uuid="409fe65d-91f6-4e4d-aba2-a9dad8137acc"/>
</line>
<staticText>
<reportElement x="210" y="50" width="340" height="40" uuid="4cb22491-9354-4668-a216-bcf300391ef1"/>
<text><![CDATA[<line><reportElement x="0" y="50" width="200" height="0"/></line>]]></text>
</staticText>
<line>
<reportElement x="0" y="100" width="200" height="40" uuid="7e389bc8-a8bb-458f-b290-ad67538857f8"/>
<graphicElement>
<pen lineWidth="2.0"/>
</graphicElement>
</line>
<staticText>
<reportElement x="210" y="100" width="340" height="40" uuid="47a5fc73-1466-4c66-aa68-102a3530a5f7"/>
<text><![CDATA[<line direction="TopDown"><reportElement x="0" y="100" width="200" height="40"/><graphicElement><pen lineWidth="2"/></graphicElement></line>]]></text>
</staticText>
<line direction="BottomUp">
<reportElement x="0" y="150" width="200" height="40" forecolor="#00FF00" uuid="862e5f68-d45a-4c40-a6d3-835a039b6a61"/>
<graphicElement>
<pen lineWidth="4.0"/>
</graphicElement>
</line>
<staticText>
<reportElement x="210" y="150" width="340" height="40" uuid="d02e6d0d-f499-49ac-9fec-8f2f88881f52"/>
<text><![CDATA[<line direction="BottomUp"><reportElement x="0" y="150" width="200" height="40" forecolor="green"/><graphicElement><pen lineWidth="4"/></graphicElement></line>]]></text>
</staticText>
<line>
<reportElement x="100" y="200" width="1" height="40" forecolor="#0000FF" uuid="b72ba1b1-ad13-471f-a9d3-ced9a2819641"/>
<graphicElement>
<pen lineWidth="1.0" lineStyle="Dashed"/>
</graphicElement>
</line>
<staticText>
<reportElement x="210" y="200" width="340" height="40" uuid="7ff2655b-97d3-4f28-922d-a380c6ec24e3"/>
<text><![CDATA[<line><reportElement x="100" y="200" width="0" height="40" forecolor="blue"/><graphicElement><pen lineWidth="1" lineStyle="Dashed"/></graphicElement></line>]]></text>
</staticText>
<rectangle>
<reportElement x="0" y="250" width="200" height="40" backcolor="#FFFF99" uuid="88282a3b-af28-4518-a316-1f49bf2e6420"/>
<graphicElement>
<pen lineWidth="0.0"/>
</graphicElement>
</rectangle>
<staticText>
<reportElement x="210" y="250" width="340" height="40" uuid="8644ce9d-d2d0-47bc-9e29-1a9c8f29c5ca"/>
<text><![CDATA[<rectangle><reportElement x="0" y="250" width="200" height="40" backcolor="#FFFF99"/><graphicElement><pen lineWidth="0"/></graphicElement></rectangle>]]></text>
</staticText>
<rectangle>
<reportElement x="0" y="300" width="200" height="40" uuid="e2556436-be36-4b35-8439-2d536e018235"/>
</rectangle>
<staticText>
<reportElement x="210" y="300" width="340" height="40" uuid="f8f9cc57-71c2-474b-84f7-c7335baeddfc"/>
<text><![CDATA[<rectangle><reportElement x="0" y="300" width="200" height="40"/><graphicElement><pen lineWidth="1"/></graphicElement></rectangle>]]></text>
</staticText>
<rectangle radius="15">
<reportElement x="0" y="350" width="200" height="40" backcolor="#FFFF00" uuid="86432e0c-bda7-4a01-8d62-669a09bbb6c1"/>
<graphicElement>
<pen lineWidth="2.0"/>
</graphicElement>
</rectangle>
<staticText>
<reportElement x="210" y="350" width="340" height="40" uuid="4c945c5f-296f-4e84-ad3a-6ef73a85d066"/>
<text><![CDATA[<rectangle radius="15"><reportElement x="0" y="350" width="200" height="40" backcolor="#FFFF00"/><graphicElement><pen lineWidth="2"/></graphicElement></rectangle>]]></text>
</staticText>
<rectangle>
<reportElement x="0" y="400" width="200" height="40" forecolor="#FF0000" backcolor="#00FFFF" uuid="22404d39-dacb-425e-b74b-cbfbcfec67a0"/>
<graphicElement>
<pen lineWidth="4.0"/>
</graphicElement>
</rectangle>
<staticText>
<reportElement x="210" y="400" width="340" height="40" uuid="0e0858c2-8a5a-4bf1-b71e-524d2b66f4f8"/>
<text><![CDATA[<rectangle><reportElement x="0" y="400" width="200" height="40" forecolor="red" backcolor="#00FFFF"/><graphicElement><pen lineWidth="4"/></graphicElement></rectangle>]]></text>
</staticText>
<rectangle>
<reportElement x="0" y="450" width="200" height="40" forecolor="#FF00FF" backcolor="#C0C0C0" uuid="f7e584bf-dd59-4ad4-8058-87e3a01b4424"/>
<graphicElement>
<pen lineWidth="1.0" lineStyle="Dashed"/>
</graphicElement>
</rectangle>
<staticText>
<reportElement x="210" y="450" width="340" height="40" uuid="456f90a3-c28b-4ec1-aefc-d8d872657653"/>
<text><![CDATA[<rectangle><reportElement x="0" y="450" width="200" height="40" forecolor="#FF00FF" backcolor="#C0C0C0"/><graphicElement><pen lineWidth="1" lineStyle="Dashed"/></graphicElement></rectangle>]]></text>
</staticText>
<rectangle>
<reportElement x="0" y="500" width="150" height="30" backcolor="#FFAABB" uuid="28f02797-c08d-48b1-af9c-01148d5eab2d"/>
<graphicElement>
<pen lineWidth="2.0"/>
</graphicElement>
</rectangle>
<rectangle>
<reportElement x="50" y="510" width="150" height="30" forecolor="#0000FF" uuid="d1c1a829-97b3-4331-ba52-e14a74b5fdf1"/>
<graphicElement>
<pen lineWidth="2.0"/>
</graphicElement>
</rectangle>
<staticText>
<reportElement x="210" y="500" width="340" height="40" uuid="10ffcc22-1a97-43e5-b721-1f0b7ddceb6a"/>
<text><![CDATA[<rectangle><reportElement x="50" y="510" width="150" height="30" forecolor="blue" mode="Opaque"/><graphicElement><pen lineWidth="2"/></graphicElement></rectangle>]]></text>
</staticText>
<rectangle>
<reportElement x="0" y="550" width="150" height="30" backcolor="#FFAABB" uuid="63cd0120-d0c4-434b-b456-b3f7840399be"/>
<graphicElement>
<pen lineWidth="2.0"/>
</graphicElement>
</rectangle>
<rectangle>
<reportElement mode="Transparent" x="50" y="560" width="150" height="30" forecolor="#0000FF" uuid="cdcb8329-d89b-45e4-ac51-2d77f3bc0237"/>
<graphicElement>
<pen lineWidth="2.0"/>
</graphicElement>
</rectangle>
<staticText>
<reportElement x="210" y="550" width="340" height="40" uuid="1bb8255a-d2e4-4b0c-9e4f-1d3d1d3bfb10"/>
<text><![CDATA[<rectangle><reportElement x="50" y="560" width="150" height="30" forecolor="blue" mode="Transparent"/><graphicElement><pen lineWidth="2"/></graphicElement></rectangle>]]></text>
</staticText>
<ellipse>
<reportElement x="0" y="600" width="200" height="40" forecolor="#FF0000" backcolor="#FFFF99" uuid="a20aa973-ef67-4101-8004-ef03b6574c36"/>
<graphicElement>
<pen lineWidth="2.0"/>
</graphicElement>
</ellipse>
<staticText>
<reportElement x="210" y="600" width="340" height="40" uuid="ff089b34-6810-4732-828d-bd47dac6e038"/>
<text><![CDATA[<ellipse><reportElement x="0" y="600" width="200" height="40" forecolor="red" backcolor="#FFFF99"/><graphicElement><pen lineWidth="2"/></graphicElement></ellipse>]]></text>
</staticText>
<ellipse>
<reportElement x="80" y="650" width="40" height="40" forecolor="#009900" backcolor="#99FFFF" uuid="045857bd-fb35-458a-9fd0-baf26200707f"/>
<graphicElement>
<pen lineWidth="2.0"/>
</graphicElement>
</ellipse>
<staticText>
<reportElement x="210" y="650" width="340" height="40" uuid="a113dbe9-5416-4f04-b832-93e753be60ea"/>
<text><![CDATA[<ellipse><reportElement x="80" y="650" width="40" height="40" forecolor="#009900" backcolor="#99FFFF"/><graphicElement><pen lineWidth="2"/></graphicElement></ellipse>]]></text>
</staticText>
</band>
</title>
</jasperReport>

85 changes: 55 additions & 30 deletions jasperreports/demo/samples/shapes/src/ShapesApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,18 @@ public void test() throws JRException
*/
public void fill() throws JRException
{
long start = System.currentTimeMillis();
JasperFillManager.fillReportToFile("build/reports/ShapesReport.jasper", null, (JRDataSource)null);
System.err.println("Filling time : " + (System.currentTimeMillis() - start));
File[] files = getFiles(new File("build/reports"), "jasper");
for(int i = 0; i < files.length; i++)
{
File reportFile = files[i];
long start = System.currentTimeMillis();
JasperFillManager.fillReportToFile(
reportFile.getAbsolutePath(),
null,
(JRDataSource)null
);
System.err.println("Report : " + reportFile + ". Filling time : " + (System.currentTimeMillis() - start));
}
}


Expand All @@ -97,9 +106,17 @@ public void fill() throws JRException
*/
public void print() throws JRException
{
long start = System.currentTimeMillis();
JasperPrintManager.printReport("build/reports/ShapesReport.jrprint", true);
System.err.println("Printing time : " + (System.currentTimeMillis() - start));
File[] files = getFiles(new File("build/reports"), "jrprint");
for(int i = 0; i < files.length; i++)
{
File reportFile = files[i];
long start = System.currentTimeMillis();
JasperPrintManager.printReport(
reportFile.getAbsolutePath(),
true
);
System.err.println("Report : " + reportFile + ". Printing time : " + (System.currentTimeMillis() - start));
}
}


Expand Down Expand Up @@ -175,24 +192,28 @@ public void html() throws JRException
*/
public void xls() throws JRException
{
long start = System.currentTimeMillis();
File sourceFile = new File("build/reports/ShapesReport.jrprint");
File[] files = getFiles(new File("build/reports"), "jrprint");
for(int i = 0; i < files.length; i++)
{
long start = System.currentTimeMillis();
File sourceFile = files[i];

JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);
JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xls");
File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xls");

JRXlsExporter exporter = new JRXlsExporter();
JRXlsExporter exporter = new JRXlsExporter();

exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile));
SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration();
configuration.setOnePagePerSheet(false);
exporter.setConfiguration(configuration);
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile));
SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration();
configuration.setOnePagePerSheet(false);
exporter.setConfiguration(configuration);

exporter.exportReport();
exporter.exportReport();

System.err.println("XLS creation time : " + (System.currentTimeMillis() - start));
System.err.println("Report : " + sourceFile + ". XLS creation time : " + (System.currentTimeMillis() - start));
}
}


Expand Down Expand Up @@ -293,24 +314,28 @@ public void docx() throws JRException
*/
public void xlsx() throws JRException
{
long start = System.currentTimeMillis();
File sourceFile = new File("build/reports/ShapesReport.jrprint");
File[] files = getFiles(new File("build/reports"), "jrprint");
for(int i = 0; i < files.length; i++)
{
long start = System.currentTimeMillis();
File sourceFile = files[i];

JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);
JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xlsx");
File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xlsx");

JRXlsxExporter exporter = new JRXlsxExporter();
JRXlsxExporter exporter = new JRXlsxExporter();

exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile));
SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration();
configuration.setOnePagePerSheet(false);
exporter.setConfiguration(configuration);
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile));
SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration();
configuration.setOnePagePerSheet(false);
exporter.setConfiguration(configuration);

exporter.exportReport();
exporter.exportReport();

System.err.println("XLSX creation time : " + (System.currentTimeMillis() - start));
System.err.println("Report : " + sourceFile + ". XLSX creation time : " + (System.currentTimeMillis() - start));
}
}


Expand Down
2 changes: 2 additions & 0 deletions jasperreports/src/default.jasperreports.properties
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ net.sf.jasperreports.export.xls.wrap.text=true
net.sf.jasperreports.export.xls.use.timezone=false
net.sf.jasperreports.export.xls.auto.fit.page.height=false
net.sf.jasperreports.export.xls.force.page.breaks=false
net.sf.jasperreports.export.xls.compatibility=none

# XML exporter settings
net.sf.jasperreports.export.xml.validation=true
Expand All @@ -137,6 +138,7 @@ net.sf.jasperreports.export.csv.write.header=false
# DOCX exporter settings
net.sf.jasperreports.export.docx.frames.as.nested.tables=true
net.sf.jasperreports.export.docx.flexible.row.height=false
net.sf.jasperreports.export.docx.compatibility=none

# Properties to be transferred in the generated document
net.sf.jasperreports.print.transfer.awt=net.sf.jasperreports.awt
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* JasperReports - Free Java Reporting Library.
* Copyright (C) 2001 - 2019 TIBCO Software Inc. All rights reserved.
* http://www.jaspersoft.com
*
* Unless you have purchased a commercial license agreement from Jaspersoft,
* the following license terms apply:
*
* This program is part of JasperReports.
*
* JasperReports is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* JasperReports is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
*/
package net.sf.jasperreports.engine.export;

/*
* Contributor:
* Hitoshi Ozawa https://github.com/ozawa-hi/jasperreports
*/
public enum ExportCompatibility
{
NONE,
MSOFFICE2007;

public static ExportCompatibility getCompatibility(String name) {
try {
return ExportCompatibility.valueOf(name.toUpperCase());
} catch (IllegalArgumentException e) {
}
return NONE;
}
}
Loading