Search in sources :

Example 1 with RModelExcelExporter

use of org.compiere.report.core.RModelExcelExporter in project adempiere by adempiere.

the class AcctViewer method exportExcel.

//  actionRePost
/**
	 * Export to Excel
	 */
private void exportExcel() {
    RModel model = table.getRModel();
    if (model == null) {
        return;
    }
    try {
        RModelExcelExporter exporter = new RModelExcelExporter((RModel) model);
        exporter.export(null, null);
    } catch (Exception e) {
        ADialog.error(0, this, "Error", e.getLocalizedMessage());
        if (CLogMgt.isLevelFinest())
            e.printStackTrace();
    }
}
Also used : RModelExcelExporter(org.compiere.report.core.RModelExcelExporter) RModel(org.compiere.report.core.RModel)

Example 2 with RModelExcelExporter

use of org.compiere.report.core.RModelExcelExporter in project adempiere by adempiere.

the class WAcctViewer method actionExportExcel.

//FR[3435028]
/**
	 * Export to Excel
	 */
private void actionExportExcel() {
    RModel model = m_data.query();
    if (model == null) {
        return;
    }
    try {
        String path = System.getProperty("java.io.tmpdir");
        // getTitle will be null for embedded windows.
        String prefix = makePrefix(this.getTitle());
        if (prefix.equals(""))
            prefix = makePrefix(Msg.getMsg(Env.getCtx(), "InfoAccount"));
        if (log.isLoggable(Level.FINE)) {
            log.log(Level.FINE, "Path=" + path + " Prefix=" + prefix);
        }
        File file = File.createTempFile(prefix, ".xls", new File(path));
        RModelExcelExporter exporter = new RModelExcelExporter((RModel) model);
        exporter.export(file, null, false);
        //AMedia media = new AMedia(getTitle(), "xls", "application/msexcel", file, true);
        //Filedownload.save(media, getTitle() + "." + "xls");
        Filedownload.save(file, "application/msexcel");
    } catch (Exception e) {
        FDialog.error(0, this, "LoadError", e.getLocalizedMessage());
        if (CLogMgt.isLevelFinest())
            e.printStackTrace();
    }
}
Also used : RModelExcelExporter(org.compiere.report.core.RModelExcelExporter) RModel(org.compiere.report.core.RModel) File(java.io.File)

Aggregations

RModel (org.compiere.report.core.RModel)2 RModelExcelExporter (org.compiere.report.core.RModelExcelExporter)2 File (java.io.File)1