Skip to content
pedrosans edited this page Apr 18, 2011 · 5 revisions

POI Integration Project

Misc types to integrate Wicket projects to Apache POI. The project has a handler able to respond a XLS file to a request, based in the rendered table and its data components.

Maven Artifacts

  • wicket-poi-parent
  • wicket-poi
  • wicket-poi-examples

Documentation

In Wicket projects we end up creating several types of components for the same purpose: generate an HTML table component. This project aims to provide integration components to generate a POI Workbook for those. In order to understand the table structure TableComponentAsXlsHandler will parse the generated markup while trying to maintain a link between markup and Wicket components in table data. Even if the component only generates the table markup, TableComponentAsXlsHandler will still be able to generate a Workbook because it will use the parsed content.

##TableComponentAsXlsHandler Request handler that respond the specified table component as a XLS file. It uses an CellExporter to delegate the task of resolve and set the table data in the POI Cell component.

###Pagination friendly If the Wicket table component implements the IPageable interface, TableComponentAsXlsHandler will visit every page in order to generate the table content.

##GeneralPurposeExporter A general purpose CellExporter that parses the table HTML looking for the first most nested tag. If this tag has a correspondent Wicket component, set its model value respecting its type in the POI Cell. If the counterpart Wicket component can not be resolved, set the tag text component. This the default CellExporter set in TableComponentAsXlsHandler

##XlsStream XLS file stream for a POI Workbook. It can be used to create a Wicket resource.

Maven Stable

not avaliable yet

Maven Development

<dependency>
    <groupId>org.wicketstuff</groupId>
    <artifactId>wicket-poi</artifactId>
    <version>1.5-SNAPSHOT</version>
</dependency>

<repository>
	<id>wicketstuff-core-snapshots</id>
	<url>ttps://oss.sonatype.org/content/repositories/snapshots</url>
	<snapshots>
		<enabled>true</enabled>
	</snapshots>		
</repository>

Java

add(new Link<Void>("exportToXLS")
{
	@Override
	public void onClick()
	{
		Component tableComponent; //any Wicket component generating HTML table tag and its inner markup
		IRequestHandler handler = new TableComponentAsXlsHandler(tableComponent);
		RequestCycle.get().scheduleRequestHandlerAfterCurrent(handler);
	}
});

HTML

<a wicket:id="exportToXLS">Export to XLS</a>

Project Maintainers

Pedro Santos - [email protected]

Source Code

master Branch

https://github.com/wicketstuff/core/tree/master/jdk-1.5-parent/wicket-poi-parent/wicket-poi

Clone this wiki locally