tupleTable.setColOffset(0);
tupleTable.setColLimit(0);
tupleTable.setOffset(0);
tupleTable.setLimit(0);
TupleWriter tupleWriter = excelWriter.createTupleWriter("Sheet1");
try
{
// write header row
tupleWriter.writeColNames(Iterables.transform(tupleTable.getColumns(), new Function<Field, String>()
{
@Override
@Nullable
public String apply(@Nullable
Field field)
{
return field != null ? field.getName() : null;
}
}));
// write rows
for (Iterator<Tuple> it = tupleTable.iterator(); it.hasNext();)
tupleWriter.write(it.next());
}
finally
{
IOUtils.closeQuietly(tupleWriter);