Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Render TOC in Java code in my application(Render TOC in Java code in my application)
Render TOC in Java code in my application [message #1014486] Mon, 25 February 2013 22:46 Go to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 14
Registered: February 2013
Junior Member
I find out the following tasks during debug:

1. BirtViewerReportService.transformTOCNode(TOCNode)
2. BirtGetTOCActionHandler.prepareResponse()
create org.eclipse.birt.report.soapengine.api.Update object
GetUpdatedObjectsResponse.setUpdate(Update)

I don't want to use SOAP api to render TOC. instead I want to use Java api to render it. How do I do it?


Thanks,

James,


Jamas
Re: Render TOC in Java code in my application [message #1015240 is a reply to message #1014486] Wed, 27 February 2013 21:01 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Can you try something like:


import java.util.logging.Level;

import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.EngineException;
import org.eclipse.birt.report.engine.api.IReportDocument;
import org.eclipse.birt.report.engine.api.IReportEngine;
import org.eclipse.birt.report.engine.api.IReportEngineFactory;
import org.eclipse.birt.report.engine.api.TOCNode;


public class Toc {

public void runReport() throws EngineException
{

IReportEngine engine=null;
EngineConfig config = null;

try{

config = new EngineConfig( );
config.setLogConfig(null, Level.FINE);
Platform.startup( config );
IReportEngineFactory factory = (IReportEngineFactory) Platform.createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
engine = factory.createReportEngine( config );
}catch( Exception ex){
ex.printStackTrace();
}

IReportDocument document = null;
//Open the report design
document = engine.openReportDocument("output/resample/customers.rptdocument");


// Get the root of the table of contents.
TOCNode td = document.findTOC( null );
java.util.List children = td.getChildren( );
long pNumber;
// Loop through the top level table of contents entries.
if ( children != null && children.size( ) > 0 ) {
for ( int i = 0; i < children.size( ); i++ ) {
// Find the required table of contents entry.
TOCNode child = ( TOCNode ) children.get( i );
//if ( child.getDisplayString( ).equals( "103" ) ) {
// Get the number of the page that contains the data.
pNumber = document.getPageNumber( child.getBookmark( ) );
System.out.println( child.getDisplayString( ) + "Page to print is " + pNumber );
//}
}
}

document.close();
engine.destroy();
Platform.shutdown();
System.out.println("Finished");
}


/**
* @param args
*/
public static void main(String[] args) {
try
{

Toc ex = new Toc( );
ex.runReport();

}
catch ( Exception e )
{
e.printStackTrace();
}
}


}

Jason
Previous Topic:Security Exception
Next Topic:soap calls viewerservlet
Goto Forum:
  


Current Time: Fri Feb 03 21:25:15 GMT 2023

Powered by FUDForum. Page generated in 0.22609 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top