mirror of https://github.com/apache/poi.git
Made Formula Record cough up some info useful for debugging, made functions
get written, but they crash excel right now. Areas seem to basically work. I need to investigate further, at first glance, our xls looks the same as Excel's. Have to find out what its doing to make it crash like that. PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352551 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
96e085fb8c
commit
d20b0f6353
|
@ -365,6 +365,9 @@ public class FormulaRecord
|
||||||
}
|
}
|
||||||
return getRecordSize();
|
return getRecordSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public int getRecordSize()
|
public int getRecordSize()
|
||||||
{
|
{
|
||||||
|
@ -504,4 +507,43 @@ public class FormulaRecord
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
if (EXPERIMENTAL_FORMULA_SUPPORT_ENABLED) {
|
||||||
|
buffer.append("[FORMULA]\n");
|
||||||
|
buffer.append(" .row = ")
|
||||||
|
.append(Integer.toHexString(getRow())).append("\n");
|
||||||
|
buffer.append(" .column = ")
|
||||||
|
.append(Integer.toHexString(getColumn()))
|
||||||
|
.append("\n");
|
||||||
|
buffer.append(" .xf = ")
|
||||||
|
.append(Integer.toHexString(getXFIndex())).append("\n");
|
||||||
|
buffer.append(" .value = ").append(getValue())
|
||||||
|
.append("\n");
|
||||||
|
buffer.append(" .options = ").append(getOptions())
|
||||||
|
.append("\n");
|
||||||
|
buffer.append(" .zero = ").append(field_6_zero)
|
||||||
|
.append("\n");
|
||||||
|
buffer.append(" .expressionlength= ").append(getExpressionLength())
|
||||||
|
.append("\n");
|
||||||
|
buffer.append(" .numptgsinarray = ").append(field_8_parsed_expr.size())
|
||||||
|
.append("\n");
|
||||||
|
|
||||||
|
|
||||||
|
for (int k = 0; k < field_8_parsed_expr.size(); k++ ) {
|
||||||
|
buffer.append("formula ").append(k).append(" ")
|
||||||
|
.append(((Ptg)field_8_parsed_expr.get(k)).toFormulaString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
buffer.append("[/FORMULA]\n");
|
||||||
|
} else {
|
||||||
|
buffer.append(super.toString());
|
||||||
|
}
|
||||||
|
return buffer.toString();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public class FunctionPtg extends OperationPtg {
|
public class FunctionPtg extends OperationPtg {
|
||||||
public final static short sid = 0x22;
|
public final static short sid = 0x22;
|
||||||
private final static int SIZE = 2;
|
private final static int SIZE = 3;
|
||||||
|
|
||||||
private byte field_1_num_args;
|
private byte field_1_num_args;
|
||||||
private byte field_2_fnc_index;
|
private byte field_2_fnc_index;
|
||||||
|
@ -27,6 +27,14 @@ public class FunctionPtg extends OperationPtg {
|
||||||
public FunctionPtg() {
|
public FunctionPtg() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FunctionPtg(byte[] data, int offset) {
|
||||||
|
offset++;
|
||||||
|
field_1_num_args = data[ offset + 0 ];
|
||||||
|
field_2_fnc_index = data[offset + 1 ];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public FunctionPtg(String pName, byte pNumOperands) {
|
public FunctionPtg(String pName, byte pNumOperands) {
|
||||||
field_1_num_args = pNumOperands;
|
field_1_num_args = pNumOperands;
|
||||||
field_2_fnc_index = lookupIndex(pName);
|
field_2_fnc_index = lookupIndex(pName);
|
||||||
|
@ -79,8 +87,9 @@ public class FunctionPtg extends OperationPtg {
|
||||||
|
|
||||||
|
|
||||||
public void writeBytes(byte[] array, int offset) {
|
public void writeBytes(byte[] array, int offset) {
|
||||||
array[offset]=field_1_num_args;
|
array[offset+0]=sid;
|
||||||
array[offset]=field_2_fnc_index;
|
array[offset+1]=field_1_num_args;
|
||||||
|
array[offset+2]=field_2_fnc_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
|
|
|
@ -166,6 +166,10 @@ public abstract class Ptg
|
||||||
final int arrayRef = ReferencePtg.sid + 0x40; // excel doesn't really care which one you
|
final int arrayRef = ReferencePtg.sid + 0x40; // excel doesn't really care which one you
|
||||||
// write.
|
// write.
|
||||||
|
|
||||||
|
final int valueFunc = FunctionPtg.sid + 0x20; //note this only matters for READ
|
||||||
|
final int arrayFunc = FunctionPtg.sid + 0x40; // excel doesn't really care which one you
|
||||||
|
// write.
|
||||||
|
|
||||||
|
|
||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
|
@ -227,9 +231,18 @@ public abstract class Ptg
|
||||||
retval = new ParenthesisPtg(data, offset);
|
retval = new ParenthesisPtg(data, offset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ValueVariableFunctionPtg.sid :
|
case FunctionPtg.sid :
|
||||||
retval = new ValueVariableFunctionPtg(data, offset);
|
retval = new FunctionPtg(data, offset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/* case valueFunc :
|
||||||
|
retval = new FunctionPtg(data, offset);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case arrayFunc :
|
||||||
|
retval = new FunctionPtg(data, offset);
|
||||||
|
break;
|
||||||
|
*/
|
||||||
|
|
||||||
case NamePtg.sid :
|
case NamePtg.sid :
|
||||||
retval = new NamePtg(data, offset);
|
retval = new NamePtg(data, offset);
|
||||||
|
|
|
@ -58,6 +58,8 @@ package org.apache.poi.hssf.util;
|
||||||
/**
|
/**
|
||||||
* Title: Range Address <P>
|
* Title: Range Address <P>
|
||||||
* Description: provides connectivity utilities for ranges<P>
|
* Description: provides connectivity utilities for ranges<P>
|
||||||
|
*
|
||||||
|
*
|
||||||
* REFERENCE: <P>
|
* REFERENCE: <P>
|
||||||
* @author IgOr KaTz && EuGeNe BuMaGiN (Tal Moshaiov) (VistaPortal LDT.)
|
* @author IgOr KaTz && EuGeNe BuMaGiN (Tal Moshaiov) (VistaPortal LDT.)
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
|
|
Loading…
Reference in New Issue