minor changes - initial work on bugzilla 48292 (support for array formulas)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@885006 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
97a5bf3d61
commit
c73dd9d324
@ -32,6 +32,9 @@ public abstract class SharedValueRecordBase extends StandardRecord {
|
|||||||
private CellRangeAddress8Bit _range;
|
private CellRangeAddress8Bit _range;
|
||||||
|
|
||||||
protected SharedValueRecordBase(CellRangeAddress8Bit range) {
|
protected SharedValueRecordBase(CellRangeAddress8Bit range) {
|
||||||
|
if (range == null) {
|
||||||
|
throw new IllegalArgumentException("range must be supplied.");
|
||||||
|
}
|
||||||
_range = range;
|
_range = range;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,6 +49,9 @@ public abstract class SharedValueRecordBase extends StandardRecord {
|
|||||||
_range = new CellRangeAddress8Bit(in);
|
_range = new CellRangeAddress8Bit(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the range of cells that this record is shared across. Never <code>null</code>.
|
||||||
|
*/
|
||||||
public final CellRangeAddress8Bit getRange() {
|
public final CellRangeAddress8Bit getRange() {
|
||||||
return _range;
|
return _range;
|
||||||
}
|
}
|
||||||
|
@ -30,41 +30,42 @@ import org.apache.poi.util.LittleEndianOutput;
|
|||||||
public final class ExpPtg extends ControlPtg {
|
public final class ExpPtg extends ControlPtg {
|
||||||
private final static int SIZE = 5;
|
private final static int SIZE = 5;
|
||||||
public final static short sid = 0x1;
|
public final static short sid = 0x1;
|
||||||
private final short field_1_first_row;
|
private final int field_1_first_row;
|
||||||
private final short field_2_first_col;
|
private final int field_2_first_col;
|
||||||
|
|
||||||
public ExpPtg(LittleEndianInput in)
|
public ExpPtg(LittleEndianInput in) {
|
||||||
{
|
|
||||||
field_1_first_row = in.readShort();
|
field_1_first_row = in.readShort();
|
||||||
field_2_first_col = in.readShort();
|
field_2_first_col = in.readShort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ExpPtg(int firstRow, int firstCol) {
|
||||||
|
this.field_1_first_row = firstRow;
|
||||||
|
this.field_2_first_col = firstCol;
|
||||||
|
}
|
||||||
|
|
||||||
public void write(LittleEndianOutput out) {
|
public void write(LittleEndianOutput out) {
|
||||||
out.writeByte(sid + getPtgClass());
|
out.writeByte(sid + getPtgClass());
|
||||||
out.writeShort(field_1_first_row);
|
out.writeShort(field_1_first_row);
|
||||||
out.writeShort(field_2_first_col);
|
out.writeShort(field_2_first_col);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSize()
|
public int getSize() {
|
||||||
{
|
|
||||||
return SIZE;
|
return SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public short getRow() {
|
public int getRow() {
|
||||||
return field_1_first_row;
|
return field_1_first_row;
|
||||||
}
|
}
|
||||||
|
|
||||||
public short getColumn() {
|
public int getColumn() {
|
||||||
return field_2_first_col;
|
return field_2_first_col;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toFormulaString()
|
public String toFormulaString() {
|
||||||
{
|
|
||||||
throw new RecordFormatException("Coding Error: Expected ExpPtg to be converted from Shared to Non-Shared Formula by ValueRecordsAggregate, but it wasn't");
|
throw new RecordFormatException("Coding Error: Expected ExpPtg to be converted from Shared to Non-Shared Formula by ValueRecordsAggregate, but it wasn't");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
|
||||||
StringBuffer buffer = new StringBuffer("[Array Formula or Shared Formula]\n");
|
StringBuffer buffer = new StringBuffer("[Array Formula or Shared Formula]\n");
|
||||||
buffer.append("row = ").append(getRow()).append("\n");
|
buffer.append("row = ").append(getRow()).append("\n");
|
||||||
buffer.append("col = ").append(getColumn()).append("\n");
|
buffer.append("col = ").append(getColumn()).append("\n");
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
package org.apache.poi.ss.util;
|
package org.apache.poi.ss.util;
|
||||||
|
|
||||||
import org.apache.poi.ss.SpreadsheetVersion;
|
import org.apache.poi.ss.SpreadsheetVersion;
|
||||||
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -111,6 +112,11 @@ public abstract class CellRangeAddressBase {
|
|||||||
return _lastRow;
|
return _lastRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isInRange(int rowInd, int colInd) {
|
||||||
|
return _firstRow <= rowInd && rowInd <= _lastRow &&
|
||||||
|
_firstCol <= colInd && colInd <= _lastCol;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param firstCol column number for the upper left hand corner
|
* @param firstCol column number for the upper left hand corner
|
||||||
*/
|
*/
|
||||||
|
@ -888,7 +888,7 @@ public final class XSSFCell implements Cell {
|
|||||||
int sstIndex = Integer.parseInt(_cell.getV());
|
int sstIndex = Integer.parseInt(_cell.getV());
|
||||||
XSSFRichTextString rt = new XSSFRichTextString(_sharedStringSource.getEntryAt(sstIndex));
|
XSSFRichTextString rt = new XSSFRichTextString(_sharedStringSource.getEntryAt(sstIndex));
|
||||||
String text = rt.getString();
|
String text = rt.getString();
|
||||||
return Boolean.valueOf(text);
|
return Boolean.parseBoolean(text);
|
||||||
case CELL_TYPE_NUMERIC:
|
case CELL_TYPE_NUMERIC:
|
||||||
return Double.parseDouble(_cell.getV()) != 0;
|
return Double.parseDouble(_cell.getV()) != 0;
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ import org.apache.poi.openxml4j.opc.PackagePart;
|
|||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
import org.apache.poi.openxml4j.opc.PackageRelationshipCollection;
|
import org.apache.poi.openxml4j.opc.PackageRelationshipCollection;
|
||||||
import org.apache.poi.ss.SpreadsheetVersion;
|
import org.apache.poi.ss.SpreadsheetVersion;
|
||||||
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
import org.apache.poi.ss.usermodel.CellStyle;
|
import org.apache.poi.ss.usermodel.CellStyle;
|
||||||
import org.apache.poi.ss.usermodel.Footer;
|
import org.apache.poi.ss.usermodel.Footer;
|
||||||
import org.apache.poi.ss.usermodel.Header;
|
import org.apache.poi.ss.usermodel.Header;
|
||||||
|
Loading…
Reference in New Issue
Block a user