}
/**
- * Finds the first occurance of a given color
+ * Finds the first occurrence of a given color
*
* @param red the RGB red component, between 0 and 255 inclusive
* @param green the RGB green component, between 0 and 255 inclusive
_blue = blue;
}
+ @Override
public short getIndex()
{
return _byteOffset;
}
+ @Override
public short[] getTriplet()
{
return new short[]
};
}
+ @Override
public String getHexString()
{
StringBuffer sb = new StringBuffer();
* @param leftcol the left column to show in desktop window pane
* @deprecated Use {@link #showInPane(int, int)} as there can be more than 32767 rows.
*/
- void showInPane(short toprow, short leftcol);
+ @Deprecated
+ void showInPane(short toprow, short leftcol);
/**
* Shifts rows between startRow and endRow n number of rows.
import java.util.Calendar;
import java.util.Date;
-import org.apache.poi.ss.formula.ptg.Ptg;
-import org.apache.poi.ss.formula.SharedFormula;
-import org.apache.poi.ss.formula.eval.ErrorEval;
import org.apache.poi.ss.SpreadsheetVersion;
import org.apache.poi.ss.formula.FormulaParser;
import org.apache.poi.ss.formula.FormulaRenderer;
import org.apache.poi.ss.formula.FormulaType;
+import org.apache.poi.ss.formula.SharedFormula;
+import org.apache.poi.ss.formula.eval.ErrorEval;
+import org.apache.poi.ss.formula.ptg.Ptg;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Comment;
import org.apache.poi.ss.usermodel.RichTextString;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.ss.util.CellReference;
+import org.apache.poi.util.Internal;
import org.apache.poi.xssf.model.SharedStringsTable;
import org.apache.poi.xssf.model.StylesTable;
-import org.apache.poi.util.Internal;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCell;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCellFormula;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STCellFormulaType;
* Errors are displayed as #ERR<errIdx>
* </p>
*/
+ @Override
public String toString() {
switch (getCellType()) {
case CELL_TYPE_BLANK:
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.util.CellReference;
import org.apache.poi.util.Internal;
-import org.apache.poi.util.POILogFactory;
-import org.apache.poi.util.POILogger;
import org.apache.poi.xssf.model.CalculationChain;
import org.apache.poi.xssf.model.StylesTable;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCell;
* High level representation of a row of a spreadsheet.
*/
public class XSSFRow implements Row, Comparable<XSSFRow> {
- private static final POILogger _logger = POILogFactory.getLogger(XSSFRow.class);
+ //private static final POILogger _logger = POILogFactory.getLogger(XSSFRow.class);
/**
* the xml bean containing all cell definitions for this row
*
* @return an iterator over cells in this row.
*/
- public Iterator<Cell> cellIterator() {
+ @SuppressWarnings("unchecked")
+ public Iterator<Cell> cellIterator() {
return (Iterator<Cell>)(Iterator<? extends Cell>)_cells.values().iterator();
}
public XSSFCell getCell(int cellnum, MissingCellPolicy policy) {
if(cellnum < 0) throw new IllegalArgumentException("Cell index must be >= 0");
- XSSFCell cell = (XSSFCell)_cells.get(cellnum);
+ XSSFCell cell = _cells.get(cellnum);
if(policy == RETURN_NULL_AND_BLANK) {
return cell;
}
}
//TODO column styles are not yet supported by XSSF
- public void testDefaultColumnStyle() {
+ @Override
+ public void testDefaultColumnStyle() {
//super.testDefaultColumnStyle();
}
* Rows and cells can be created in random order,
* but CTRows are kept in ascending order
*/
- public void testCreateRow() {
+ public void testCreateRowA() {
XSSFWorkbook workbook = new XSSFWorkbook();
XSSFSheet sheet = workbook.createSheet();
CTWorksheet wsh = sheet.getCTWorksheet();
import org.apache.poi.hssf.model.InternalWorkbook;
import org.apache.poi.hssf.record.FormulaRecord;
import org.apache.poi.hssf.record.Record;
-import org.apache.poi.ss.formula.ptg.Ptg;
-import org.apache.poi.ss.formula.ptg.Ref3DPtg;
import org.apache.poi.hssf.usermodel.HSSFEvaluationWorkbook;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.ss.formula.ptg.Ptg;
+import org.apache.poi.ss.formula.ptg.Ref3DPtg;
/**
* Tests for {@link EventWorkbookBuilder}
*/
private MockHSSFListener mockListen;
private SheetRecordCollectingListener listener;
+ @Override
public void setUp() {
HSSFRequest req = new HSSFRequest();
mockListen = new MockHSSFListener();
private static final class MockHSSFListener implements HSSFListener {
public MockHSSFListener() {}
- private final List _records = new ArrayList();
- private final List _frecs = new ArrayList();
+ private final List<Record> _records = new ArrayList<Record>();
+ private final List<Record> _frecs = new ArrayList<Record>();
public void processRecord(Record record) {
_records.add(record);
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.hssf.record.PaletteRecord;
-import org.apache.poi.hssf.usermodel.HSSFPalette;
import org.apache.poi.hssf.util.HSSFColor;
/**
private HSSFPalette _hssfPalette;
+ @Override
public void setUp()
{
_palette = new PaletteRecord();
}
private void compareToDefaults(ColorComparator c) {
- Map colors = HSSFColor.getIndexHash();
- Iterator it = colors.keySet().iterator();
+ Map<Integer,HSSFColor> colors = HSSFColor.getIndexHash();
+ Iterator<Integer> it = colors.keySet().iterator();
while (it.hasNext())
{
- Number index = (Number) it.next();
- HSSFColor expectedColor = (HSSFColor) colors.get(index);
+ Number index = it.next();
+ HSSFColor expectedColor = colors.get(index);
HSSFColor paletteColor = _hssfPalette.getColor(index.shortValue());
c.compare(expectedColor, paletteColor);
}
import org.apache.poi.hssf.HSSFITestDataProvider;
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.hssf.model.DrawingManager2;
-import org.apache.poi.hssf.model.InternalWorkbook;
import org.apache.poi.hssf.model.InternalSheet;
+import org.apache.poi.hssf.model.InternalWorkbook;
import org.apache.poi.hssf.record.*;
-import org.apache.poi.ss.formula.ptg.Ptg;
-import org.apache.poi.ss.formula.ptg.Area3DPtg;
import org.apache.poi.hssf.record.aggregates.WorksheetProtectionBlock;
import org.apache.poi.hssf.usermodel.RecordInspector.RecordCollector;
+import org.apache.poi.ss.formula.ptg.Area3DPtg;
+import org.apache.poi.ss.formula.ptg.Ptg;
import org.apache.poi.ss.usermodel.BaseTestSheet;
import org.apache.poi.ss.usermodel.DataValidation;
import org.apache.poi.ss.usermodel.DataValidationConstraint;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.ss.util.CellRangeAddressList;
-import org.apache.poi.ss.util.Region;
import org.apache.poi.util.TempFile;
/**
assertEquals(expectedHashA, sheet2.getSheet().getProtectionBlock().getPasswordHash());
}
- public void testProtectSheet() {
+ public void testProtectSheetA() {
int expectedHash = (short)0xfef1;
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet s = wb.createSheet();
assertEquals("HSSFSheet.getLeftCol()", leftcol, sheet.getLeftCol());
}
- /** cell with formula becomes null on cloning a sheet*/
- public void test35084() {
-
- HSSFWorkbook wb = new HSSFWorkbook();
- HSSFSheet s = wb.createSheet("Sheet1");
- HSSFRow r = s.createRow(0);
- r.createCell(0).setCellValue(1);
- r.createCell(1).setCellFormula("A1*2");
- HSSFSheet s1 = wb.cloneSheet(0);
- r = s1.getRow(0);
- assertEquals("double", r.getCell(0).getNumericCellValue(), 1, 0); // sanity check
- assertNotNull(r.getCell(1));
- assertEquals("formula", r.getCell(1).getCellFormula(), "A1*2");
- }
-
/**
*
*/
assertTrue(wb3.getSheetAt(3).getForceFormulaRecalculation());
}
- public void testColumnWidth() {
+ public void testColumnWidthA() {
//check we can correctly read column widths from a reference workbook
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("colwidth.xls");
assertEquals(40000, sheet.getColumnWidth(10));
}
+
public void testDefaultRowHeight() {
Workbook workbook = _testDataProvider.createWorkbook();
Sheet sheet = workbook.createSheet();
double marginRight = defaultMargins[1];
double marginTop = defaultMargins[2];
double marginBottom = defaultMargins[3];
- double marginHeader = defaultMargins[4];
- double marginFooter = defaultMargins[5];
+ //double marginHeader = defaultMargins[4];
+ //double marginFooter = defaultMargins[5];
Workbook workbook = _testDataProvider.createWorkbook();
Sheet sheet = workbook.createSheet("Sheet 1");