Boa Noite !
Gostaria de exportar meus relatórios para DOC/ODT/XML. para Excel e Pdf eu consigo na boa ! segue meu código que funciona, menos para os 3 ditos ai em cima !
meu MB
public StreamedContent downloadReportPdf() {
logger.debug("GERAR RELATORIO PDF");
InputStream stream = ReportService.getInstance()
.emiteRelatorioInstituicoesBancarias(listaInstituicoes, ReportService.FORMATO_PDF);
StreamedContent file = new DefaultStreamedContent(stream, "application/pdf", "report.pdf");
return file;
}
public StreamedContent downloadReportXls() {
logger.debug("GERAR RELATORIO XLS");
InputStream stream = ReportService.getInstance()
.emiteRelatorioInstituicoesBancarias(listaInstituicoes, ReportService.FORMATO_XLS);
StreamedContent file = new DefaultStreamedContent(stream, "application/vnd.ms-excel", "report.xls");
return file;
}
public StreamedContent downloadReportDoc() {
logger.debug("GERAR RELATORIO DOC");
InputStream stream = ReportService.getInstance()
.emiteRelatorioInstituicoesBancarias(listaInstituicoes, ReportService.FORMATO_DOC);
StreamedContent file = new DefaultStreamedContent(stream, "application/vnd.ms-word", "report.doc");
return file;
}
MEU xhtml
<p:panel header="#{label.general_Find}">
<h:panelGrid columns="2">
<h:panelGrid columns="2">
<h:outputText value="#{label.general_Keyword}" />
<p:inputText value="#{instituicaoBancariaMB.pesquisa}">
<f:ajax event="keyup" render="tabela" listener="#{instituicaoBancariaMB.pesquisar}" />
</p:inputText>
</h:panelGrid>
<h:panelGrid columns="2">
<h:commandLink id="downloadlinkPdf" title="Download PDF">
<p:graphicImage value="/images/icons/application_pdf.png" style="border:0"/>
<p:fileDownload value="#{instituicaoBancariaMB.downloadReportPdf()}" />
</h:commandLink>
<h:commandLink id="downloadlinkXls" title="Download XLS">
<p:graphicImage value="/images/icons/application_vnd.ms_excel.png" style="border:0"/>
<p:fileDownload value="#{instituicaoBancariaMB.downloadReportXls()}" />
</h:commandLink>
<h:commandLink id="downloadlinkDoc" title="Download Doc">
<p:graphicImage value="/images/icons/application_vnd.ms_excel.png" style="border:0"/>
<p:fileDownload value="#{instituicaoBancariaMB.downloadReportDoc()}" />
</h:commandLink>
</h:panelGrid>
</h:panelGrid>
</p:panel>