当前位置: 首页>>代码示例>>Java>>正文


Java IRenderOption.setOutputFormat方法代码示例

本文整理汇总了Java中org.eclipse.birt.report.engine.api.IRenderOption.setOutputFormat方法的典型用法代码示例。如果您正苦于以下问题:Java IRenderOption.setOutputFormat方法的具体用法?Java IRenderOption.setOutputFormat怎么用?Java IRenderOption.setOutputFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.birt.report.engine.api.IRenderOption的用法示例。


在下文中一共展示了IRenderOption.setOutputFormat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doRenderAll

import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
void doRenderAll( ) throws Exception
{
	IReportDocument document = engine.openReportDocument( REPORT_DOCUMENT );
	ByteArrayOutputStream out = new ByteArrayOutputStream( );
	IRenderTask renderTask = engine.createRenderTask( document );
	renderTask.getReportRunnable( ).setDesignHandle( reportHandle );
	IRenderOption option = new HTMLRenderOption( );
	option.setOutputFormat( HTMLRenderOption.OUTPUT_FORMAT_HTML );
	option.setOutputStream( out );
	renderTask.setRenderOption( option );
	renderTask.render( );
	assertTrue( renderTask.getErrors( ).isEmpty( ) );
	renderTask.close( );
	String pageContent = out.toString( "UTF-8" );
	assertTrue( pageContent.indexOf( "reportlet_table" ) != -1 );
	assertTrue( pageContent.indexOf( "SECOND-PAGE" ) != -1 );
	document.close( );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:19,代码来源:DocumentIRTransferTest.java

示例2: doRenderAll

import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
void doRenderAll( ) throws Exception
{
	IReportDocument document = engine.openReportDocument( REPORT_DOCUMENT );
	ByteArrayOutputStream out = new ByteArrayOutputStream( );
	IRenderTask renderTask = engine.createRenderTask( document );
	IRenderOption option = new HTMLRenderOption( );
	option.setOutputFormat( HTMLRenderOption.OUTPUT_FORMAT_HTML );
	option.setOutputStream( out );
	renderTask.setRenderOption( option );
	renderTask.render( );
	assertTrue( renderTask.getErrors( ).isEmpty( ) );
	renderTask.close( );
	String pageContent = out.toString( "UTF-8" );
	assertTrue( pageContent.indexOf( "reportlet_table" ) != -1 );
	assertTrue( pageContent.indexOf( "SECOND-PAGE" ) != -1 );
	document.close( );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:18,代码来源:ReportDocumentTest.java

示例3: test90378

import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
public void test90378( ) throws Exception
{
	ByteArrayOutputStream out = new ByteArrayOutputStream( );
	IRenderOption option = new HTMLRenderOption( );
	option.setOutputFormat( "html" );
	option.setOutputStream( out );
	render( "org/eclipse/birt/report/engine/regression/90378.rptdesign",
			option );
	String report = out.toString( );

	Pattern pattern = Pattern.compile( "<div>b1</div>" );
	Matcher matcher = pattern.matcher( report );
	int matches = 0;
	while ( matcher.find( ) )
	{
		matches++;
	}
	assertEquals( 2, matches );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:20,代码来源:Test_90378.java

示例4: testIEmitterServices

import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
/**
 * Test IEmitterServices methods.
 * 
 * @throws BirtException
 */
public void testIEmitterServices( ) throws BirtException
{
	EngineConfig config = new EngineConfig( );
	emitterConfig = new HTMLEmitterConfig( );
	config.setEmitterConfiguration( EMITTER_HTML, emitterConfig );
	emitterConfig = config.getEmitterConfigs( ).get( EMITTER_HTML );
	Platform.startup( config );
	IReportEngineFactory factory = (IReportEngineFactory) Platform
			.createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
	IReportEngine reportEngine = factory.createReportEngine( config );
	IReportRunnable reportRunnable = engine.openReportDesign( this
			.genInputFile( report ) );

	IRenderOption options = new HTMLRenderOption( );
	options.setOutputFormat( EMITTER_HTML );
	options.setOutputFileName( this.genOutputFile( "myService.html" ) );
	HTMLRenderContext renderContext = new HTMLRenderContext( );
	renderContext.setImageDirectory( "myImage" ); //$NON-NLS-1$
	HashMap appContext = new HashMap( );
	appContext.put(
			EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT,
			renderContext );
	appContext.put( "emitter_class", this );

	IRunAndRenderTask rrTask = reportEngine
			.createRunAndRenderTask( reportRunnable );
	rrTask.setRenderOption( options );
	rrTask.setAppContext( appContext );
	rrTask.run( );
	rrTask.close( );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:37,代码来源:IEmitterServicesTest.java

示例5: findIID

import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
private ArrayList findIID( String doc, String type )
		throws EngineException, UnsupportedEncodingException
{
	ArrayList iids = new ArrayList( );
	IRenderTask task = null;
	IReportDocument reportDoc = null;
	reportDoc = engine.openReportDocument( doc );
	task = engine.createRenderTask( reportDoc );

	IRenderOption htmlRenderOptions = new HTMLRenderOption( );
	HashMap appContext = new HashMap( );
	task.setAppContext( appContext );

	ByteArrayOutputStream ostream = new ByteArrayOutputStream( );
	htmlRenderOptions.setOutputStream( ostream );
	htmlRenderOptions.setOutputFormat( "html" );
	( (HTMLRenderOption) htmlRenderOptions ).setEnableMetadata( true );

	task.setRenderOption( htmlRenderOptions );
	task.render( );
	task.close( );

	String content = ostream.toString( "utf-8" );
	Pattern typePattern = buildPattern(type);
	Matcher matcher = typePattern.matcher( content );

	while ( matcher.find( ) )
	{
		String tmp_type = null, strIid = null;
		tmp_type = matcher.group( 0 );
		strIid = tmp_type.substring( tmp_type.indexOf( "iid" ) );
		strIid = strIid.substring( 5, strIid.indexOf( "\"", 6 ) );
		iids.add( InstanceID.parse( strIid ) );
	}

	return iids;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:38,代码来源:DataExtractionTaskTest.java

示例6: onPage

import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
public void onPage( int pageNumber, boolean checkpoint,
		IReportDocumentInfo doc )
{
	if ( pageNumber == 1 )
	{
		try
		{
			IReportDocument document = engine
					.openReportDocument( docfolder );
			IRenderTask task = engine.createRenderTask( document );
			task.setLocale( Locale.ENGLISH );

			IRenderOption options = new HTMLRenderOption( );
			options.setOutputFileName( outputHtml );
			options.setOutputFormat( "html" ); //$NON-NLS-1$
			options.getOutputSetting( ).put(
					HTMLRenderOption.URL_ENCODING,
					"UTF-8" ); //$NON-NLS-1$
			task.setRenderOption( options );

			task.setPageRange( "All" ); //$NON-NLS-1$
			task.render( );
			task.close( );
		}
		catch ( Exception e )
		{
			e.printStackTrace( );
		}
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:31,代码来源:RenderUnfinishedReportDoc.java

示例7: createReportOutput

import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
private void createReportOutput( String reportDocumentFile,
		String outputFolder ) throws EngineException, IOException
{
	IReportDocument document = engine.openReportDocument( reportDocumentFile );
	renderTask = engine.createRenderTask( document );

	String outputFile = getOutputFileName( outputFolder,
			new File( reportDesignFile ).getName( ),
			targetFormat );

	IRenderOption renderOption = new HTMLRenderOption( );
	renderOption.setOutputFileName( outputFile );
	renderOption.setOutputFormat( targetFormat );

	try
	{
		renderTask.setRenderOption( renderOption );
		configTask( renderTask );
		renderTask.render( );
	}
	catch ( EngineException e )
	{
		throw e;
	}
	finally
	{
		renderTask.close( );
		renderTask = null;
		document.close( );
		document = null;
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:33,代码来源:ReportLauncher.java

示例8: runAndRender_WithPagination

import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
private List runAndRender_WithPagination( String inputFile, String outputFile )
		throws EngineException
{
	IReportRunnable runnable = engine.openReportDesign( inputFile );
	IRunAndRenderTask task = engine.createRunAndRenderTask( runnable );

	task.setLocale( Locale.ENGLISH );

	IRenderOption options = new HTMLRenderOption( );
	options.setOutputFileName( outputFile );
	( (HTMLRenderOption) options ).setHtmlPagination( true );
	HTMLRenderContext renderContext = new HTMLRenderContext( );
	renderContext.setImageDirectory( "image" ); //$NON-NLS-1$
	HashMap appContext = new HashMap( );
	appContext.put( EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT,
			renderContext );
	task.setAppContext( appContext );

	options.setOutputFormat( "html" ); //$NON-NLS-1$
	options.getOutputSetting( )
			.put( HTMLRenderOption.URL_ENCODING, "UTF-8" ); //$NON-NLS-1$

	task.setRenderOption( options );
	task.run( );
	List errors = task.getErrors( );
	task.close( );

	return errors;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:30,代码来源:BaseSmokeTest.java

示例9: render

import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
private ArrayList render( String format, String doc, String output,
		String pageRange ) throws EngineException
{

	String outputFile = genOutputFile( output );
	doc = getFullQualifiedClassName( ) + "/" + INPUT_FOLDER + "/" + doc;

	String encoding = "UTF-8"; //$NON-NLS-1$

	IReportDocument document = engine.openReportDocument( doc );
	IRenderTask task = engine.createRenderTask( document );
	task.setLocale( locale );

	IRenderOption options = new HTMLRenderOption( );
	options.setOutputFileName( outputFile );
	options.setOutputFormat( format );
	options.getOutputSetting( ).put( HTMLRenderOption.URL_ENCODING,
			encoding );
	if ( !format.equalsIgnoreCase( FORMAT_PDF ) )
	{
		( (HTMLRenderOption) options ).setHtmlPagination( this.pagination );
	}
	HTMLRenderContext renderContext = new HTMLRenderContext( );
	renderContext.setImageDirectory( IMAGE_DIR );
	HashMap appContext = new HashMap( );
	appContext.put( EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT,
			renderContext );
	appContext.put( EngineConstants.APPCONTEXT_CLASSLOADER_KEY,
			EngineCase.class.getClassLoader( ) );

	task.setAppContext( appContext );
	task.setRenderOption( options );

	task.setPageRange( pageRange );
	task.render( );
	ArrayList errors = (ArrayList) task.getErrors( );
	task.close( );
	return errors;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:40,代码来源:EngineCase.java

示例10: ivRenderDocument

import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
protected String ivRenderDocument( String document, String reportlet )
		throws EngineException, IOException
{
	IArchiveFile av = archiveFactory.openArchive( document, "r" );
	try
	{
		IReportDocument reportDocument = engine.openReportDocument(
				document, new ArchiveReader( av ), new HashMap( ) );
		try
		{
			IRenderTask renderTask = engine
					.createRenderTask( reportDocument );
			try
			{
				renderTask.setReportlet( reportlet );
				IRenderOption option = new RenderOption( );
				option.setOutputFormat( IRenderOption.OUTPUT_FORMAT_HTML );
				ByteArrayOutputStream out = new ByteArrayOutputStream( );
				option.setOutputStream( out );
				renderTask.setRenderOption( option );
				renderTask.render( );
				return new String( out.toByteArray( ) );
			}
			finally
			{
				renderTask.close( );
			}
		}
		finally
		{
			reportDocument.close( );
		}
	}
	finally
	{
		av.close( );
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:39,代码来源:ReportletIVTest.java

示例11: doRenderPages

import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
void doRenderPages( ) throws Exception
{
	IReportDocument document = engine.openReportDocument( REPORT_DOCUMENT );
	long totalPage = document.getPageCount( );
	assertEquals( 2, totalPage );
	ByteArrayOutputStream out = new ByteArrayOutputStream( );
	for ( long pageNumber = 1; pageNumber <= totalPage; pageNumber++ )
	{
		IRenderTask renderTask = engine.createRenderTask( document );
		renderTask.getReportRunnable( ).setDesignHandle( reportHandle );
		IRenderOption option = new HTMLRenderOption( );
		option.setOutputFormat( HTMLRenderOption.OUTPUT_FORMAT_HTML );
		option.setOutputStream( out );
		renderTask.setRenderOption( option );
		renderTask.setPageNumber( pageNumber );
		renderTask.render( );
		assertTrue( renderTask.getErrors( ).isEmpty( ) );
		renderTask.close( );
		String pageContent = out.toString( "UTF-8" );
		if ( pageNumber == 1 )
		{
			assertTrue( pageContent.indexOf( "reportlet_table" ) != -1 );
			assertTrue( pageContent.indexOf( "SECOND-PAGE" ) == -1 );
		}
		else
		{
			assertTrue( pageContent.indexOf( "reportlet_table" ) == -1 );
			assertTrue( pageContent.indexOf( "SECOND-PAGE" ) != -1 );
		}
		out.reset( );
	}
	document.close( );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:34,代码来源:DocumentIRTransferTest.java

示例12: doRenderPages

import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
void doRenderPages( ) throws Exception
{
	IReportDocument document = engine.openReportDocument( REPORT_DOCUMENT );
	long totalPage = document.getPageCount( );
	assertEquals( 2, totalPage );
	ByteArrayOutputStream out = new ByteArrayOutputStream( );
	for ( long pageNumber = 1; pageNumber <= totalPage; pageNumber++ )
	{
		IRenderTask renderTask = engine.createRenderTask( document );
		IRenderOption option = new HTMLRenderOption( );
		option.setOutputFormat( HTMLRenderOption.OUTPUT_FORMAT_HTML );
		option.setOutputStream( out );
		renderTask.setRenderOption( option );
		renderTask.setPageNumber( pageNumber );
		renderTask.render( );
		assertTrue( renderTask.getErrors( ).isEmpty( ) );
		renderTask.close( );
		String pageContent = out.toString( "UTF-8" );
		if ( pageNumber == 1 )
		{
			assertTrue( pageContent.indexOf( "reportlet_table" ) != -1 );
			assertTrue( pageContent.indexOf( "SECOND-PAGE" ) == -1 );
		}
		else
		{
			assertTrue( pageContent.indexOf( "reportlet_table" ) == -1 );
			assertTrue( pageContent.indexOf( "SECOND-PAGE" ) != -1 );
		}
		out.reset( );
	}
	document.close( );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:33,代码来源:ReportDocumentTest.java

示例13: createReport

import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
private void createReport( String reportDesignFile, String outputFolder,
		Map parameters ) throws IOException, EngineException
{
	String outputFile = getOutputFileName( outputFolder,
			new File( reportDesignFile ).getName( ),
			targetFormat );

	IReportRunnable report = engine.openReportDesign( reportDesignFile );
	runAndRenderTask = engine.createRunAndRenderTask( report );

	IRenderOption renderOption = new HTMLRenderOption( );
	renderOption.setOutputFileName( outputFile );
	renderOption.setOutputFormat( targetFormat );

	try
	{
		if ( parameters != null )
		{
			runAndRenderTask.setParameterValues( parameters );
		}
		runAndRenderTask.setAppContext( Collections.EMPTY_MAP );
		runAndRenderTask.setRenderOption( renderOption );
		configTask( runAndRenderTask );
		runAndRenderTask.run( );
	}
	catch ( EngineException e )
	{
		throw e;
	}
	finally
	{
		runAndRenderTask.close( );
		report = null;
		runAndRenderTask = null;
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:37,代码来源:ReportLauncher.java

示例14: run

import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
void run(IReportRunnable reportRunnable, String format, TimeZone timeZone, String htmlType, String targetFile, JsonObject values)
        throws EngineException {

    ReportParametersInspector inspector = new ReportParametersInspector(reportEngine);
    List<IParameterDefnBase> parameters = inspector.getParameters(reportRunnable);

    Map<String, String> map = new HashMap<String, String>(parameters.size());
    flattenParameters(inspector, parameters, map);

    IRunAndRenderTask task = reportEngine.createRunAndRenderTask(reportRunnable);
    for(IParameterDefnBase param: parameters){
        String name = param.getName();
        if(values.containsKey(name)){
            setParameter(task, name, map.get(name), values.get(name));
        }
    }

    // set report render options
    IRenderOption options = new RenderOption();

    options.setOutputFormat(format);

    // setup the output file
    options.setOutputFileName(targetFile);

    // setup the application context
    if (format.equalsIgnoreCase("html")) {
        HTMLRenderOption htmlOptions = new HTMLRenderOption(options);
        if ("ReportletNoCSS".equals(htmlType)) {
            htmlOptions.setEmbeddable(true);
        }
        // setup the output encoding
        htmlOptions.setUrlEncoding(encoding);
        htmlOptions.setHtmlPagination(true);
        htmlOptions.setImageDirectory("image"); //$NON-NLS-1$
    }

    // set the render options
    task.setRenderOption(options);

    // setup the locale
    task.setLocale(getLocale(locale));
    task.setTimeZone(timeZone);
    task.run();
    task.close();
}
 
开发者ID:phuihock,项目名称:birtconn,代码行数:47,代码来源:ReportGenerator.java

示例15: testRenderPDFNPE

import org.eclipse.birt.report.engine.api.IRenderOption; //导入方法依赖的package包/类
public void testRenderPDFNPE( )
{
	report_design = inputPath + "case1.rptdesign";
	report_document = outputPath + "pdfbug_reportdocument";
	copyResource_INPUT( "case1.rptdesign", "case1.rptdesign" );

	IRenderTask task;
	try
	{
		createReportDocument( report_design, report_document );
		reportDoc = engine.openReportDocument( report_document );

		// Set IRenderOption
		IRenderOption pdfRenderOptions = new HTMLRenderOption( );
		HTMLRenderContext renderContext = new HTMLRenderContext( );
		renderContext.setImageDirectory( "image" );
		HashMap appContext = new HashMap( );
		appContext.put(
				EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT,
				renderContext );

		pdfRenderOptions.setOutputFormat( "pdf" );
		pdfRenderOptions.getOutputSetting( ).put(
				HTMLRenderOption.URL_ENCODING,
				"UTF-8" );

		outputFileName = outputPath + "pdfbug/pdf/page1" + ".pdf";
		removeFile( outputFileName );
		pdfRenderOptions.setOutputFileName( outputFileName );
		task = engine.createRenderTask( reportDoc );
		task.setLocale( Locale.ENGLISH );
		task.setAppContext( appContext );
		task.setRenderOption( pdfRenderOptions );
		task.render( );
		task.close( );
		File pdfFile = new File( outputFileName );
		assertTrue(
				"Render pdf failed when target path doesn't exist",
				pdfFile.exists( ) );
		assertTrue(
				"Render pdf failed when target path doesn't exist",
				pdfFile.length( ) != 0 );
	}
	catch ( Exception e )
	{
		e.printStackTrace( );
		fail( "Render pdf failed when target path doesn't exist" );
	}

}
 
开发者ID:eclipse,项目名称:birt,代码行数:51,代码来源:RenderTaskTest.java


注:本文中的org.eclipse.birt.report.engine.api.IRenderOption.setOutputFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。