/**
* Returns a property map, which is only used as a fallback, i.e. if available, the correct map
* for {@link DocumentSummaryInformation} or {@link SummaryInformation} should be used.
+ *
+ * @return the resulting property map
*/
public static synchronized PropertyIDMap getFallbackProperties() {
if (fallbackProperties == null) {
* @return string representation
*/
public String toString() {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append( "[SST]\n" );
buffer.append( " .numstrings = " )
for ( int k = 0; k < field_3_strings.size(); k++ )
{
UnicodeString s = field_3_strings.get( k );
- buffer.append( " .string_" + k + " = " )
+ buffer.append(" .string_").append(k).append(" = ")
.append( s.getDebugInfo() ).append( "\n" );
}
buffer.append( "[/SST]\n" );
* <P>
* The data consists of sets of string data. This string data is
* arranged as follows:
- * </P><P>
+ * </P>
* <pre>
* short string_length; // length of string data
* byte string_flag; // flag specifying special string
* byte[] extension; // optional extension (length of array
* // is extend_length)
* </pre>
- * </P><P>
+ * <P>
* The string_flag is bit mapped as follows:
- * </P><P>
+ * </P>
+ * <P>
* <TABLE summary="string_flag mapping">
* <TR>
* <TH>Bit number</TH>
* Stores the cached result of a text formula
*/
public final class StringRecord extends ContinuableRecord {
-
public final static short sid = 0x0207;
private boolean _is16bitUnicode;
private String _text;
-
- public StringRecord()
- {
+ public StringRecord() {
}
/**
- * @param in the RecordInputstream to read the record from
+ * @param in the RecordInputStream to read the record from
*/
public StringRecord( RecordInputStream in) {
int field_1_string_length = in.readUShort();
}
}
-
protected void serialize(ContinuableRecordOutput out) {
out.writeShort(_text.length());
out.writeStringData(_text);
}
-
public short getSid()
{
return sid;
return _text;
}
-
/**
* Sets the string represented by this record.
+ *
+ * @param string The string-value for this record
*/
public void setString(String string) {
_text = string;
_is16bitUnicode = StringUtil.hasMultibyte(string);
}
- public String toString()
- {
- StringBuffer buffer = new StringBuffer();
-
- buffer.append("[STRING]\n");
- buffer.append(" .string = ")
- .append(_text).append("\n");
- buffer.append("[/STRING]\n");
- return buffer.toString();
+ public String toString() {
+ return "[STRING]\n" +
+ " .string = " + _text + "\n" +
+ "[/STRING]\n";
}
public Object clone() {
/**
* set the row or column level of the style (if builtin 1||2)
+ *
+ * @param level The outline-level
*/
public void setOutlineStyleLevel(int level) {
field_3_outline_style_level = level & 0x00FF;
/**
* Sets the Horizontal text alignment field value.
+ *
+ * @param value The horizontal alignment, use one of the HORIZONTAL_TEXT_ALIGNMENT_... constants in this class
*/
public void setHorizontalTextAlignment(int value) {
field_1_options = HorizontalTextAlignment.setValue(field_1_options, value);
/**
* Sets the Vertical text alignment field value.
+ *
+ * @param value The vertical alignment, use one of the VERTIUCAL_TEST_ALIGNMENT_... constants in this class
*/
public void setVerticalTextAlignment(int value) {
field_1_options = VerticalTextAlignment.setValue(field_1_options, value);
/**
* Sets the text locked field value.
+ *
+ * @param value If the text should be locked
*/
public void setTextLocked(boolean value) {
field_1_options = textLocked.setBoolean(field_1_options, value);
}
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("[TXO]\n");
sb.append(" .options = ").append(HexDump.shortToHex(field_1_options)).append("\n");
public Object clone() {
TextObjectRecord rec = new TextObjectRecord();
- rec._text = _text;
rec.field_1_options = field_1_options;
rec.field_2_textOrientation = field_2_textOrientation;
/**
* These BIFF record types are known but still uninterpreted by POI
*
+ * @param sid The identifier for an unknown record type
+ *
* @return the documented name of this BIFF record type, <code>null</code> if unknown to POI
*/
public static String getBiffName(int sid) {
private static final BitField alternateexpression = BitFieldFactory.getInstance(0x40); // whether to use alternate expression eval
private static final BitField alternateformula = BitFieldFactory.getInstance(0x80); // whether to use alternate formula entry
- public WSBoolRecord()
- {
+ public WSBoolRecord() {
}
- public WSBoolRecord(RecordInputStream in)
- {
+ public WSBoolRecord(RecordInputStream in) {
byte[] data = in.readRemainder();
field_1_wsbool =
data[ 1 ]; // backwards because theoretically this is one short field
/**
* set first byte (see bit setters)
+ *
+ * @param bool1 Set boolean 1 of this record
*/
-
- public void setWSBool1(byte bool1)
- {
+ public void setWSBool1(byte bool1) {
field_1_wsbool = bool1;
}
* show automatic page breaks or not
* @param ab whether to show auto page breaks
*/
-
public void setAutobreaks(boolean ab)
{
field_1_wsbool = autobreaks.setByteBoolean(field_1_wsbool, ab);
* set whether sheet is a dialog sheet or not
* @param isDialog or not
*/
-
public void setDialog(boolean isDialog)
{
field_1_wsbool = dialog.setByteBoolean(field_1_wsbool, isDialog);
* set if row summaries appear below detail in the outline
* @param below or not
*/
-
public void setRowSumsBelow(boolean below)
{
field_1_wsbool = rowsumsbelow.setByteBoolean(field_1_wsbool, below);
* set if col summaries appear right of the detail in the outline
* @param right or not
*/
-
public void setRowSumsRight(boolean right)
{
field_1_wsbool = rowsumsright.setByteBoolean(field_1_wsbool, right);
/**
* set the second byte (see bit setters)
+ *
+ * @param bool2 Set boolean 2 of this record
*/
-
public void setWSBool2(byte bool2)
{
field_2_wsbool = bool2;
* fit to page option is on
* @param fit2page fit or not
*/
-
public void setFitToPage(boolean fit2page)
{
field_2_wsbool = fittopage.setByteBoolean(field_2_wsbool, fit2page);
*
* @param guts or no guts (or glory)
*/
-
public void setDisplayGuts(boolean guts)
{
field_2_wsbool = displayguts.setByteBoolean(field_2_wsbool, guts);
* whether alternate expression evaluation is on
* @param altexp alternative expression evaluation or not
*/
-
public void setAlternateExpression(boolean altexp)
{
field_2_wsbool = alternateexpression.setByteBoolean(field_2_wsbool,
* whether alternative formula entry is on
* @param formula alternative formulas or not
*/
-
public void setAlternateFormula(boolean formula)
{
field_2_wsbool = alternateformula.setByteBoolean(field_2_wsbool,
/**
* get first byte (see bit getters)
+ *
+ * @return boolean 1 of this record
*/
-
public byte getWSBool1()
{
return field_1_wsbool;
* show automatic page breaks or not
* @return whether to show auto page breaks
*/
-
public boolean getAutobreaks()
{
return autobreaks.isSet(field_1_wsbool);
* get whether sheet is a dialog sheet or not
* @return isDialog or not
*/
-
public boolean getDialog()
{
return dialog.isSet(field_1_wsbool);
* get if row summaries appear below detail in the outline
* @return below or not
*/
-
public boolean getRowSumsBelow()
{
return rowsumsbelow.isSet(field_1_wsbool);
* get if col summaries appear right of the detail in the outline
* @return right or not
*/
-
public boolean getRowSumsRight()
{
return rowsumsright.isSet(field_1_wsbool);
/**
* get the second byte (see bit getters)
+ *
+ * @return boolean 1 of this record
*/
-
- public byte getWSBool2()
- {
+ public byte getWSBool2() {
return field_2_wsbool;
}
* fit to page option is on
* @return fit or not
*/
-
- public boolean getFitToPage()
- {
+ public boolean getFitToPage() {
return fittopage.isSet(field_2_wsbool);
}
*
* @return guts or no guts (or glory)
*/
-
- public boolean getDisplayGuts()
- {
+ public boolean getDisplayGuts() {
return displayguts.isSet(field_2_wsbool);
}
* whether alternate expression evaluation is on
* @return alternative expression evaluation or not
*/
-
- public boolean getAlternateExpression()
- {
+ public boolean getAlternateExpression() {
return alternateexpression.isSet(field_2_wsbool);
}
* whether alternative formula entry is on
* @return alternative formulas or not
*/
-
- public boolean getAlternateFormula()
- {
+ public boolean getAlternateFormula() {
return alternateformula.isSet(field_2_wsbool);
}
/**
* set the options bitmask or just use the bit setters.
- * @param options
+ *
+ * @param options Which options to set for this record
*/
-
public void setOptions(short options)
{
field_1_options = options;
* set whether the window should display formulas
* @param formulas or not
*/
-
public void setDisplayFormulas(boolean formulas)
{
field_1_options = displayFormulas.setShortBoolean(field_1_options, formulas);
* set whether the window should display gridlines
* @param gridlines or not
*/
-
public void setDisplayGridlines(boolean gridlines)
{
field_1_options = displayGridlines.setShortBoolean(field_1_options, gridlines);
* set whether the window should display row and column headings
* @param headings or not
*/
-
public void setDisplayRowColHeadings(boolean headings)
{
field_1_options = displayRowColHeadings.setShortBoolean(field_1_options, headings);
* set whether the window should freeze panes
* @param freezepanes freeze panes or not
*/
-
public void setFreezePanes(boolean freezepanes)
{
field_1_options = freezePanes.setShortBoolean(field_1_options, freezepanes);
* set whether the window should display zero values
* @param zeros or not
*/
-
public void setDisplayZeros(boolean zeros)
{
field_1_options = displayZeros.setShortBoolean(field_1_options, zeros);
* set whether the window should display a default header
* @param header or not
*/
-
public void setDefaultHeader(boolean header)
{
field_1_options = defaultHeader.setShortBoolean(field_1_options, header);
* is this arabic?
* @param isarabic arabic or not
*/
-
public void setArabic(boolean isarabic)
{
field_1_options = arabic.setShortBoolean(field_1_options, isarabic);
* set whether the outline symbols are displaed
* @param guts symbols or not
*/
-
public void setDisplayGuts(boolean guts)
{
field_1_options = displayGuts.setShortBoolean(field_1_options, guts);
* freeze unsplit panes or not
* @param freeze or not
*/
-
public void setFreezePanesNoSplit(boolean freeze)
{
field_1_options = freezePanesNoSplit.setShortBoolean(field_1_options, freeze);
* sheet tab is selected
* @param sel selected or not
*/
-
public void setSelected(boolean sel)
{
field_1_options = selected.setShortBoolean(field_1_options, sel);
* was the sheet saved in page break view
* @param p pagebreaksaved or not
*/
-
public void setSavedInPageBreakPreview(boolean p)
{
field_1_options = savedInPageBreakPreview.setShortBoolean(field_1_options, p);
* set the top row visible in the window
* @param topRow top row visible
*/
-
public void setTopRow(short topRow)
{
field_2_top_row = topRow;
* set the leftmost column displayed in the window
* @param leftCol leftmost column
*/
-
public void setLeftCol(short leftCol)
{
field_3_left_col = leftCol;
/**
* set the palette index for the header color
- * @param color
+ *
+ * @param color Which color to use for the header, see the specification for details
*/
-
public void setHeaderColor(int color)
{
field_4_header_color = color;
}
/**
- * zoom magification in page break view
- * @param zoom
+ * zoom magnification in page break view
+ *
+ * @param zoom The zoom-level to use for the page-break view
*/
-
public void setPageBreakZoom(short zoom)
{
field_5_page_break_zoom = zoom;
/**
* set the zoom magnification in normal view
- * @param zoom
+ *
+ * @param zoom The zoom-level to use for the normal view
*/
-
public void setNormalZoom(short zoom)
{
field_6_normal_zoom = zoom;
/**
* set the reserved (don't do this) value
+ *
+ * @param reserved reserved value usually does not need to be set
*/
-
public void setReserved(int reserved)
{
field_7_reserved = reserved;
* get the options bitmask or just use the bit setters.
* @return options
*/
-
public short getOptions()
{
return field_1_options;
* get whether the window should display formulas
* @return formulas or not
*/
-
public boolean getDisplayFormulas()
{
return displayFormulas.isSet(field_1_options);
* get whether the window should display gridlines
* @return gridlines or not
*/
-
public boolean getDisplayGridlines()
{
return displayGridlines.isSet(field_1_options);
* get whether the window should display row and column headings
* @return headings or not
*/
-
public boolean getDisplayRowColHeadings()
{
return displayRowColHeadings.isSet(field_1_options);
* get whether the window should freeze panes
* @return freeze panes or not
*/
-
public boolean getFreezePanes()
{
return freezePanes.isSet(field_1_options);
* get whether the window should display zero values
* @return zeros or not
*/
-
public boolean getDisplayZeros()
{
return displayZeros.isSet(field_1_options);
* get whether the window should display a default header
* @return header or not
*/
-
public boolean getDefaultHeader()
{
return defaultHeader.isSet(field_1_options);
* is this arabic?
* @return arabic or not
*/
-
public boolean getArabic()
{
return arabic.isSet(field_1_options);
* get whether the outline symbols are displaed
* @return symbols or not
*/
-
public boolean getDisplayGuts()
{
return displayGuts.isSet(field_1_options);
* freeze unsplit panes or not
* @return freeze or not
*/
-
public boolean getFreezePanesNoSplit()
{
return freezePanesNoSplit.isSet(field_1_options);
* sheet tab is selected
* @return selected or not
*/
-
public boolean getSelected()
{
return selected.isSet(field_1_options);
* is the sheet currently displayed in the window
* @return displayed or not
*/
-
public boolean isActive() {
return active.isSet(field_1_options);
}
* was the sheet saved in page break view
* @return pagebreaksaved or not
*/
-
public boolean getSavedInPageBreakPreview()
{
return savedInPageBreakPreview.isSet(field_1_options);
* get the top row visible in the window
* @return toprow
*/
-
public short getTopRow()
{
return field_2_top_row;
* get the leftmost column displayed in the window
* @return leftmost
*/
-
public short getLeftCol()
{
return field_3_left_col;
* get the palette index for the header color
* @return color
*/
-
public int getHeaderColor()
{
return field_4_header_color;
* zoom magification in page break view
* @return zoom
*/
-
public short getPageBreakZoom()
{
return field_5_page_break_zoom;
* get the zoom magnification in normal view
* @return zoom
*/
-
public short getNormalZoom()
{
return field_6_normal_zoom;
* get the reserved bits - why would you do this?
* @return reserved stuff -probably garbage
*/
-
public int getReserved()
{
return field_7_reserved;
}
- public String toString()
- {
- StringBuffer buffer = new StringBuffer();
-
- buffer.append("[WINDOW2]\n");
- buffer.append(" .options = ")
- .append(Integer.toHexString(getOptions())).append("\n");
- buffer.append(" .dispformulas= ").append(getDisplayFormulas())
- .append("\n");
- buffer.append(" .dispgridlins= ").append(getDisplayGridlines())
- .append("\n");
- buffer.append(" .disprcheadin= ")
- .append(getDisplayRowColHeadings()).append("\n");
- buffer.append(" .freezepanes = ").append(getFreezePanes())
- .append("\n");
- buffer.append(" .displayzeros= ").append(getDisplayZeros())
- .append("\n");
- buffer.append(" .defaultheadr= ").append(getDefaultHeader())
- .append("\n");
- buffer.append(" .arabic = ").append(getArabic())
- .append("\n");
- buffer.append(" .displayguts = ").append(getDisplayGuts())
- .append("\n");
- buffer.append(" .frzpnsnosplt= ")
- .append(getFreezePanesNoSplit()).append("\n");
- buffer.append(" .selected = ").append(getSelected())
- .append("\n");
- buffer.append(" .active = ").append(isActive())
- .append("\n");
- buffer.append(" .svdinpgbrkpv= ")
- .append(getSavedInPageBreakPreview()).append("\n");
- buffer.append(" .toprow = ")
- .append(Integer.toHexString(getTopRow())).append("\n");
- buffer.append(" .leftcol = ")
- .append(Integer.toHexString(getLeftCol())).append("\n");
- buffer.append(" .headercolor = ")
- .append(Integer.toHexString(getHeaderColor())).append("\n");
- buffer.append(" .pagebreakzoom = ")
- .append(Integer.toHexString(getPageBreakZoom())).append("\n");
- buffer.append(" .normalzoom = ")
- .append(Integer.toHexString(getNormalZoom())).append("\n");
- buffer.append(" .reserved = ")
- .append(Integer.toHexString(getReserved())).append("\n");
- buffer.append("[/WINDOW2]\n");
- return buffer.toString();
+ public String toString() {
+ return "[WINDOW2]\n" +
+ " .options = " + Integer.toHexString(getOptions()) + "\n" +
+ " .dispformulas= " + getDisplayFormulas() + "\n" +
+ " .dispgridlins= " + getDisplayGridlines() + "\n" +
+ " .disprcheadin= " + getDisplayRowColHeadings() + "\n" +
+ " .freezepanes = " + getFreezePanes() + "\n" +
+ " .displayzeros= " + getDisplayZeros() + "\n" +
+ " .defaultheadr= " + getDefaultHeader() + "\n" +
+ " .arabic = " + getArabic() + "\n" +
+ " .displayguts = " + getDisplayGuts() + "\n" +
+ " .frzpnsnosplt= " + getFreezePanesNoSplit() + "\n" +
+ " .selected = " + getSelected() + "\n" +
+ " .active = " + isActive() + "\n" +
+ " .svdinpgbrkpv= " + getSavedInPageBreakPreview() + "\n" +
+ " .toprow = " + Integer.toHexString(getTopRow()) + "\n" +
+ " .leftcol = " + Integer.toHexString(getLeftCol()) + "\n" +
+ " .headercolor = " + Integer.toHexString(getHeaderColor()) + "\n" +
+ " .pagebreakzoom = " + Integer.toHexString(getPageBreakZoom()) + "\n" +
+ " .normalzoom = " + Integer.toHexString(getNormalZoom()) + "\n" +
+ " .reserved = " + Integer.toHexString(getReserved()) + "\n" +
+ "[/WINDOW2]\n";
}
public void serialize(LittleEndianOutput out) {
/**
* Create a deep clone of the record
+ *
+ * @return A new object with the same values as this record
*/
public CFRecordsAggregate cloneCFAggregate() {
CFRuleBase[] newRecs = new CFRuleBase[rules.size()];
}
/**
+ * @param shifter The {@link FormulaShifter} to use
+ * @param currentExternSheetIx The index for extern sheets
+ *
* @return <code>false</code> if this whole {@link CFHeaderRecord} / {@link CFRuleRecord}s should be deleted
*/
public boolean updateFormulasAfterCellShift(FormulaShifter shifter, int currentExternSheetIx) {
* that they should be written to file. Implementors may or may not return the actual
* {@link Record}s being used to manage POI's internal implementation. Callers should not
* assume either way, and therefore only attempt to modify those {@link Record}s after cloning
+ *
+ * @param rv The visitor to use for callbacks while walking this object
*/
public abstract void visitContainedRecords(RecordVisitor rv);
private InternalWorkbook _book;
private LabelSSTRecord _record;
- public HSSFRichTextString()
- {
+ public HSSFRichTextString() {
this("");
}
* @param endIndex The end index to apply the font to (exclusive)
* @param fontIndex The font to use.
*/
- public void applyFont(int startIndex, int endIndex, short fontIndex)
- {
+ public void applyFont(int startIndex, int endIndex, short fontIndex) {
if (startIndex > endIndex)
throw new IllegalArgumentException("Start index must be less than end index.");
if (startIndex < 0 || endIndex > length())
* @param endIndex The end index to apply to font to (exclusive)
* @param font The index of the font to use.
*/
- public void applyFont(int startIndex, int endIndex, Font font)
- {
+ public void applyFont(int startIndex, int endIndex, Font font) {
applyFont(startIndex, endIndex, font.getIndex());
}
* Sets the font of the entire string.
* @param font The font to use.
*/
- public void applyFont(Font font)
- {
+ public void applyFont(Font font) {
applyFont(0, _string.getCharCount(), font);
}
/**
* Returns the plain string representation.
*/
- public String getString()
- {
+ public String getString() {
return _string.getString();
}
* index or null if no font is being applied or the
* index is out of range.
*/
- public short getFontAtIndex( int index )
- {
+ public short getFontAtIndex( int index ) {
int size = _string.getFormatRunCount();
UnicodeString.FormatRun currentRun = null;
for (int i=0;i<size;i++) {
*
* @see #NO_FONT
*/
- public int numFormattingRuns()
- {
+ public int numFormattingRuns() {
return _string.getFormatRunCount();
}
* @param index the index of the formatting run
* @return the index within the string.
*/
- public int getIndexOfFormattingRun(int index)
- {
+ public int getIndexOfFormattingRun(int index) {
UnicodeString.FormatRun r = _string.getFormatRun(index);
return r.getCharacterPos();
}
* @param index the index of the formatting run
* @return the font number used.
*/
- public short getFontOfFormattingRun(int index)
- {
+ public short getFontOfFormattingRun(int index) {
UnicodeString.FormatRun r = _string.getFormatRun(index);
return r.getFontIndex();
}
/**
* @return the plain text representation of this string.
*/
- public String toString()
- {
+ public String toString() {
return _string.toString();
}
*
* @param fontIndex the font to apply.
*/
- public void applyFont( short fontIndex )
- {
+ public void applyFont( short fontIndex ) {
applyFont(0, _string.getCharCount(), fontIndex);
}
}
import org.apache.poi.ss.usermodel.RichTextString;
import org.apache.poi.ss.usermodel.SimpleShape;
+import static org.apache.poi.hssf.record.TextObjectRecord.HORIZONTAL_TEXT_ALIGNMENT_CENTERED;
+import static org.apache.poi.hssf.record.TextObjectRecord.VERTICAL_TEXT_ALIGNMENT_CENTER;
+
/**
* Represents a simple shape such as a line, rectangle or oval.
*/
protected TextObjectRecord createTextObjRecord(){
TextObjectRecord obj = new TextObjectRecord();
- obj.setHorizontalTextAlignment(2);
- obj.setVerticalTextAlignment(2);
+ obj.setHorizontalTextAlignment(HORIZONTAL_TEXT_ALIGNMENT_CENTERED);
+ obj.setVerticalTextAlignment(VERTICAL_TEXT_ALIGNMENT_CENTER);
obj.setTextLocked(true);
obj.setTextOrientation(TextObjectRecord.TEXT_ORIENTATION_NONE);
obj.setStr(new HSSFRichTextString(""));
/**
* A path command in DrawingML. One of:
*
- * <li>arcTo
- * <li>moveTo
- * <li>lineTo
- * <li>cubicBezTo
- * <li>quadBezTo
- * <li>close
+ *<ul>
+ * <li>arcTo</li>
+ * <li>moveTo/li>
+ * <li>lineTo/li>
+ * <li>cubicBezTo/li>
+ * <li>quadBezTo/li>
+ * <li>close/li>
+ * </ul>
*/
public interface PathCommand {
/**
* The amount of vertical white space before the paragraph
* This may be specified in two different ways, percentage spacing and font point spacing:
* <p>
- * If spaceBefore >= 0, then space is a percentage of normal line height.
- * If spaceBefore < 0, the absolute value in points
+ * If spaceBefore >= 0, then space is a percentage of normal line height.
+ * If spaceBefore < 0, the absolute value in points
* </p>
*
* @return the vertical white space before the paragraph, or null if unset
* Set the amount of vertical white space that will be present before the paragraph.
* This space is specified in either percentage or points:
* <p>
- * If spaceBefore >= 0, then space is a percentage of normal line height.
- * If spaceBefore < 0, the absolute value of linespacing is the spacing in points
+ * If spaceBefore >= 0, then space is a percentage of normal line height.
+ * If spaceBefore < 0, the absolute value of linespacing is the spacing in points
* </p>
* Examples:
* <pre><code>
* The amount of vertical white space after the paragraph
* This may be specified in two different ways, percentage spacing and font point spacing:
* <p>
- * If spaceBefore >= 0, then space is a percentage of normal line height.
- * If spaceBefore < 0, the absolute value of linespacing is the spacing in points
+ * If spaceBefore >= 0, then space is a percentage of normal line height.
+ * If spaceBefore < 0, the absolute value of linespacing is the spacing in points
* </p>
*
* @return the vertical white space after the paragraph or null, if unset
* Set the amount of vertical white space that will be present after the paragraph.
* This space is specified in either percentage or points:
* <p>
- * If spaceAfter >= 0, then space is a percentage of normal line height.
- * If spaceAfter < 0, the absolute value of linespacing is the spacing in points
+ * If spaceAfter >= 0, then space is a percentage of normal line height.
+ * If spaceAfter < 0, the absolute value of linespacing is the spacing in points
* </p>
* Examples:
* <pre><code>
* This element specifies the vertical line spacing that is to be used within a paragraph.
* This may be specified in two different ways, percentage spacing and font point spacing:
* <p>
- * If linespacing >= 0, then linespacing is a percentage of normal line height
- * If linespacing < 0, the absolute value of linespacing is the spacing in points
+ * If linespacing >= 0, then linespacing is a percentage of normal line height
+ * If linespacing < 0, the absolute value of linespacing is the spacing in points
* </p>
* Examples:
* <pre><code>
* <p>
* Returns a single value e.g. a cell formula result or boolean value for conditional formatting.
*
- * @param formula
+ * @param formula The formula to evaluate
* @param target cell context for the operation
* @param region containing the cell
* @return value
* offset position relative to the top left of the range.
* <p>
* Returns a ValueEval that may be one or more values, such as the allowed values for a data validation constraint.
- *
- * @param formula
+ *
+ * @param formula The formula to evaluate
* @param target cell context for the operation
* @param region containing the cell
* @return ValueEval for one or more values
private static final String Digits = "(\\p{Digit}+)";
private static final String Exp = "[eE][+-]?"+Digits;
private static final String fpRegex =
- ("[\\x00-\\x20]*" +
- "[+-]?(" +
- "((("+Digits+"(\\.)?("+Digits+"?)("+Exp+")?)|"+
- "(\\.("+Digits+")("+Exp+")?))))"+
+ ("[\\x00-\\x20]*" +
+ "[+-]?(" +
+ "("+Digits+"(\\.)?("+Digits+"?)("+Exp+")?)|"+
+ "(\\."+Digits+"("+Exp+")?))"+
"[\\x00-\\x20]*");
* @param srcCellCol used when arg is a single row AreaRef
* @return a <tt>NumberEval</tt>, <tt>StringEval</tt>, <tt>BoolEval</tt> or <tt>BlankEval</tt>.
* Never <code>null</code> or <tt>ErrorEval</tt>.
- * @throws EvaluationException(#VALUE!) if srcCellRow or srcCellCol do not properly index into
+ * @throws EvaluationException if srcCellRow or srcCellCol do not properly index into
* an AreaEval. If the actual value retrieved is an ErrorEval, a corresponding
* EvaluationException is thrown.
*/
* @param ev must be a {@link NumberEval}, {@link StringEval}, {@link BoolEval} or
* {@link BlankEval}
* @return actual, parsed or interpreted double value (respectively).
- * @throws EvaluationException(#VALUE!) only if a StringEval is supplied and cannot be parsed
+ * @throws EvaluationException if a StringEval is supplied and cannot be parsed
* as a double (See <tt>parseDouble()</tt> for allowable formats).
* @throws RuntimeException if the supplied parameter is not {@link NumberEval},
* {@link StringEval}, {@link BoolEval} or {@link BlankEval}
return Boolean.valueOf(((BoolEval) ve).getBooleanValue());
}
- if (ve == BlankEval.instance) {
- return null;
- }
-
if (ve instanceof StringEval) {
if (stringsAreBlanks) {
return null;
* for the relational operators Evals.
*
* <pre>
- * Bool.TRUE > any number.
- * Bool > any string. ALWAYS
- * Bool.TRUE > Bool.FALSE
+ * Bool.TRUE > any number.
+ * Bool > any string. ALWAYS
+ * Bool.TRUE > Bool.FALSE
* Bool.FALSE == Blank
*
* Strings are never converted to numbers or booleans
- * String > any number. ALWAYS
- * Non-empty String > Blank
+ * String > any number. ALWAYS
+ * Non-empty String > Blank
* Empty String == Blank
* String are sorted dictionary wise
*
- * Blank > Negative numbers
+ * Blank > Negative numbers
* Blank == 0
* Blank < Positive numbers
* </pre>
void setCharSet(int charset);
/**
- * get the index within the XSSFWorkbook (sequence within the collection of Font objects)
+ * Get the index within the XSSFWorkbook (sequence within the collection of Font objects)
*
* @return unique index number of the underlying record this Font represents (probably you don't care
* unless you're comparing which one is which)
/**
* Update conditional formatting
- * @param formulaShifter
+ * @param formulaShifter The {@link FormulaShifter} to use
*/
public abstract void updateConditionalFormatting(FormulaShifter formulaShifter);
"02 00 00 00 00 00 00 00 "
);
-
public void testLoad() {
RecordInputStream in = TestcaseRecordInputStream.create(data);
TextObjectRecord record = new TextObjectRecord(in);
assertEquals(TextObjectRecord.HORIZONTAL_TEXT_ALIGNMENT_CENTERED, record.getHorizontalTextAlignment());
assertEquals(TextObjectRecord.VERTICAL_TEXT_ALIGNMENT_JUSTIFY, record.getVerticalTextAlignment());
- assertEquals(true, record.isTextLocked());
+ assertTrue(record.isTextLocked());
assertEquals(TextObjectRecord.TEXT_ORIENTATION_ROT_RIGHT, record.getTextOrientation());
assertEquals(49, record.getRecordSize() );
}
- public void testStore()
- {
+ public void testStore() {
TextObjectRecord record = new TextObjectRecord();
-
HSSFRichTextString str = new HSSFRichTextString("AB");
str.applyFont(0, 2, (short)0x0018);
str.applyFont(2, 2, (short)0x0320);
public final class TestOperandResolver extends TestCase {
public void testParseDouble_bug48472() {
-
- String value = "-";
-
- Double resolvedValue = null;
+ final Double resolvedValue;
try {
- resolvedValue = OperandResolver.parseDouble(value);
+ resolvedValue = OperandResolver.parseDouble("-");
} catch (StringIndexOutOfBoundsException e) {
throw new AssertionFailedError("Identified bug 48472");
}
-
- assertEquals(null, resolvedValue);
-
+
+ assertNull(resolvedValue);
}
public void testParseDouble_bug49723() {
-
String value = ".1";
- Double resolvedValue = null;
-
- resolvedValue = OperandResolver.parseDouble(value);
+ Double resolvedValue = OperandResolver.parseDouble(value);
assertNotNull("Identified bug 49723", resolvedValue);
-
}
/**
*
*/
public void testParseDoubleValidStrings() {
-
- String[] values = new String[]{".19", "0.19", "1.9", "1E4", "-.19", "-0.19", "8.5","-1E4", ".5E6","+1.5","+1E5", " +1E5 "};
-
+ String[] values = new String[]{".19", "0.19", "1.9", "1E4", "-.19", "-0.19",
+ "8.5","-1E4", ".5E6","+1.5","+1E5", " +1E5 ", " 123 ", "1E4", "-123" };
+
for (String value : values) {
- assertTrue(OperandResolver.parseDouble(value) != null);
+ assertNotNull(OperandResolver.parseDouble(value));
assertEquals(OperandResolver.parseDouble(value), Double.parseDouble(value));
}
-
}
/**
*
*/
public void testParseDoubleInvalidStrings() {
-
String[] values = new String[]{"-", "ABC", "-X", "1E5a", "Infinity", "NaN", ".5F", "1,000"};
for (String value : values) {
- assertEquals(null, OperandResolver.parseDouble(value));
+ assertNull(OperandResolver.parseDouble(value));
}
-
}
-
}