<todo title="Things To Do for Poi">
- <devs>
- <!-- in strict alphabetical order -->
- <person id="AO" name="Andrew C. Oliver" email="acoliver2@users.sourceforge.net"/>
- <person id="GS" name="Glen Stampoultzis" email="gstamp@iprimus.com.au"/>
- <person id="MJ" name="Marc Johnson" email="mjohnson at apache dot org"/>
- <person id="NKB" name="Nicola Ken Barozzi" email="barozzi@nicolaken.com"/>
- <person id="open" name="Poi Developers" email="poi-dev@jakarta.apache.org"/>
- </devs>
+ <devs>
+ <!-- in strict alphabetical order -->
+ <person id="AO" name="Andrew C. Oliver" email="acoliver2@users.sourceforge.net"/>
+ <person id="GS" name="Glen Stampoultzis" email="gstamp@iprimus.com.au"/>
+ <person id="MJ" name="Marc Johnson" email="mjohnson at apache dot org"/>
+ <person id="NKB" name="Nicola Ken Barozzi" email="barozzi@nicolaken.com"/>
+ <person id="open" name="Poi Developers" email="poi-dev@jakarta.apache.org"/>
+ </devs>
- <actions priority="high">
- <action context="code" assigned-to="NKB">
- Finish HDF
- </action>
- <action context="code" assigned-to="NKB">
- Finish Charts
- </action>
- <action context="code">
- Add Formulas.
- </action>
+ <actions priority="high">
+ <action context="code" assigned-to="NKB">
+ Finish HDF
+ </action>
+ <action context="code" assigned-to="NKB">
+ Finish Charts
+ </action>
+ <action context="code">
+ Add Formulas.
+ </action>
- </actions>
+ </actions>
- <actions priority="medium">
- <action context="code">
- Expose functionality in low level records in higher level API
- </action>
- <action context="code">
- Implement more record types (for other things ... not sure
- what this will mean yet).
- </action>
- <action context="code">
- Implement more record types (for other things ... not sure
- what this will mean yet).
- </action>
- <action context="code">
- Add more dummy checks (for when API user's do things they
- "can't" do)
- </action>
- <action context="code">
- Add support for embedded graphics and stuff like that.
- </action>
- <action context="code">
- Create new adapter object for handling MulBlank, MulRk, Rk
- records.
- </action>
- <action context="code">
- Add a way to copy sheets.
- </action>
- </actions>
+ <actions priority="medium">
+ <action context="code">
+ Expose functionality in low level records in higher level API
+ </action>
+ <action context="code">
+ Implement more record types (for other things ... not sure
+ what this will mean yet).
+ </action>
+ <action context="code">
+ Implement more record types (for other things ... not sure
+ what this will mean yet).
+ </action>
+ <action context="code">
+ Add more dummy checks (for when API user's do things they
+ "can't" do)
+ </action>
+ <action context="code">
+ Add support for embedded graphics and stuff like that.
+ </action>
+ <action context="code">
+ Create new adapter object for handling MulBlank, MulRk, Rk
+ records.
+ </action>
+ <action context="code">
+ Add a way to copy sheets.
+ </action>
+ </actions>
</todo>
package org.apache.poi.hssf.model;
-import java.io.OutputStream;
-
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
import org.apache.poi.util.POILogFactory;
-import org.apache.poi.hssf
- .record.*; // normally I don't do this, buy we literally mean ALL
+import org.apache.poi.hssf.record.*; // normally I don't do this, buy we literally mean ALL
import org.apache.poi.hssf.record.formula.FormulaUtil;
import org.apache.poi.hssf.record.formula.Ptg;
import org.apache.poi.util.IntList;
import org.apache.poi.util.POILogger;
-import org.apache.poi.hssf.record
- .aggregates.*; // normally I don't do this, buy we literally mean ALL
+import org.apache.poi.hssf.record.aggregates.*; // normally I don't do this, buy we literally mean ALL
/**
* Low level model implementation of a Sheet (one workbook contains many sheets)
/**
* Creates new Sheet with no intialization --useless at this point
- * @see #createSheet(List,int,int)
+ * @see #createSheet(List,int)
*/
public Sheet()
* is normally called via Workbook.
*
* @param recs array containing those records in the sheet in sequence (normally obtained from RecordFactory)
- * @param sheetnum integer specifying the sheet's number (0,1 or 2 in this release)
* @param offset of the sheet's BOF record
*
* @return Sheet object with all values set to those read from the file
* @see org.apache.poi.hssf.model.Workbook
* @see org.apache.poi.hssf.record.Record
*/
- public static Sheet createSheet(List recs, int sheetnum, int offset)
+ public static Sheet createSheet(List recs, int offset)
{
log.logFormatted(log.DEBUG,
"Sheet createSheet (existing file) with %",
* only the record offset is assumed to be 0.
*
* @param records array containing those records in the sheet in sequence (normally obtained from RecordFactory)
- * @param sheetnum integer specifying the sheet's number (0,1 or 2 in this release)
* @return Sheet object
*/
- public static Sheet createSheet(List records, int sheetnum)
+ public static Sheet createSheet(List records)
{
log.log(log.DEBUG,
"Sheet createSheet (exisiting file) assumed offset 0");
- return createSheet(records, sheetnum, 0);
+ return createSheet(records);
}
/**
import java.lang.reflect.Constructor;
import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.HexDump;
/**
* Title: Record Factory<P>
WindowTwoRecord.class, SelectionRecord.class, ContinueRecord.class,
LabelRecord.class, BlankRecord.class, ColumnInfoRecord.class,
MulRKRecord.class, MulBlankRecord.class, MergeCellsRecord.class,
- FormulaRecord.class
+ FormulaRecord.class, BoolErrRecord.class
};
private static Map recordsMap = recordsToMap(records);
}
catch (Exception introspectionException)
{
+ introspectionException.printStackTrace();
throw new RecordFormatException(
- "Unable to construct record instance");
+ "Unable to construct record instance, the following exception occured: " + introspectionException.getMessage());
}
if (retval instanceof RKRecord)
{
workbook = Workbook.createWorkbook(records);
setPropertiesFromWorkbook(workbook);
int numRecords = workbook.getNumRecords();
- int sheetnum = 0;
while (numRecords < records.size())
{
- Sheet sheet = Sheet.createSheet(records, sheetnum, numRecords);
+ Sheet sheet = Sheet.createSheet(records);
numRecords += sheet.getNumRecords();
sheet.convertLabelRecords(
-
/* ====================================================================
* The Apache Software License, Version 1.1
*
package org.apache.poi.hssf.usermodel;
import junit.framework.TestCase;
-
-import org.apache.poi.hssf.model.Workbook;
import org.apache.poi.hssf.model.Sheet;
import org.apache.poi.hssf.record.VCenterRecord;
import org.apache.poi.hssf.record.WSBoolRecord;
+import java.io.File;
+import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.FileWriter;
/**
* Tests HSSFSheet. This test case is very incomplete at the moment.
*/
public class TestHSSFSheet
- extends TestCase
+ extends TestCase
{
public TestHSSFSheet(String s)
{
*/
public void testBackupRecord()
- throws Exception
+ throws Exception
{
- HSSFWorkbook wb = new HSSFWorkbook();
- HSSFSheet s = wb.createSheet();
- Sheet sheet = s.getSheet();
+ HSSFWorkbook wb = new HSSFWorkbook();
+ HSSFSheet s = wb.createSheet();
+ Sheet sheet = s.getSheet();
assertEquals(true, sheet.getGridsetRecord().getGridset());
s.setGridsPrinted(true);
*/
public void testVerticallyCenter()
- throws Exception
+ throws Exception
{
- HSSFWorkbook wb = new HSSFWorkbook();
- HSSFSheet s = wb.createSheet();
- Sheet sheet = s.getSheet();
+ HSSFWorkbook wb = new HSSFWorkbook();
+ HSSFSheet s = wb.createSheet();
+ Sheet sheet = s.getSheet();
VCenterRecord record =
- ( VCenterRecord ) sheet.findFirstRecordBySid(VCenterRecord.sid);
+ (VCenterRecord) sheet.findFirstRecordBySid(VCenterRecord.sid);
assertEquals(false, record.getVCenter());
s.setVerticallyCenter(true);
public void testWSBool()
{
- HSSFWorkbook wb = new HSSFWorkbook();
- HSSFSheet s = wb.createSheet();
- Sheet sheet = s.getSheet();
+ HSSFWorkbook wb = new HSSFWorkbook();
+ HSSFSheet s = wb.createSheet();
+ Sheet sheet = s.getSheet();
WSBoolRecord record =
- ( WSBoolRecord ) sheet.findFirstRecordBySid(WSBoolRecord.sid);
+ (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
// Check defaults
assertEquals(true, record.getAlternateExpression());
assertEquals(true, s.getRowSumsBelow());
assertEquals(true, s.getRowSumsRight());
}
+
+ public void testReadBooleans()
+ throws Exception
+ {
+ HSSFWorkbook workbook = new HSSFWorkbook();
+ HSSFSheet sheet = workbook.createSheet("Test boolean");
+ HSSFRow row = sheet.createRow((short) 2);
+ HSSFCell cell = row.createCell((short) 9);
+ cell.setCellValue(true);
+ cell = row.createCell((short) 11);
+ cell.setCellValue(true);
+ File tempFile = File.createTempFile("bool", "test.xls");
+ FileOutputStream stream = new FileOutputStream(tempFile);
+ workbook.write(stream);
+ stream.close();
+
+ FileInputStream readStream = new FileInputStream(tempFile);
+ workbook = new HSSFWorkbook(readStream);
+ sheet = workbook.getSheetAt(0);
+ row = sheet.getRow(2);
+ stream.close();
+ tempFile.delete();
+ assertEquals(2, row.getPhysicalNumberOfCells());
+
+
+ }
}