My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads
Wiki pages
Links

Overview

data-exporter is a Java library to export the tabular data (like List of rows) into many output formats. As of latest release, this library supports following formats.

  • Text (tab delimited)
  • CSV
  • Html
  • Xml
  • Wiki
  • Json
  • Text Table

Along with these output formats, library has following features.

  • Designed as streaming consumer so this could be used to process huge data set
  • Consumes the Java types as they are without being converted to Strings first
  • Supports String, Currency, Number, Date, Date Time, Boolean and Line Number column types
  • Dynamic column data generation (Line no column in below examples is generated automatically)
  • Dynamic Column calculations (price column in examples below, is generated by multiplying unit price and quantity)
  • Various output styles for Text Table output format with 9 ways text alignment
  • Text alignment is exposed as easy to use API so it can be used to align in your applications

Check out the User Guide or junit test example.

If you have any issues or looking for something new, you can create a issue at issues page or you can even mail me directly with some basic information about the issue and I would do my best to correct it as soon as possible.

Changes

1.0.2 Released on May 19 2012

  • The cell alignment setting is honored in the HtmlExporter. Only the cells are aligned using css styles "text-align" and "vertical-align".

1.0.1 Released on Apr 2 2012

  • Supports NumberFormat in NumberColumn

Sample Output Formats

Example Data

Line NoDate PurchasedItem NoItem NameShipped?QuantityUnit PricePrice
2011/04/07 08:48:39 AM1LaptopNo1$799.78
2011/04/04 05:01:15 PM2MouseYes2$49.30
2011/04/04 04:27:13 PM3KeyboardNo5$75.00

Text Format

 Line No	Date Purchased	Item No	Item Name	Shipped?	Quantity	Unit Price	Price
 1	2011/04/07 08:20:49 AM	1	Laptop	No	1	$799.78	$799.78
 2	2011/04/04 04:33:25 PM	2	Mouse	Yes	2	$49.30	$98.60
 3	2011/04/04 03:59:23 PM	3	Keyboard	No	5	$75.00	$375.00

CSV Format

 Line No,Date Purchased,Item No,Item Name,Shipped?,Quantity,Unit Price,Price
 1,2011/04/07 08:25:13 AM,1,Laptop,No,1,$799.78,$799.78
 2,2011/04/04 04:37:49 PM,2,Mouse,Yes,2,$49.30,$98.60
 3,2011/04/04 04:03:46 PM,3,Keyboard,No,5,$75.00,$375.00

Text Table Format

 +=====+=======================+==========+===============+==========+==========+==========+==========+
 |Line |    Date Purchased     | Item No  |   Item Name   | Shipped? | Quantity |Unit Price|  Price   |
 | No  |                       |          |               |          |          |          |          |
 +=====+=======================+==========+===============+==========+==========+==========+==========+
 |    1|2011/04/07 08:25:33 AM |         1|Laptop         |No        |         1|   $799.78|   $799.78|
 |    2|2011/04/04 04:38:08 PM |         2|Mouse          |Yes       |         2|    $49.30|    $98.60|
 |    3|2011/04/04 04:04:06 PM |         3|Keyboard       |No        |         5|    $75.00|   $375.00|
 +=====+=======================+==========+===============+==========+==========+==========+==========+

Wiki Format

||Line No||Date Purchased||Item No||Item Name||Shipped?||Quantity||Unit Price||Price||
||1||2011/04/07 08:48:39 AM||1||Laptop||No||1||$799.78||$799.78||
||2||2011/04/04 05:01:15 PM||2||Mouse||Yes||2||$49.30||$98.60||
||3||2011/04/04 04:27:13 PM||3||Keyboard||No||5||$75.00||$375.00||

Xml Format

<?xml version="1.0" encoding="UTF-8"?>
<table>
	<row>
		<column name="Line No">1</column>
		<column name="Date Purchased">2011/04/07 08:27:07 AM</column>
		<column name="Item No">1</column>
		<column name="Item Name">Laptop</column>
		<column name="Shipped?">No</column>
		<column name="Quantity">1</column>
		<column name="Unit Price">$799.78</column>
		<column name="Price">$799.78</column>
	</row>
	<row>
		<column name="Line No">2</column>
		<column name="Date Purchased">2011/04/04 04:39:43 PM</column>
		<column name="Item No">2</column>
		<column name="Item Name">Mouse</column>
		<column name="Shipped?">Yes</column>
		<column name="Quantity">2</column>
		<column name="Unit Price">$49.30</column>
		<column name="Price">$98.60</column>
	</row>
	<row>
		<column name="Line No">3</column>
		<column name="Date Purchased">2011/04/04 04:05:41 PM</column>
		<column name="Item No">3</column>
		<column name="Item Name">Keyboard</column>
		<column name="Shipped?">No</column>
		<column name="Quantity">5</column>
		<column name="Unit Price">$75.00</column>
		<column name="Price">$375.00</column>
	</row>
</table>

Html Format

<html>
	<head><meta content="text/html;charset=UTF-8"/></head>
	<body>
		<table border=1>
			<tr>
				<th>Line No</th>
				<th>Date Purchased</th>
				<th>Item No</th>
				<th>Item Name</th>
				<th>Shipped?</th>
				<th>Quantity</th>
				<th>Unit Price</th>
				<th>Price</th>
			</tr>
			<tr>
				<td>1</td>
				<td>2011/04/07 08:27:26 AM</td>
				<td>1</td>
				<td>Laptop</td>
				<td>No</td>
				<td>1</td>
				<td>$799.78</td>
				<td>$799.78</td>
			</tr>
			<tr>
				<td>2</td>
				<td>2011/04/04 04:40:02 PM</td>
				<td>2</td>
				<td>Mouse</td>
				<td>Yes</td>
				<td>2</td>
				<td>$49.30</td>
				<td>$98.60</td>
			</tr>
			<tr>
				<td>3</td>
				<td>2011/04/04 04:05:59 PM</td>
				<td>3</td>
				<td>Keyboard</td>
				<td>No</td>
				<td>5</td>
				<td>$75.00</td>
				<td>$375.00</td>
			</tr>
		</table>
	</body>
</html>

Html Format

{
	"table": {
		"row": {
			"lineNo":1,
			"datePurchased":"2011-04-21",
			"itemNo":1,
			"itemName":"Laptop",
			"shipped":false,
			"quantity":1,
			"unitPrice":799.78,
			"price":799.78
		}, 
		"row": {
			"lineNo":2,
			"datePurchased":"2011-04-18",
			"itemNo":2,
			"itemName":"Mouse",
			"shipped":true,
			"quantity":2,
			"unitPrice":49.3,
			"price":98.6
		}, 
		"row": {
			"lineNo":3,
			"datePurchased":"2011-04-18",
			"itemNo":3,
			"itemName":"Keyboard",
			"shipped":false,
			"quantity":5,
			"unitPrice":75.0,
			"price":375.0
		}, 
		"row": {
			"lineNo":4,
			"datePurchased":"2011-04-21",
			"itemNo":1,
			"itemName":"Lap\"top",
			"shipped":false,
			"quantity":1,
			"unitPrice":799.78,
			"price":799.78
		}
	}
}
Powered by Google Project Hosting