Package org.eclipse.birt.report.engine.api

Examples of org.eclipse.birt.report.engine.api.RenderOption


            Debug.logInfo("Set birt parameters:" + parameters, module);
            task.setParameterValues(parameters);
        }

        // set output options
        RenderOption options = new RenderOption();
        if ("text/html".equalsIgnoreCase(contentType)) {
            options.setOutputFormat(RenderOption.OUTPUT_FORMAT_HTML);
        } else if ("application/pdf".equalsIgnoreCase(contentType)) {
            options.setOutputFormat(RenderOption.OUTPUT_FORMAT_PDF);
        } else if ("application/vnd.ms-word".equalsIgnoreCase(contentType)) {
            options.setOutputFormat("doc");
        else if ("application/vnd.ms-excel".equalsIgnoreCase(contentType)) {
            options.setOutputFormat("xls");
        } else if ("application/vnd.ms-powerpoint".equalsIgnoreCase(contentType)) {
            options.setOutputFormat("ppt");
        } else {
            throw new GeneralException("Unknown content type : " + contentType);
        }

        if (options.getOutputFormat().equalsIgnoreCase(RenderOption.OUTPUT_FORMAT_HTML)) {
            // set html render options
            HTMLRenderOption htmlOptions = new HTMLRenderOption(options);
            htmlOptions.setImageDirectory(birtImageDirectory);
            htmlOptions.setBaseImageURL(birtImageDirectory);
            options.setImageHandler(imageHandler);
        } else if (options.getOutputFormat().equalsIgnoreCase(RenderOption.OUTPUT_FORMAT_PDF)) {
            // set pdf render options
            PDFRenderOption pdfOptions = new PDFRenderOption(options);
            pdfOptions.setOption(IPDFRenderOption.PAGE_OVERFLOW, Boolean.TRUE );
        } else if (options.getOutputFormat().equalsIgnoreCase("xls")) {
            // set excel render options
            new EXCELRenderOption(options);
        }
        options.setOutputStream(output);
        task.setRenderOption(options);

        // run report
        Debug.logInfo("Birt's locale is: " + task.getLocale(), module);
        Debug.logInfo("Run report's task", module);
View Full Code Here


            Debug.logInfo("Set BIRT parameters:" + parameters, module);
            task.setParameterValues(parameters);
        }

        // set output options
        RenderOption options = new RenderOption();
        if ("text/html".equalsIgnoreCase(contentType)) { // HTML
            options.setOutputFormat(RenderOption.OUTPUT_FORMAT_HTML);
            HTMLRenderOption htmlOptions = new HTMLRenderOption(options);
            htmlOptions.setImageDirectory(birtImageDirectory);
            htmlOptions.setBaseImageURL(birtImageDirectory);
            options.setImageHandler(imageHandler);
        } else if ("application/postscript".equalsIgnoreCase(contentType)) { // Post Script
            options.setOutputFormat("postscript");
        } else if ("application/pdf".equalsIgnoreCase(contentType)) { // PDF
            options.setOutputFormat(RenderOption.OUTPUT_FORMAT_PDF);
            PDFRenderOption pdfOptions = new PDFRenderOption(options);
            pdfOptions.setOption(IPDFRenderOption.PAGE_OVERFLOW, Boolean.TRUE );
        } else if ("application/vnd.ms-word".equalsIgnoreCase(contentType)) { // MS Word
            options.setOutputFormat("doc");
        else if ("application/vnd.ms-excel".equalsIgnoreCase(contentType)) { // MS Excel
            options.setOutputFormat("xls");
            new EXCELRenderOption(options);
        } else if ("application/vnd.ms-powerpoint".equalsIgnoreCase(contentType)) { // MS Power Point
            options.setOutputFormat("ppt");
        } else if ("application/vnd.oasis.opendocument.text".equalsIgnoreCase(contentType)) { // Open Document Text
            options.setOutputFormat("odt");
        } else if ("application/vnd.oasis.opendocument.spreadsheet".equalsIgnoreCase(contentType)) { // Open Document Spreadsheet
            options.setOutputFormat("ods");
        } else if ("application/vnd.oasis.opendocument.presentation".equalsIgnoreCase(contentType)) { // Open Document Presentation
            options.setOutputFormat("odp");
        } else {
            throw new GeneralException("Unknown content type : " + contentType);
        }

        options.setOutputStream(output);
        task.setRenderOption(options);

        // run report
        Debug.logInfo("BIRT's locale is: " + task.getLocale(), module);
        Debug.logInfo("Run report's task", module);
View Full Code Here

      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    Session session = ((org.hibernate.ejb.EntityManagerImpl) em).getSession();
    Connection connection = session.connection();
    task.getAppContext().put("OdaJDBCDriverPassInConnection", connection);
   
    IRenderOption options = new RenderOption();   
    if (outputFormat.equals(Constants.REPORT_OUTPUT_HTML)) {
      options.setOutputFormat("html");
      response.setContentType("text/html");
    }
    if (outputFormat.equals(Constants.REPORT_OUTPUT_PDF)) {
      options.setOutputFormat("pdf");
      response.setContentType("application/pdf");
    }
    options.setOutputStream(response.getOutputStream());
    task.setRenderOption(options);
    task.run();
  }
View Full Code Here

            Debug.logInfo("Set birt parameters:" + parameters, module);
            task.setParameterValues(parameters);
        }

        // set output options
        RenderOption options = new RenderOption();
        if ("text/html".equalsIgnoreCase(contentType)) {
            options.setOutputFormat(RenderOption.OUTPUT_FORMAT_HTML);
        } else if ("application/pdf".equalsIgnoreCase(contentType)) {
            options.setOutputFormat(RenderOption.OUTPUT_FORMAT_PDF);
        } else if ("application/vnd.ms-word".equalsIgnoreCase(contentType)) {
            options.setOutputFormat("doc");
        else if ("application/vnd.ms-excel".equalsIgnoreCase(contentType)) {
            options.setOutputFormat("xls");
        } else if ("application/vnd.ms-powerpoint".equalsIgnoreCase(contentType)) {
            options.setOutputFormat("ppt");
        } else {
            throw new GeneralException("Unknown content type : " + contentType);
        }

        if (options.getOutputFormat().equalsIgnoreCase(RenderOption.OUTPUT_FORMAT_HTML)) {
            // set html render options
            HTMLRenderOption htmlOptions = new HTMLRenderOption(options);
            htmlOptions.setImageDirectory(birtImageDirectory);
            htmlOptions.setBaseImageURL(birtImageDirectory);
            options.setImageHandler(imageHandler);
        } else if (options.getOutputFormat().equalsIgnoreCase(RenderOption.OUTPUT_FORMAT_PDF)) {
            // set pdf render options
            PDFRenderOption pdfOptions = new PDFRenderOption(options);
            pdfOptions.setOption(IPDFRenderOption.PAGE_OVERFLOW, Boolean.TRUE );
        } else if (options.getOutputFormat().equalsIgnoreCase("xls")) {
            // set excel render options
            EXCELRenderOption excelOptions = new EXCELRenderOption(options);
        }
        options.setOutputStream(output);
        task.setRenderOption(options);

        // run report
        Debug.logInfo("Birt's locale is: " + task.getLocale(), module);
        Debug.logInfo("Run report's task", module);
View Full Code Here

TOP

Related Classes of org.eclipse.birt.report.engine.api.RenderOption

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.