OpenAPI 1.0

com.aquafold.openapi.io
Interface AQExcelWriter

All Superinterfaces:
AQDataWriter, Closeable

public interface AQExcelWriter
extends AQDataWriter

This interface facilitates writing Excel spreadsheet files.

This writer constructs an in-memory spreadsheet which can be written to the disk by saveToFile() method or converted to a byte array via saveToByteArray().


Method Summary
 void close()
          Closes this writer and releases any system resources associated with it.
 void insertPivotTable(AQPivotDataSet dataSet)
          Inserts a new worksheet containing pivot table from the specified data set.
 byte[] saveToByteArray()
          Saves the spreadsheet to a byte array.
 void saveToFile(String filename)
          Save the spreadsheet to a file.
 void setAutoResize(boolean on)
          Controls whether the columns will be resized to fit the data.
 void setColumnWidth(int columnIndex, float width)
          Sets the width of the specified column, in unit of characters using default font.
 void setCurrentWorksheet(String name)
          Sets the current worksheet.
 void setFirstLineContainsColumnNames(boolean on)
          Defines whether the first data row is preceded by a row containing column names.
 void setNullString(String s)
          Sets value to be placed in a cell containing null data.
 void skip()
          Skips one line in the output file.
 void skip(int numberOfLines)
          Skips specified number of lines in the output file.
 
Methods inherited from interface com.aquafold.openapi.io.AQDataWriter
write, write, write, write
 

Method Detail

setCurrentWorksheet

void setCurrentWorksheet(String name)
Sets the current worksheet. If a worksheet under the specified name does not exist, it will be created. Any subsequent data will be written to this object until this method is called with a different name.

Any data written prior to this call will be inserted into automatically added worksheet named "Data".

Parameters:
name - Worksheet name.

setFirstLineContainsColumnNames

void setFirstLineContainsColumnNames(boolean on)
Defines whether the first data row is preceded by a row containing column names.

This method may be called before any data is written. An exception will be thrown if this method is invoked after data has been written.


setNullString

void setNullString(String s)
Sets value to be placed in a cell containing null data. Default value is null (empty cell).

This method may be called before any data is written. An exception will be thrown if this method is invoked after data has been written.

Parameters:
s - String value to be inserted in place of a null.

skip

void skip()
Skips one line in the output file.


skip

void skip(int numberOfLines)
Skips specified number of lines in the output file.

Parameters:
numberOfLines - Number of lines to skip.

setColumnWidth

void setColumnWidth(int columnIndex,
                    float width)
Sets the width of the specified column, in unit of characters using default font.

Parameters:
columnIndex - Column index, 0-based.
width - Column width in characters(0-255).

setAutoResize

void setAutoResize(boolean on)
Controls whether the columns will be resized to fit the data. This method overrides any column width set by setColumnWidth(int, float).

This method may be called before any data is written. An exception will be thrown if this method is invoked after data has been written.

Parameters:
on -

insertPivotTable

void insertPivotTable(AQPivotDataSet dataSet)
                      throws Exception
Inserts a new worksheet containing pivot table from the specified data set.

Parameters:
dataSet -
Throws:
Exception

saveToByteArray

byte[] saveToByteArray()
                       throws Exception
Saves the spreadsheet to a byte array.

Throws:
Exception

saveToFile

void saveToFile(String filename)
                throws Exception
Save the spreadsheet to a file.

Parameters:
filename - Output file name.
Throws:
Exception

close

void close()
           throws IOException
Closes this writer and releases any system resources associated with it. Once the file has been closed, further write() invocations will cause an exception to be thrown. Closing a previously closed stream has no effect.

Specified by:
close in interface AQDataWriter
Specified by:
close in interface Closeable
Throws:
IOException

OpenAPI 1.0


Copyright © 2010 AquaFold, Inc. All Rights Reserved. Use is subject to license terms.