jxl.demo
public class: ReadWrite [javadoc |
source]
java.lang.Object
jxl.demo.ReadWrite
Demo class which uses the api to read in a spreadsheet and generate a clone
of that spreadsheet which contains the same data. If the spreadsheet read
in is the spreadsheet called jxlrwtest.xls (provided with the distribution)
then this class will modify certain fields in the copy of that spreadsheet.
This is illustrating that it is possible to read in a spreadsheet, modify
a few values, and write it under a new name.
| Constructor: |
public ReadWrite(String input,
String output) {
inputWorkbook = new File(input);
outputWorkbook = new File(output);
logger.setSuppressWarnings(Boolean.getBoolean("jxl.nowarnings"));
logger.info("Input file: " + input);
logger.info("Output file: " + output);
}
Parameters:
output -
input -
|
| Method from jxl.demo.ReadWrite Summary: |
|---|
|
readWrite |
| Method from jxl.demo.ReadWrite Detail: |
public void readWrite() throws BiffException, IOException, WriteException {
logger.info("Reading...");
Workbook w1 = Workbook.getWorkbook(inputWorkbook);
logger.info("Copying...");
WritableWorkbook w2 = Workbook.createWorkbook(outputWorkbook, w1);
if (inputWorkbook.getName().equals("jxlrwtest.xls"))
{
modify(w2);
}
w2.write();
w2.close();
logger.info("Done");
}
Reads in the inputFile and creates a writable copy of it called outputFile |