fixes bug#11452

dev:Claudio
qua:Renato


git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@83114 d1611594-4594-4d17-8e1d-87c2c4800839
master
aristides 2018-07-04 13:45:40 +00:00
parent 69fb9713ff
commit 482d09a055
1 changed files with 45 additions and 30 deletions

View File

@ -6,12 +6,14 @@ import java.util.Locale;
import java.util.ResourceBundle;
import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.JRParagraph;
import net.sf.jasperreports.engine.JRParameter;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.export.JExcelApiExporter;
import net.sf.jasperreports.engine.export.JExcelApiExporterParameter;
import net.sf.jasperreports.engine.util.JRProperties;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
@ -63,14 +65,14 @@ public class RenderRelatorioJasper {
this.relatorio.getParametros().put(JRParameter.REPORT_RESOURCE_BUNDLE, resource);
/* Adicionar o arquivo de internacionalização para o subreporte quando informado */
if(this.relatorio.getNomeSubReporte() != null && this.relatorio.getNomeSubReporte().length > 0) {
if(this.relatorio.getNomeSubReporte().length == 1 && StringUtils.isNotBlank(this.relatorio.getNomeSubReporte()[0])) {
if (this.relatorio.getNomeSubReporte() != null && this.relatorio.getNomeSubReporte().length > 0) {
if (this.relatorio.getNomeSubReporte().length == 1 && StringUtils.isNotBlank(this.relatorio.getNomeSubReporte()[0])) {
ResourceBundle resourceSubReporte = ResourceBundle.getBundle("com.rjconsultores.ventaboletos.relatorios.internacionalizacao." + this.relatorio.getNomeSubReporte()[0], locale);
this.relatorio.getParametros().put("SUBREPORT_RESOURCE_BUNDLE", resourceSubReporte);
} else if(this.relatorio.getNomeSubReporte() != null && this.relatorio.getNomeSubReporte().length > 1) {
} else if (this.relatorio.getNomeSubReporte() != null && this.relatorio.getNomeSubReporte().length > 1) {
int indice = 0;
for (String nomeSubReporte : this.relatorio.getNomeSubReporte()) {
if(StringUtils.isNotBlank(nomeSubReporte)) {
if (StringUtils.isNotBlank(nomeSubReporte)) {
ResourceBundle resourceSubReporte = ResourceBundle.getBundle("com.rjconsultores.ventaboletos.relatorios.internacionalizacao." + nomeSubReporte, locale);
this.relatorio.getParametros().put("SUBREPORT_RESOURCE_BUNDLE" + "_" + (++indice), resourceSubReporte);
}
@ -78,7 +80,7 @@ public class RenderRelatorioJasper {
}
}
} catch (Exception e) {
log.error(e.getMessage(),e);
log.error(e.getMessage(), e);
}
}
@ -108,11 +110,15 @@ public class RenderRelatorioJasper {
this.preRender();
byte[] conteudo = null;
try {
if (this.jasperPrint == null) {
if (this.relatorio.isCollectionDataSource()) {
if (!StringUtils.isBlank(this.relatorio.getNome()) && this.relatorio.getNome().equalsIgnoreCase("RelatorioGratuidade")) {
JRProperties.setProperty(JRParagraph.DEFAULT_TAB_STOP_WIDTH, "10");
}
this.jasperPrint = JasperFillManager.fillReport(this.getTemplateInputStream(), this.relatorio.getParametros(), this.relatorio.getCollectionDataSource());
} else {
if (this.relatorio.isCustomDataSource())
this.jasperPrint = JasperFillManager.fillReport(this.getTemplateInputStream(), this.relatorio.getParametros(), (JRDataSource) this.relatorio.getCustomDataSource());
@ -133,6 +139,15 @@ public class RenderRelatorioJasper {
}
} catch (Exception e) {
// TODO: handle exception
throw new Exception();
} finally {
if (!StringUtils.isBlank(this.relatorio.getNome()) && this.relatorio.getNome().equalsIgnoreCase("RelatorioGratuidade")) {
JRProperties.setProperty(JRParagraph.DEFAULT_TAB_STOP_WIDTH, "40");
}
}
return conteudo;
}
@ -140,7 +155,7 @@ public class RenderRelatorioJasper {
JExcelApiExporter exporterXLS = new JExcelApiExporter();
ByteArrayOutputStream output = new ByteArrayOutputStream();
//As duas propriedades são para quando o arquivo xls chegar no máximo de linhas pular para a próxima aba do arquivo mantis #11294
// As duas propriedades são para quando o arquivo xls chegar no máximo de linhas pular para a próxima aba do arquivo mantis #11294
exporterXLS.setParameter(JExcelApiExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE);
exporterXLS.setParameter(JExcelApiExporterParameter.MAXIMUM_ROWS_PER_SHEET, 65500);