• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PdfReportUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.PdfReportUtil的典型用法代码示例。如果您正苦于以下问题:Java PdfReportUtil类的具体用法?Java PdfReportUtil怎么用?Java PdfReportUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PdfReportUtil类属于org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf包,在下文中一共展示了PdfReportUtil类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: render

import org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.PdfReportUtil; //导入依赖的package包/类
public void render() throws Exception {
	
	createReport();

	switch(options.getOutputType()) {
	case PDF: 
		PdfReportUtil.createPDF(report, targetFilename);
		break;
	case DOC: 
		RTFReportUtil.createRTF(report, targetFilename);
		break;
	case XLS: 
		ExcelReportUtil.createXLS(report, targetFilename);
		break;
	case HTML:
		HtmlReportUtil.createDirectoryHTML(report, targetFilename);
		break;
	case CSV: 
		CSVReportUtil.createCSV(report, targetFilename);
		break;
	}
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:23,代码来源:KettleReportBuilder.java


示例2: doPost

import org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.PdfReportUtil; //导入依赖的package包/类
@Override
public void doPost(
  HttpServletRequest request, 
  HttpServletResponse response)
  throws ServletException, IOException
{

  // Prpt file.
  String reportPath = "file:" + this.getServletContext().getRealPath("WEB-INF/classes/reports/my_first_report.prpt");

  try 
  {

    // Resource manager.
    ResourceManager manager = new ResourceManager();
    manager.registerDefaults();

    // Get report.
    Resource res = manager.createDirectly(new URL(reportPath), MasterReport.class);
    MasterReport report = (MasterReport) res.getResource();

    // Generate report in PDF into the response.
    response.setContentType("application/pdf");
    PdfReportUtil.createPDF(report, response.getOutputStream());

  }
  catch (Exception e)
  {
      e.printStackTrace();
  }
}
 
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:32,代码来源:PentahoServlet2.java


示例3: render

import org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.PdfReportUtil; //导入依赖的package包/类
public void render() throws Exception {

    createReport();

    ClassLoader originalClassloader = Thread.currentThread().getContextClassLoader();

    try {
      // we need to change the current classloader for the reporting to find our plugin classes
      Thread.currentThread().setContextClassLoader( KettleReportBuilder.class.getClassLoader() );

      switch ( options.getOutputType() ) {
        case PDF:
          PdfReportUtil.createPDF( report, targetFilename );
          break;
        case DOC:
          RTFReportUtil.createRTF( report, targetFilename );
          break;
        case XLS:
          ExcelReportUtil.createXLS( report, targetFilename );
          break;
        case HTML:
          HtmlReportUtil.createDirectoryHTML( report, targetFilename );
          break;
        case CSV:
          CSVReportUtil.createCSV( report, targetFilename );
          break;
        default:
          break;
      }
    } finally {
      Thread.currentThread().setContextClassLoader( originalClassloader );
    }
  }
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:34,代码来源:KettleReportBuilder.java


示例4: testExportToPdf

import org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.PdfReportUtil; //导入依赖的package包/类
public void testExportToPdf() throws ReportProcessingException, IOException
{
  File f = new File ("test-output");
  f.mkdirs();

  MasterReport report = new MasterReport();
  report.getReportHeader().addElement(createElement());

  PdfReportUtil.createPDF(report, "test-output/sample-text-element.pdf");
}
 
开发者ID:tmorgner,项目名称:pentaho-reporting-oem-sdk,代码行数:11,代码来源:SampleTextElementTest.java


示例5: testExportToPdf

import org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.PdfReportUtil; //导入依赖的package包/类
public void testExportToPdf() throws ReportProcessingException, IOException
{
  File f = new File ("test-output");
  f.mkdirs();

  MasterReport report = new MasterReport();
  report.getReportHeader().addElement(createElement());

  PdfReportUtil.createPDF(report, "test-output/sample-graphics-element.pdf");
}
 
开发者ID:tmorgner,项目名称:pentaho-reporting-oem-sdk,代码行数:11,代码来源:SampleGraphicsElementTest.java


示例6: doPost

import org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.PdfReportUtil; //导入依赖的package包/类
@Override
public void doPost(
  HttpServletRequest request, 
  HttpServletResponse response)
  throws ServletException, IOException 
{

  try {

    // Declaring a report.
    MasterReport report = new MasterReport();

    // Loading the Table DataFactory.
    DefaultTableModel tableModel = new DefaultTableModel(
      new Object[][] {
        {"Product A", 123},
        {"Product B", 234},
        {"Product C", 345},
        {"Product D", 456}
      },
  	new String[] {"Product", "Cost"});
    TableDataFactory dataFactory = new TableDataFactory();
    dataFactory.addTable("default", tableModel);
    report.setDataFactory(dataFactory);

    // Getting the item band to host the elements.
    ItemBand itemBand = report.getItemBand();

    // Adding a text field for the product name, added to the item band.
    TextFieldElementFactory textFactory = new TextFieldElementFactory(); 
    textFactory.setFieldname("Product");
    textFactory.setX(1f);
    textFactory.setY(1f); 
    textFactory.setMinimumWidth(200f);
    textFactory.setMinimumHeight(20f);
    Element nameField = textFactory.createElement(); 
    itemBand.addElement(nameField);

    // Adding a number filed with the total cost of the products.
    NumberFieldElementFactory numberFactory = new NumberFieldElementFactory();
    numberFactory.setFieldname("Cost");
    numberFactory.setX(201f);
    numberFactory.setY(1f);
    numberFactory.setMinimumWidth(100f);
    numberFactory.setMinimumHeight(20f);
    Element totalCost = numberFactory.createElement();
    itemBand.addElement(totalCost);

    // Conversion to PDF and rendering.
    response.setContentType("application/pdf");
    PdfReportUtil.createPDF(report, response.getOutputStream());

  }
  catch (Exception e) 
  {
      e.printStackTrace();
  }
}
 
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:59,代码来源:PentahoServlet.java


示例7: doPost

import org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.PdfReportUtil; //导入依赖的package包/类
@Override
public void doPost(
  HttpServletRequest request, 
  HttpServletResponse response)
  throws ServletException, IOException 
{

  try {

    // Declaring a report.
    MasterReport report = new MasterReport();

    // Loading OLAP data.
    DriverConnectionProvider provider = new DriverConnectionProvider();
    provider.setDriver("mondrian.olap4j.MondrianOlap4jDriver");
    provider.setUrl("jdbc:mondrian: ");
    provider.setProperty("Catalog", "./resources/steelwheels.mondrian.xml");
    provider.setProperty("JdbcUser", "pentaho_user");
    provider.setProperty("JdbcPassword", "password");
    provider.setProperty("Jdbc", "jdbc:hsqldb:./resources/sampledata/sampledata");
    provider.setProperty("JdbcDrivers", "org.hsqldb.jdbcDriver");

    // Creating the factory.
    BandedMDXDataFactory factory = new BandedMDXDataFactory(provider);
    factory.setQuery("default", "SELECT {[Measures].[Sales]} ON COLUMNS, {Descendants([Time].Children, [Time].[Months])} ON ROWS FROM [SteelWheelsSales]");
    report.setDataFactory(factory);

    // Getting the item band to host the elements.
    ItemBand itemBand = report.getItemBand();

    // Adding a text field for the product name, added to the item band.
    TextFieldElementFactory textFactory = new TextFieldElementFactory(); 
    textFactory.setFieldname("[Time].[Months]");
    textFactory.setX(1f);
    textFactory.setY(1f); 
    textFactory.setMinimumWidth(200f);
    textFactory.setMinimumHeight(20f);
    Element nameField = textFactory.createElement(); 
    itemBand.addElement(nameField);

    // Adding a number filed with the total cost of the products.
    NumberFieldElementFactory numberFactory = new NumberFieldElementFactory();
    numberFactory.setFieldname("[Measures].[Sales]");
    numberFactory.setX(201f);
    numberFactory.setY(1f);
    numberFactory.setMinimumWidth(100f);
    numberFactory.setMinimumHeight(20f);
    Element totalCost = numberFactory.createElement();
    itemBand.addElement(totalCost);

    // Conversion to PDF and rendering.
    response.setContentType("application/pdf");
    PdfReportUtil.createPDF(report, response.getOutputStream());

  }
  catch (Exception e) 
  {
      e.printStackTrace();
  }
}
 
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:61,代码来源:PentahoServlet.java


示例8: doPost

import org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.PdfReportUtil; //导入依赖的package包/类
@Override
public void doPost(
  HttpServletRequest request, 
  HttpServletResponse response)
  throws ServletException, IOException 
{

  try {

    // Declaring a report.
    MasterReport report = new MasterReport();

    // Load report xpath data.
    XPathDataFactory factory = new XPathDataFactory();
    factory.setXqueryDataFile("file:./resources/xpathexample.xml");
    factory.setQuery("default", "/ExampleResultSet/Row", false);
    report.setDataFactory(factory);

    // Getting the item band to host the elements.
    ItemBand itemBand = report.getItemBand();

    // Adding a text field for the product name, added to the item band.
    TextFieldElementFactory textFactory = new TextFieldElementFactory(); 
    textFactory.setFieldname("NAME");
    textFactory.setX(1f);
    textFactory.setY(1f); 
    textFactory.setMinimumWidth(200f);
    textFactory.setMinimumHeight(20f);
    Element nameField = textFactory.createElement(); 
    itemBand.addElement(nameField);

    // Adding a number filed with the total cost of the products.
    NumberFieldElementFactory numberFactory = new NumberFieldElementFactory();
    numberFactory.setFieldname("SIZE");
    numberFactory.setX(201f);
    numberFactory.setY(1f);
    numberFactory.setMinimumWidth(100f);
    numberFactory.setMinimumHeight(20f);
    Element totalCost = numberFactory.createElement();
    itemBand.addElement(totalCost);

    // Conversion to PDF and rendering.
    response.setContentType("application/pdf");
    PdfReportUtil.createPDF(report, response.getOutputStream());

  }
  catch (Exception e) 
  {
      e.printStackTrace();
  }
}
 
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:52,代码来源:PentahoServlet.java


示例9: doPost

import org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.PdfReportUtil; //导入依赖的package包/类
@Override
public void doPost(
  HttpServletRequest request, 
  HttpServletResponse response)
  throws ServletException, IOException 
{

  try {

    // Declaring a report.
    MasterReport report = new MasterReport();

    // Loading MQL data source.
    PmdDataFactory factory = new PmdDataFactory();
    factory.setConnectionProvider(new PmdConnectionProvider());
    factory.setXmiFile("resources/metadata.xmi");
    factory.setDomainId("test");
    factory.setQuery(
      "default",
      "<?xml version='1.0' encoding='UTF-8'?>" + 
      "<mql>" + 
        "<domain_id>test</domain_id>" + 
        "<model_id>BV_ORDERS</model_id>" + 
        "<options>" + 
          "<disable_distinct>false</disable_distinct>" + 
          "<limit>-1</limit>" + 
        "</options>" + 
        "<selections>" + 
          "<selection>" + 
            "<view>CAT_PRODUCTS</view>" + 
            "<column>BC_PRODUCTS_PRODUCTNAME</column>" + 
            "<aggregation>NONE</aggregation>" + 
          "</selection>" + 
          "<selection>" + 
            "<view>CAT_PRODUCTS</view>" + 
            "<column>BC_PRODUCTS_MSRP</column>" + 
            "<aggregation>AVERAGE</aggregation>" + 
          "</selection>" + 
        "</selections>" + 
        "<constraints/>" + 
        "<orders/>" + 
      "</mql>",
      null,
      null);

    report.setDataFactory(factory);

    // Getting the item band to host the elements.
    ItemBand itemBand = report.getItemBand();

    // Adding a text field for the product name, added to the item band.
    TextFieldElementFactory textFactory = new TextFieldElementFactory(); 
    textFactory.setFieldname("BC_PRODUCTS_PRODUCTNAME");
    textFactory.setX(1f);
    textFactory.setY(1f); 
    textFactory.setMinimumWidth(200f);
    textFactory.setMinimumHeight(20f);
    Element nameField = textFactory.createElement(); 
    itemBand.addElement(nameField);

    // Adding a number filed with the total cost of the products.
    NumberFieldElementFactory numberFactory = new NumberFieldElementFactory();
    numberFactory.setFieldname("BC_PRODUCTS_MSRP");
    numberFactory.setX(201f);
    numberFactory.setY(1f);
    numberFactory.setMinimumWidth(100f);
    numberFactory.setMinimumHeight(20f);
    Element totalCost = numberFactory.createElement();
    itemBand.addElement(totalCost);

    // Conversion to PDF and rendering.
    response.setContentType("application/pdf");
    PdfReportUtil.createPDF(report, response.getOutputStream());

  }
  catch (Exception e) 
  {
      e.printStackTrace();
  }
}
 
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:81,代码来源:PentahoServlet.java


示例10: doPost

import org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.PdfReportUtil; //导入依赖的package包/类
@Override
public void doPost(
  HttpServletRequest request, 
  HttpServletResponse response)
  throws ServletException, IOException 
{

  try {

    // Declaring a report.
    MasterReport report = new MasterReport();

    // Data source provider.
    DriverDataSourceProvider dsProvider = new DriverDataSourceProvider();
    dsProvider.setDriver("org.hsqldb.jdbcDriver");
    dsProvider.setProperty("user", "pentaho_user");
    dsProvider.setProperty("password", "password");
    dsProvider.setUrl("jdbc:hsqldb:./resources/sampledata/sampledata");

    // Mondrian cube provider.
    DefaultCubeFileProvider cubeProvider = new DefaultCubeFileProvider();
    cubeProvider.setMondrianCubeFile("./resources/steelwheels.mondrian.xml");

    // Loading Mondrian data source.
    BandedMDXDataFactory factory = new BandedMDXDataFactory();
    factory.setDataSourceProvider(dsProvider);
    factory.setCubeFileProvider(cubeProvider);
    factory.setQuery("default", "SELECT {[Measures].[Sales]} ON COLUMNS, {Descendants([Time].Children, [Time].[Months])} ON ROWS FROM [SteelWheelsSales]");
    report.setDataFactory(factory);

    // Getting the item band to host the elements.
    ItemBand itemBand = report.getItemBand();

    // Adding a text field for the product name, added to the item band.
    TextFieldElementFactory textFactory = new TextFieldElementFactory(); 
    textFactory.setFieldname("[Time].[Months]");
    textFactory.setX(1f);
    textFactory.setY(1f); 
    textFactory.setMinimumWidth(200f);
    textFactory.setMinimumHeight(20f);
    Element nameField = textFactory.createElement(); 
    itemBand.addElement(nameField);

    // Adding a number filed with the total cost of the products.
    NumberFieldElementFactory numberFactory = new NumberFieldElementFactory();
    numberFactory.setFieldname("[Measures].[Sales]");
    numberFactory.setX(201f);
    numberFactory.setY(1f);
    numberFactory.setMinimumWidth(100f);
    numberFactory.setMinimumHeight(20f);
    Element totalCost = numberFactory.createElement();
    itemBand.addElement(totalCost);

    // Conversion to PDF and rendering.
    response.setContentType("application/pdf");
    PdfReportUtil.createPDF(report, response.getOutputStream());

  }
  catch (Exception e) 
  {
      e.printStackTrace();
  }
}
 
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:64,代码来源:PentahoServlet.java


示例11: doPost

import org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.PdfReportUtil; //导入依赖的package包/类
@Override
public void doPost(
  HttpServletRequest request, 
  HttpServletResponse response)
  throws ServletException, IOException 
{

  try {

    // Declaring a report.
    MasterReport report = new MasterReport();

    // Loading Kettle data source.
    KettleTransFromFileProducer producer = new KettleTransFromFileProducer (
      "resources/CSV Input - Reading customer data.ktr",
      "Dummy (do nothing)",
      new FormulaArgument[0], 
      new FormulaParameter[0]);
    KettleDataFactory factory = new KettleDataFactory();
    factory.setQuery("default", producer);
    report.setDataFactory(factory);

    // Getting the item band to host the elements.
    ItemBand itemBand = report.getItemBand();

    // Adding a text field for the product name, added to the item band.
    TextFieldElementFactory textFactory = new TextFieldElementFactory(); 
    textFactory.setFieldname("name");
    textFactory.setX(1f);
    textFactory.setY(1f); 
    textFactory.setMinimumWidth(200f);
    textFactory.setMinimumHeight(20f);
    Element nameField = textFactory.createElement(); 
    itemBand.addElement(nameField);

    // Adding a number filed with the total cost of the products.
    NumberFieldElementFactory numberFactory = new NumberFieldElementFactory();
    numberFactory.setFieldname("id");
    numberFactory.setX(201f);
    numberFactory.setY(1f);
    numberFactory.setMinimumWidth(100f);
    numberFactory.setMinimumHeight(20f);
    Element totalCost = numberFactory.createElement();
    itemBand.addElement(totalCost);

    // Conversion to PDF and rendering.
    response.setContentType("application/pdf");
    PdfReportUtil.createPDF(report, response.getOutputStream());

  }
  catch (Exception e) 
  {
      e.printStackTrace();
  }
}
 
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:56,代码来源:PentahoServlet.java


示例12: doPost

import org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.PdfReportUtil; //导入依赖的package包/类
@Override
public void doPost(
  HttpServletRequest request, 
  HttpServletResponse response)
  throws ServletException, IOException 
{

  try {

    // Declaring a report.
    MasterReport report = new MasterReport();

    // Defining the connection provider.
    DriverConnectionProvider provider = new DriverConnectionProvider();
    provider.setDriver("org.hsqldb.jdbcDriver");
    provider.setProperty("user", "pentaho_user");
    provider.setProperty("password", "password");
    provider.setUrl("jdbc:hsqldb:./resources/sampledata/sampledata");

    // Defining the query.
    SQLReportDataFactory dataFactory = new SQLReportDataFactory(provider);
    String sqlQuery = "SELECT PRODUCTNAME, QUANTITYINSTOCK FROM PRODUCTS";
    dataFactory.setQuery("default", sqlQuery);
    report.setDataFactory(dataFactory);

    // Getting the item band to host the elements.
    ItemBand itemBand = report.getItemBand();

    // Adding a text field for the product name, added to the item band.
    TextFieldElementFactory textFactory = new TextFieldElementFactory(); 
    textFactory.setFieldname("PRODUCTNAME");
    textFactory.setX(1f);
    textFactory.setY(1f); 
    textFactory.setMinimumWidth(200f);
    textFactory.setMinimumHeight(20f);
    Element nameField = textFactory.createElement(); 
    itemBand.addElement(nameField);

    // Adding a number filed with the quantity in stock of the products.
    NumberFieldElementFactory numberFactory = new NumberFieldElementFactory();
    numberFactory.setFieldname("QUANTITYINSTOCK");
    numberFactory.setX(201f);
    numberFactory.setY(1f);
    numberFactory.setMinimumWidth(100f);
    numberFactory.setMinimumHeight(20f);
    Element totalCost = numberFactory.createElement();
    itemBand.addElement(totalCost);

    // Conversion to PDF and rendering.
    response.setContentType("application/pdf");
    PdfReportUtil.createPDF(report, response.getOutputStream());

  }
  catch (Exception e) 
  {
      e.printStackTrace();
  }
}
 
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:59,代码来源:PentahoServlet.java


示例13: doPost

import org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.PdfReportUtil; //导入依赖的package包/类
@Override
public void doPost(
  HttpServletRequest request, 
  HttpServletResponse response)
  throws ServletException, IOException 
{

  try {

    // Declaring a report.
    MasterReport report = new MasterReport();

    // Defining the connection provider.
    Connection connection = DriverManager.getConnection("jdbc:hsqldb:./resources/sampledata/sampledata", "pentaho_user", "password");
    StaticConnectionProvider provider = new StaticConnectionProvider(connection);

    // Defining the query.
    SQLReportDataFactory dataFactory = new SQLReportDataFactory(provider);
    String sqlQuery = "SELECT PRODUCTNAME, QUANTITYINSTOCK FROM PRODUCTS";
    dataFactory.setQuery("default", sqlQuery);
    report.setDataFactory(dataFactory);

    // Getting the item band to host the elements.
    ItemBand itemBand = report.getItemBand();

    // Adding a text field for the product name, added to the item band.
    TextFieldElementFactory textFactory = new TextFieldElementFactory(); 
    textFactory.setFieldname("PRODUCTNAME");
    textFactory.setX(1f);
    textFactory.setY(1f); 
    textFactory.setMinimumWidth(200f);
    textFactory.setMinimumHeight(20f);
    Element nameField = textFactory.createElement(); 
    itemBand.addElement(nameField);

    // Adding a number filed with the total cost of the products.
    NumberFieldElementFactory numberFactory = new NumberFieldElementFactory();
    numberFactory.setFieldname("QUANTITYINSTOCK");
    numberFactory.setX(201f);
    numberFactory.setY(1f);
    numberFactory.setMinimumWidth(100f);
    numberFactory.setMinimumHeight(20f);
    Element totalCost = numberFactory.createElement();
    itemBand.addElement(totalCost);

    // Conversion to PDF and rendering.
    response.setContentType("application/pdf");
    PdfReportUtil.createPDF(report, response.getOutputStream());

  }
  catch (Exception e) 
  {
      e.printStackTrace();
  }
}
 
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:56,代码来源:PentahoServlet.java


示例14: doPost

import org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.PdfReportUtil; //导入依赖的package包/类
@Override
public void doPost(
  HttpServletRequest request, 
  HttpServletResponse response)
  throws ServletException, IOException 
{

  try {

    // Declaring a report.
    MasterReport report = new MasterReport();

    // Data source provider.
    DriverDataSourceProvider dsProvider = new DriverDataSourceProvider();
    dsProvider.setDriver("org.hsqldb.jdbcDriver");
    dsProvider.setProperty("user", "pentaho_user");
    dsProvider.setProperty("password", "password");
    dsProvider.setUrl("jdbc:hsqldb:./resources/sampledata/sampledata");

    // Mondrian cube provider.
    DefaultCubeFileProvider cubeProvider = new DefaultCubeFileProvider();
    cubeProvider.setMondrianCubeFile("./resources/steelwheels.mondrian.xml");

    // Loading Mondrian data source.
    BandedMDXDataFactory factory = new BandedMDXDataFactory();
    factory.setDataSourceProvider(dsProvider);
    factory.setCubeFileProvider(cubeProvider);
    factory.setQuery("default", "SELECT CrossJoin([Markets].Children, [Time].Children) ON ROWS, [Measures].[Sales] ON COLUMNS FROM [SteelWheelsSales]");
    report.setDataFactory(factory);

    // Defining the crosstab.
    CrosstabGroup crosstabGroup = new CrosstabGroup(); 

    // Defining the crosstab rows.
    CrosstabRowGroupBody rowBody = (CrosstabRowGroupBody) crosstabGroup.getBody(); 
    CrosstabRowGroup rowGroup = rowBody.getGroup();
    rowGroup.setField( "[Markets].[Territory]" );
    rowGroup.getTitleHeader().addElement( createDataItem( "[Markets].[Territory]" ) ); 
    rowGroup.getHeader().addElement( createFieldItem( "[Markets].[Territory]" ) ); 
 
    // Defining the crosstab columns.
    CrosstabColumnGroupBody columnGroupBody = (CrosstabColumnGroupBody) rowGroup.getBody(); 
    CrosstabColumnGroup columnGroup = columnGroupBody.getGroup(); 
    columnGroup.setField( "[Time].[Years]" ); 
    columnGroup.getTitleHeader().addElement( createDataItem( "[Time].[Years]" ) ); 
    columnGroup.getHeader().addElement( createFieldItem( "[Time].[Years]" ) ); 

    // Defining the crosstab details.
    CrosstabCellBody body = (CrosstabCellBody) columnGroup.getBody(); 
    CrosstabCell cell = new CrosstabCell(); 
    cell.addElement( createFieldItem( "[Measures].[Sales]" ) ); 
    body.addElement( cell );

    report.setRootGroup( crosstabGroup );

    // Conversion to PDF and rendering.
    response.setContentType("application/pdf");
    PdfReportUtil.createPDF(report, response.getOutputStream());

  }
  catch (Exception e) 
  {
      e.printStackTrace();
  }
}
 
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:66,代码来源:PentahoServlet.java



注:本文中的org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.PdfReportUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ConfigurationActivity类代码示例发布时间:2022-05-23
下一篇:
Java AsyncCallable类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap