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 for in the 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 set to be exported to a XLS file implements the IPageable interface, TableComponentAsXlsHandler will visit all pages in order to generate rows for the table content in every pages.

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

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

Maven Stable

not avaliable

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