Examples of IRenderOption


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

      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

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

    String templateFileName = request.getParameter("template_file_name");
    logger.debug("templateFileName -- [" + templateFileName + "]");
    if (templateFileName == null || templateFileName.trim().equals(""))
      templateFileName = "report";
    IRenderOption renderOption = null;

    if (outputFormat != null && outputFormat.equalsIgnoreCase(IBirtConstants.PDF_RENDER_FORMAT)) {
      renderOption = new PDFRenderOption();
      renderOption.setOutputFormat(IBirtConstants.PDF_RENDER_FORMAT);
      //renderOption.setSupportedImageFormats("JPG;jpg;PNG;png;BMP;bmp;SVG;svg;GIF;gif");
      response.setContentType("application/pdf");
      response.setHeader("Content-disposition", "inline; filename=" + templateFileName + ".pdf");     
    } else if (outputFormat != null && outputFormat.equalsIgnoreCase(IBirtConstants.HTML_RENDER_FORMAT)) {
      renderOption = prepareHtmlRenderOption(servletContext, request);
      renderOption.setOutputFormat(IBirtConstants.HTML_RENDER_FORMAT);
      response.setHeader("Content-Type", "text/html");
      response.setContentType("text/html");
    } else if (outputFormat != null && outputFormat.equalsIgnoreCase(IBirtConstants.DOC_RENDER_FORMAT)) {
      renderOption = prepareHtmlRenderOption(servletContext, request);
      renderOption.setOutputFormat(IBirtConstants.DOC_RENDER_FORMAT);
      // renderOption.setOutputFileName(templateFileName + ".doc");
      response.setContentType("application/msword");
      response.setHeader("Content-disposition", "inline; filename=" + templateFileName + ".doc");
    } else if (outputFormat != null && outputFormat.equalsIgnoreCase(RTF_FORMAT)) {
      renderOption = prepareHtmlRenderOption(servletContext, request);
      renderOption.setOutputFormat(RTF_FORMAT);
      response.setContentType("application/rtf");
      response.setHeader("Content-disposition", "inline; filename=" + templateFileName + ".rtf");
    } else if (outputFormat != null && outputFormat.equalsIgnoreCase("xls")) {
      renderOption = prepareHtmlRenderOption(servletContext, request);
      renderOption.setOutputFormat("xls");
      // renderOption.setOutputFileName(templateFileName + ".xls");
      response.setContentType("application/vnd.ms-excel");
      response.setHeader("Content-disposition", "inline; filename=" + templateFileName + ".xls");
    } else if (outputFormat != null && outputFormat.equalsIgnoreCase("ppt")) {
      renderOption = prepareHtmlRenderOption(servletContext, request);
      renderOption.setOutputFormat("ppt");
      // renderOption.setOutputFileName(templateFileName + ".ppt");
      response.setContentType("application/vnd.ms-powerpoint");
      response.setHeader("Content-disposition", "inline; filename=" + templateFileName + ".ppt");
    } else if (outputFormat != null && outputFormat.equalsIgnoreCase(IBirtConstants.POSTSCRIPT_RENDER_FORMAT)) {
      renderOption = new PDFRenderOption();
      renderOption.setOutputFormat(IBirtConstants.POSTSCRIPT_RENDER_FORMAT);
      // renderOption.setOutputFileName(templateFileName + ".ps");
      response.setHeader("Content-disposition", "inline; filename=" + templateFileName + ".ps");
    } else if (outputFormat != null && outputFormat.equalsIgnoreCase(DataExtractionParameterUtil.EXTRACTION_FORMAT_CSV)) {
      logger.debug(" Output format parameter is CSV. Create document obj .");
      prepareCSVRender(reportParams, request, design, userId, documentId, profile, kpiUrl, response);
      return;
     
    }else {
      logger.debug(" Output format parameter not set or not valid. Using default output format: HTML.");
      outputFormat = IBirtConstants.HTML_RENDER_FORMAT;
      renderOption = prepareHtmlRenderOption(servletContext, request);
      renderOption.setOutputFormat(IBirtConstants.HTML_RENDER_FORMAT);
      response.setContentType("text/html");
      response.setHeader("Content-Type", "text/html");
    }

    Map userProfileAttrs = UserProfileUtils.getProfileAttributes( profile );
    Map context = getTaskContext(userId, params, request, resPathJNDI, userProfileAttrs);
    //Map context = BirtUtility.getAppContext(request);
    task.setAppContext(context);
    renderOption.setOutputStream((OutputStream) response.getOutputStream());
    task.setRenderOption(renderOption);
   
    // setting HTML header if output format is HTML: this is necessary in order to inject the document.domain directive
    // commented by Davide Zerbetto on 12/10/2009: there are problems with MIF (Ext ManagedIFrame library) library
    /*
 
View Full Code Here

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

        Object emitterOption = service.getEmitterConfig().get(XlsRenderer.XLS_IDENTIFIER);
        if (emitterOption instanceof Map) {
            value = ((Map) emitterOption).get(XlsEmitterConfig.KEY_LEGACY_MODE);
        }

        IRenderOption renderOption = service.getRenderOption();
        if (renderOption != null) {
            Object renderValue = renderOption.getOption(XlsEmitterConfig.KEY_LEGACY_MODE);

            if (renderValue != null) {
                value = renderValue;
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.