HSSF* classes implement same interfaces as XSSF* classes.
git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@614830 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
936e16ac26
commit
45cb22b13a
@ -50,6 +50,10 @@ import org.apache.poi.hssf.record.TextObjectRecord;
|
|||||||
import org.apache.poi.hssf.record.UnicodeString;
|
import org.apache.poi.hssf.record.UnicodeString;
|
||||||
import org.apache.poi.hssf.record.aggregates.FormulaRecordAggregate;
|
import org.apache.poi.hssf.record.aggregates.FormulaRecordAggregate;
|
||||||
import org.apache.poi.hssf.record.formula.Ptg;
|
import org.apache.poi.hssf.record.formula.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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* High level representation of a cell in a row of a spreadsheet.
|
* High level representation of a cell in a row of a spreadsheet.
|
||||||
@ -70,7 +74,7 @@ import org.apache.poi.hssf.record.formula.Ptg;
|
|||||||
* @version 1.0-pre
|
* @version 1.0-pre
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class HSSFCell
|
public class HSSFCell implements Cell
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -590,12 +594,13 @@ public class HSSFCell
|
|||||||
* If value is null then we will change the cell to a Blank cell.
|
* If value is null then we will change the cell to a Blank cell.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void setCellValue(HSSFRichTextString value)
|
public void setCellValue(RichTextString value)
|
||||||
{
|
{
|
||||||
|
HSSFRichTextString hvalue = (HSSFRichTextString) value;
|
||||||
int row=record.getRow();
|
int row=record.getRow();
|
||||||
short col=record.getColumn();
|
short col=record.getColumn();
|
||||||
short styleIndex=record.getXFIndex();
|
short styleIndex=record.getXFIndex();
|
||||||
if (value == null)
|
if (hvalue == null)
|
||||||
{
|
{
|
||||||
setCellType(CELL_TYPE_BLANK, false, row, col, styleIndex);
|
setCellType(CELL_TYPE_BLANK, false, row, col, styleIndex);
|
||||||
}
|
}
|
||||||
@ -607,7 +612,7 @@ public class HSSFCell
|
|||||||
}
|
}
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
UnicodeString str = value.getUnicodeString();
|
UnicodeString str = hvalue.getUnicodeString();
|
||||||
// jmh if (encoding == ENCODING_COMPRESSED_UNICODE)
|
// jmh if (encoding == ENCODING_COMPRESSED_UNICODE)
|
||||||
// jmh {
|
// jmh {
|
||||||
// jmh str.setCompressedUnicode();
|
// jmh str.setCompressedUnicode();
|
||||||
@ -617,7 +622,7 @@ public class HSSFCell
|
|||||||
// jmh }
|
// jmh }
|
||||||
index = book.addSSTString(str);
|
index = book.addSSTString(str);
|
||||||
(( LabelSSTRecord ) record).setSSTIndex(index);
|
(( LabelSSTRecord ) record).setSSTIndex(index);
|
||||||
stringValue = value;
|
stringValue = hvalue;
|
||||||
stringValue.setWorkbookReferences(book, (( LabelSSTRecord ) record));
|
stringValue.setWorkbookReferences(book, (( LabelSSTRecord ) record));
|
||||||
stringValue.setUnicodeString(book.getSSTString(index));
|
stringValue.setUnicodeString(book.getSSTString(index));
|
||||||
}
|
}
|
||||||
@ -873,7 +878,7 @@ public class HSSFCell
|
|||||||
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getCellStyleAt(short)
|
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getCellStyleAt(short)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void setCellStyle(HSSFCellStyle style)
|
public void setCellStyle(CellStyle style)
|
||||||
{
|
{
|
||||||
record.setXFIndex(style.getIndex());
|
record.setXFIndex(style.getIndex());
|
||||||
}
|
}
|
||||||
@ -1000,10 +1005,10 @@ public class HSSFCell
|
|||||||
*
|
*
|
||||||
* @param comment comment associated with this cell
|
* @param comment comment associated with this cell
|
||||||
*/
|
*/
|
||||||
public void setCellComment(HSSFComment comment){
|
public void setCellComment(Comment comment){
|
||||||
comment.setRow((short)record.getRow());
|
comment.setRow((short)record.getRow());
|
||||||
comment.setColumn(record.getColumn());
|
comment.setColumn(record.getColumn());
|
||||||
this.comment = comment;
|
this.comment = (HSSFComment) comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,8 +20,9 @@ package org.apache.poi.hssf.usermodel;
|
|||||||
|
|
||||||
import org.apache.poi.hssf.model.Workbook;
|
import org.apache.poi.hssf.model.Workbook;
|
||||||
import org.apache.poi.hssf.record.ExtendedFormatRecord;
|
import org.apache.poi.hssf.record.ExtendedFormatRecord;
|
||||||
import org.apache.poi.hssf.record.FormatRecord;
|
import org.apache.poi.hssf.util.HSSFColor;
|
||||||
import org.apache.poi.hssf.util.*;
|
import org.apache.poi.ss.usermodel.CellStyle;
|
||||||
|
import org.apache.poi.ss.usermodel.Font;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* High level representation of the style of a cell in a sheet of a workbook.
|
* High level representation of the style of a cell in a sheet of a workbook.
|
||||||
@ -35,7 +36,7 @@ import org.apache.poi.hssf.util.*;
|
|||||||
* @see org.apache.poi.hssf.usermodel.HSSFCell#setCellStyle(HSSFCellStyle)
|
* @see org.apache.poi.hssf.usermodel.HSSFCell#setCellStyle(HSSFCellStyle)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class HSSFCellStyle
|
public class HSSFCellStyle implements CellStyle
|
||||||
{
|
{
|
||||||
private ExtendedFormatRecord format = null;
|
private ExtendedFormatRecord format = null;
|
||||||
private short index = 0;
|
private short index = 0;
|
||||||
@ -287,7 +288,7 @@ public class HSSFCellStyle
|
|||||||
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(short)
|
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(short)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void setFont(HSSFFont font)
|
public void setFont(Font font)
|
||||||
{
|
{
|
||||||
format.setIndentNotParentFont(true);
|
format.setIndentNotParentFont(true);
|
||||||
short fontindex = font.getIndex();
|
short fontindex = font.getIndex();
|
||||||
@ -309,7 +310,7 @@ public class HSSFCellStyle
|
|||||||
* @see org.apache.poi.hssf.usermodel.HSSFCellStyle#getFontIndex()
|
* @see org.apache.poi.hssf.usermodel.HSSFCellStyle#getFontIndex()
|
||||||
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(short)
|
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(short)
|
||||||
*/
|
*/
|
||||||
public HSSFFont getFont(HSSFWorkbook parentWorkbook) {
|
public Font getFont(org.apache.poi.ss.usermodel.Workbook parentWorkbook) {
|
||||||
return parentWorkbook.getFontAt(getFontIndex());
|
return parentWorkbook.getFontAt(getFontIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,21 +16,17 @@
|
|||||||
==================================================================== */
|
==================================================================== */
|
||||||
package org.apache.poi.hssf.usermodel;
|
package org.apache.poi.hssf.usermodel;
|
||||||
|
|
||||||
import org.apache.poi.hssf.record.EscherAggregate;
|
|
||||||
import org.apache.poi.hssf.record.NoteRecord;
|
import org.apache.poi.hssf.record.NoteRecord;
|
||||||
import org.apache.poi.hssf.record.TextObjectRecord;
|
import org.apache.poi.hssf.record.TextObjectRecord;
|
||||||
import org.apache.poi.ddf.*;
|
import org.apache.poi.ss.usermodel.Comment;
|
||||||
|
import org.apache.poi.ss.usermodel.RichTextString;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a cell comment - a sticky note associated with a cell.
|
* Represents a cell comment - a sticky note associated with a cell.
|
||||||
*
|
*
|
||||||
* @author Yegor Kozlov
|
* @author Yegor Kozlov
|
||||||
*/
|
*/
|
||||||
public class HSSFComment extends HSSFTextbox {
|
public class HSSFComment extends HSSFTextbox implements Comment {
|
||||||
|
|
||||||
private boolean visible;
|
private boolean visible;
|
||||||
private short col, row;
|
private short col, row;
|
||||||
@ -147,7 +143,7 @@ public class HSSFComment extends HSSFTextbox {
|
|||||||
*
|
*
|
||||||
* @param string Sets the rich text string used by this object.
|
* @param string Sets the rich text string used by this object.
|
||||||
*/
|
*/
|
||||||
public void setString( HSSFRichTextString string ) {
|
public void setString( RichTextString string ) {
|
||||||
//if font is not set we must set the default one
|
//if font is not set we must set the default one
|
||||||
if (string.numFormattingRuns() == 0) string.applyFont((short)0);
|
if (string.numFormattingRuns() == 0) string.applyFont((short)0);
|
||||||
|
|
||||||
@ -155,7 +151,7 @@ public class HSSFComment extends HSSFTextbox {
|
|||||||
int frLength = ( string.numFormattingRuns() + 1 ) * 8;
|
int frLength = ( string.numFormattingRuns() + 1 ) * 8;
|
||||||
txo.setFormattingRunLength( (short) frLength );
|
txo.setFormattingRunLength( (short) frLength );
|
||||||
txo.setTextLength( (short) string.length() );
|
txo.setTextLength( (short) string.length() );
|
||||||
txo.setStr( string );
|
txo.setStr( (HSSFRichTextString) string );
|
||||||
}
|
}
|
||||||
super.setString(string);
|
super.setString(string);
|
||||||
}
|
}
|
||||||
|
@ -23,14 +23,15 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.poi.hssf.usermodel;
|
package org.apache.poi.hssf.usermodel;
|
||||||
|
|
||||||
import org.apache.poi.hssf.model.Workbook;
|
|
||||||
import org.apache.poi.hssf.record.FormatRecord;
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import org.apache.poi.hssf.model.Workbook;
|
||||||
|
import org.apache.poi.hssf.record.FormatRecord;
|
||||||
|
import org.apache.poi.ss.usermodel.DataFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility to identify builtin formats. Now can handle user defined data formats also. The following is a list of the formats as
|
* Utility to identify builtin formats. Now can handle user defined data formats also. The following is a list of the formats as
|
||||||
* returned by this class.<P>
|
* returned by this class.<P>
|
||||||
@ -79,7 +80,7 @@ import java.util.Vector;
|
|||||||
* @author Shawn M. Laubach (slaubach at apache dot org)
|
* @author Shawn M. Laubach (slaubach at apache dot org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class HSSFDataFormat
|
public class HSSFDataFormat implements DataFormat
|
||||||
{
|
{
|
||||||
private static List builtinFormats = createBuiltinFormats();
|
private static List builtinFormats = createBuiltinFormats();
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
package org.apache.poi.hssf.usermodel;
|
package org.apache.poi.hssf.usermodel;
|
||||||
|
|
||||||
import org.apache.poi.hssf.record.FontRecord;
|
import org.apache.poi.hssf.record.FontRecord;
|
||||||
|
import org.apache.poi.ss.usermodel.Font;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a Font used in a workbook.
|
* Represents a Font used in a workbook.
|
||||||
@ -35,7 +36,7 @@ import org.apache.poi.hssf.record.FontRecord;
|
|||||||
* @see org.apache.poi.hssf.usermodel.HSSFCellStyle#setFont(HSSFFont)
|
* @see org.apache.poi.hssf.usermodel.HSSFCellStyle#setFont(HSSFFont)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class HSSFFont
|
public class HSSFFont implements Font
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
package org.apache.poi.hssf.usermodel;
|
package org.apache.poi.hssf.usermodel;
|
||||||
|
|
||||||
import org.apache.poi.hssf.record.FooterRecord;
|
import org.apache.poi.hssf.record.FooterRecord;
|
||||||
|
import org.apache.poi.ss.usermodel.Footer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to read and manipulate the footer.
|
* Class to read and manipulate the footer.
|
||||||
@ -32,7 +33,7 @@ import org.apache.poi.hssf.record.FooterRecord;
|
|||||||
* <P>
|
* <P>
|
||||||
* @author Shawn Laubach (slaubach at apache dot org)
|
* @author Shawn Laubach (slaubach at apache dot org)
|
||||||
*/
|
*/
|
||||||
public class HSSFFooter extends Object {
|
public class HSSFFooter implements Footer {
|
||||||
|
|
||||||
FooterRecord footerRecord;
|
FooterRecord footerRecord;
|
||||||
String left;
|
String left;
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
package org.apache.poi.hssf.usermodel;
|
package org.apache.poi.hssf.usermodel;
|
||||||
|
|
||||||
import org.apache.poi.hssf.record.HeaderRecord;
|
import org.apache.poi.hssf.record.HeaderRecord;
|
||||||
|
import org.apache.poi.ss.usermodel.Header;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to read and manipulate the header.
|
* Class to read and manipulate the header.
|
||||||
@ -32,7 +33,7 @@ import org.apache.poi.hssf.record.HeaderRecord;
|
|||||||
*
|
*
|
||||||
* @author Shawn Laubach (slaubach at apache dot org)
|
* @author Shawn Laubach (slaubach at apache dot org)
|
||||||
*/
|
*/
|
||||||
public class HSSFHeader
|
public class HSSFHeader implements Header
|
||||||
{
|
{
|
||||||
|
|
||||||
HeaderRecord headerRecord;
|
HeaderRecord headerRecord;
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
package org.apache.poi.hssf.usermodel;
|
package org.apache.poi.hssf.usermodel;
|
||||||
|
|
||||||
import org.apache.poi.hssf.model.Workbook;
|
import org.apache.poi.hssf.model.Workbook;
|
||||||
import org.apache.poi.hssf.record.BoundSheetRecord;
|
|
||||||
import org.apache.poi.hssf.record.NameRecord;
|
import org.apache.poi.hssf.record.NameRecord;
|
||||||
import org.apache.poi.hssf.util.RangeAddress;
|
import org.apache.poi.hssf.util.RangeAddress;
|
||||||
|
import org.apache.poi.ss.usermodel.Name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Title: High Level Represantion of Named Range <P>
|
* Title: High Level Represantion of Named Range <P>
|
||||||
@ -28,7 +28,7 @@ import org.apache.poi.hssf.util.RangeAddress;
|
|||||||
* @author Libin Roman (Vista Portal LDT. Developer)
|
* @author Libin Roman (Vista Portal LDT. Developer)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class HSSFName {
|
public class HSSFName implements Name {
|
||||||
private Workbook book;
|
private Workbook book;
|
||||||
private NameRecord name;
|
private NameRecord name;
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ package org.apache.poi.hssf.usermodel;
|
|||||||
|
|
||||||
import org.apache.poi.hssf.record.PaletteRecord;
|
import org.apache.poi.hssf.record.PaletteRecord;
|
||||||
import org.apache.poi.hssf.util.HSSFColor;
|
import org.apache.poi.hssf.util.HSSFColor;
|
||||||
|
import org.apache.poi.ss.usermodel.Palette;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a workbook color palette.
|
* Represents a workbook color palette.
|
||||||
@ -28,7 +29,7 @@ import org.apache.poi.hssf.util.HSSFColor;
|
|||||||
*
|
*
|
||||||
* @author Brian Sanders (bsanders at risklabs dot com)
|
* @author Brian Sanders (bsanders at risklabs dot com)
|
||||||
*/
|
*/
|
||||||
public class HSSFPalette
|
public class HSSFPalette implements Palette
|
||||||
{
|
{
|
||||||
private PaletteRecord palette;
|
private PaletteRecord palette;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ import org.apache.poi.ddf.EscherComplexProperty;
|
|||||||
import org.apache.poi.ddf.EscherOptRecord;
|
import org.apache.poi.ddf.EscherOptRecord;
|
||||||
import org.apache.poi.ddf.EscherProperty;
|
import org.apache.poi.ddf.EscherProperty;
|
||||||
import org.apache.poi.hssf.record.EscherAggregate;
|
import org.apache.poi.hssf.record.EscherAggregate;
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.ss.usermodel.Patriarch;
|
||||||
import org.apache.poi.util.StringUtil;
|
import org.apache.poi.util.StringUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,7 +35,7 @@ import org.apache.poi.util.StringUtil;
|
|||||||
* @author Glen Stampoultzis (glens at apache.org)
|
* @author Glen Stampoultzis (glens at apache.org)
|
||||||
*/
|
*/
|
||||||
public class HSSFPatriarch
|
public class HSSFPatriarch
|
||||||
implements HSSFShapeContainer
|
implements HSSFShapeContainer, Patriarch
|
||||||
{
|
{
|
||||||
List shapes = new ArrayList();
|
List shapes = new ArrayList();
|
||||||
HSSFSheet sheet;
|
HSSFSheet sheet;
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
package org.apache.poi.hssf.usermodel;
|
package org.apache.poi.hssf.usermodel;
|
||||||
|
|
||||||
import org.apache.poi.hssf.record.PrintSetupRecord;
|
import org.apache.poi.hssf.record.PrintSetupRecord;
|
||||||
|
import org.apache.poi.ss.usermodel.PrintSetup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to modify the print setup.
|
* Used to modify the print setup.
|
||||||
@ -36,16 +37,7 @@ import org.apache.poi.hssf.record.PrintSetupRecord;
|
|||||||
* public static final short ENVELOPE_MONARCH_PAPERSIZE = 37;<br>
|
* public static final short ENVELOPE_MONARCH_PAPERSIZE = 37;<br>
|
||||||
* <P>
|
* <P>
|
||||||
* @author Shawn Laubach (slaubach at apache dot org) */
|
* @author Shawn Laubach (slaubach at apache dot org) */
|
||||||
public class HSSFPrintSetup extends Object {
|
public class HSSFPrintSetup implements PrintSetup {
|
||||||
public static final short LETTER_PAPERSIZE = 1;
|
|
||||||
public static final short LEGAL_PAPERSIZE = 5;
|
|
||||||
public static final short EXECUTIVE_PAPERSIZE = 7;
|
|
||||||
public static final short A4_PAPERSIZE = 9;
|
|
||||||
public static final short A5_PAPERSIZE = 11;
|
|
||||||
public static final short ENVELOPE_10_PAPERSIZE = 20;
|
|
||||||
public static final short ENVELOPE_DL_PAPERSIZE = 27;
|
|
||||||
public static final short ENVELOPE_CS_PAPERSIZE = 28;
|
|
||||||
public static final short ENVELOPE_MONARCH_PAPERSIZE = 37;
|
|
||||||
PrintSetupRecord printSetupRecord;
|
PrintSetupRecord printSetupRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,11 +17,13 @@
|
|||||||
|
|
||||||
package org.apache.poi.hssf.usermodel;
|
package org.apache.poi.hssf.usermodel;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.apache.poi.hssf.model.Workbook;
|
import org.apache.poi.hssf.model.Workbook;
|
||||||
import org.apache.poi.hssf.record.LabelSSTRecord;
|
import org.apache.poi.hssf.record.LabelSSTRecord;
|
||||||
import org.apache.poi.hssf.record.UnicodeString;
|
import org.apache.poi.hssf.record.UnicodeString;
|
||||||
|
import org.apache.poi.ss.usermodel.Font;
|
||||||
import java.util.Iterator;
|
import org.apache.poi.ss.usermodel.RichTextString;
|
||||||
/**
|
/**
|
||||||
* Rich text unicode string. These strings can have fonts applied to
|
* Rich text unicode string. These strings can have fonts applied to
|
||||||
* arbitary parts of the string.
|
* arbitary parts of the string.
|
||||||
@ -30,7 +32,7 @@ import java.util.Iterator;
|
|||||||
* @author Jason Height (jheight at apache.org)
|
* @author Jason Height (jheight at apache.org)
|
||||||
*/
|
*/
|
||||||
public class HSSFRichTextString
|
public class HSSFRichTextString
|
||||||
implements Comparable
|
implements Comparable, RichTextString
|
||||||
{
|
{
|
||||||
/** Place holder for indicating that NO_FONT has been applied here */
|
/** Place holder for indicating that NO_FONT has been applied here */
|
||||||
public static final short NO_FONT = 0;
|
public static final short NO_FONT = 0;
|
||||||
@ -136,7 +138,7 @@ public class HSSFRichTextString
|
|||||||
* @param endIndex The end index to apply to font to (exclusive)
|
* @param endIndex The end index to apply to font to (exclusive)
|
||||||
* @param font The index of the font to use.
|
* @param font The index of the font to use.
|
||||||
*/
|
*/
|
||||||
public void applyFont(int startIndex, int endIndex, HSSFFont font)
|
public void applyFont(int startIndex, int endIndex, Font font)
|
||||||
{
|
{
|
||||||
applyFont(startIndex, endIndex, font.getIndex());
|
applyFont(startIndex, endIndex, font.getIndex());
|
||||||
}
|
}
|
||||||
@ -145,7 +147,7 @@ public class HSSFRichTextString
|
|||||||
* Sets the font of the entire string.
|
* Sets the font of the entire string.
|
||||||
* @param font The font to use.
|
* @param font The font to use.
|
||||||
*/
|
*/
|
||||||
public void applyFont(HSSFFont font)
|
public void applyFont(Font font)
|
||||||
{
|
{
|
||||||
applyFont(0, string.getCharCount(), font);
|
applyFont(0, string.getCharCount(), font);
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,8 @@ import org.apache.poi.hssf.model.Sheet;
|
|||||||
import org.apache.poi.hssf.model.Workbook;
|
import org.apache.poi.hssf.model.Workbook;
|
||||||
import org.apache.poi.hssf.record.CellValueRecordInterface;
|
import org.apache.poi.hssf.record.CellValueRecordInterface;
|
||||||
import org.apache.poi.hssf.record.RowRecord;
|
import org.apache.poi.hssf.record.RowRecord;
|
||||||
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* High level representation of a row of a spreadsheet.
|
* High level representation of a row of a spreadsheet.
|
||||||
@ -40,7 +42,7 @@ import org.apache.poi.hssf.record.RowRecord;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class HSSFRow
|
public class HSSFRow
|
||||||
implements Comparable
|
implements Comparable, Row
|
||||||
{
|
{
|
||||||
|
|
||||||
// used for collections
|
// used for collections
|
||||||
@ -156,26 +158,29 @@ public class HSSFRow
|
|||||||
* remove the HSSFCell from this row.
|
* remove the HSSFCell from this row.
|
||||||
* @param cell to remove
|
* @param cell to remove
|
||||||
*/
|
*/
|
||||||
public void removeCell(HSSFCell cell) {
|
public void removeCell(Cell cell) {
|
||||||
removeCell(cell, true);
|
removeCell(cell, true);
|
||||||
}
|
}
|
||||||
private void removeCell(HSSFCell cell, boolean alsoRemoveRecords) {
|
|
||||||
|
private void removeCell(Cell cell, boolean alsoRemoveRecords) {
|
||||||
|
|
||||||
|
HSSFCell hcell = (HSSFCell) cell;
|
||||||
if(alsoRemoveRecords) {
|
if(alsoRemoveRecords) {
|
||||||
CellValueRecordInterface cval = cell.getCellValueRecord();
|
CellValueRecordInterface cval = hcell.getCellValueRecord();
|
||||||
sheet.removeValueRecord(getRowNum(), cval);
|
sheet.removeValueRecord(getRowNum(), cval);
|
||||||
}
|
}
|
||||||
|
|
||||||
short column=cell.getCellNum();
|
short column=hcell.getCellNum();
|
||||||
if(cell!=null && column<cells.length)
|
if(hcell!=null && column<cells.length)
|
||||||
{
|
{
|
||||||
cells[column]=null;
|
cells[column]=null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cell.getCellNum() == row.getLastCol())
|
if (hcell.getCellNum() == row.getLastCol())
|
||||||
{
|
{
|
||||||
row.setLastCol(findLastCell(row.getLastCol()));
|
row.setLastCol(findLastCell(row.getLastCol()));
|
||||||
}
|
}
|
||||||
if (cell.getCellNum() == row.getFirstCol())
|
if (hcell.getCellNum() == row.getFirstCol())
|
||||||
{
|
{
|
||||||
row.setFirstCol(findFirstCell(row.getFirstCol()));
|
row.setFirstCol(findFirstCell(row.getFirstCol()));
|
||||||
}
|
}
|
||||||
|
@ -22,34 +22,47 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.poi.hssf.usermodel;
|
package org.apache.poi.hssf.usermodel;
|
||||||
|
|
||||||
import org.apache.poi.ddf.EscherRecord;
|
import java.awt.font.FontRenderContext;
|
||||||
import org.apache.poi.hssf.model.FormulaParser;
|
import java.awt.font.TextAttribute;
|
||||||
import org.apache.poi.hssf.model.Sheet;
|
import java.awt.font.TextLayout;
|
||||||
import org.apache.poi.hssf.model.Workbook;
|
import java.awt.geom.AffineTransform;
|
||||||
import org.apache.poi.hssf.record.*;
|
|
||||||
import org.apache.poi.hssf.record.formula.Ptg;
|
|
||||||
import org.apache.poi.hssf.record.formula.ReferencePtg;
|
|
||||||
import org.apache.poi.hssf.util.HSSFCellRangeAddress;
|
|
||||||
import org.apache.poi.hssf.util.HSSFDataValidation;
|
|
||||||
import org.apache.poi.hssf.util.Region;
|
|
||||||
import org.apache.poi.hssf.util.PaneInformation;
|
|
||||||
import org.apache.poi.util.POILogFactory;
|
|
||||||
import org.apache.poi.util.POILogger;
|
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
import java.text.AttributedString;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
import java.text.NumberFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
import java.text.AttributedString;
|
|
||||||
import java.text.NumberFormat;
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.awt.font.TextLayout;
|
|
||||||
import java.awt.font.FontRenderContext;
|
|
||||||
import java.awt.font.TextAttribute;
|
|
||||||
|
|
||||||
import java.awt.geom.AffineTransform;
|
import org.apache.poi.ddf.EscherRecord;
|
||||||
|
import org.apache.poi.hssf.model.FormulaParser;
|
||||||
|
import org.apache.poi.hssf.model.Sheet;
|
||||||
|
import org.apache.poi.hssf.model.Workbook;
|
||||||
|
import org.apache.poi.hssf.record.CellValueRecordInterface;
|
||||||
|
import org.apache.poi.hssf.record.DVALRecord;
|
||||||
|
import org.apache.poi.hssf.record.DVRecord;
|
||||||
|
import org.apache.poi.hssf.record.EOFRecord;
|
||||||
|
import org.apache.poi.hssf.record.EscherAggregate;
|
||||||
|
import org.apache.poi.hssf.record.HCenterRecord;
|
||||||
|
import org.apache.poi.hssf.record.PageBreakRecord;
|
||||||
|
import org.apache.poi.hssf.record.Record;
|
||||||
|
import org.apache.poi.hssf.record.RowRecord;
|
||||||
|
import org.apache.poi.hssf.record.SCLRecord;
|
||||||
|
import org.apache.poi.hssf.record.VCenterRecord;
|
||||||
|
import org.apache.poi.hssf.record.WSBoolRecord;
|
||||||
|
import org.apache.poi.hssf.record.WindowTwoRecord;
|
||||||
|
import org.apache.poi.hssf.record.formula.Ptg;
|
||||||
|
import org.apache.poi.hssf.record.formula.ReferencePtg;
|
||||||
|
import org.apache.poi.hssf.util.HSSFCellRangeAddress;
|
||||||
|
import org.apache.poi.hssf.util.HSSFDataValidation;
|
||||||
|
import org.apache.poi.hssf.util.PaneInformation;
|
||||||
|
import org.apache.poi.hssf.util.Region;
|
||||||
|
import org.apache.poi.ss.usermodel.CellStyle;
|
||||||
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
|
import org.apache.poi.util.POILogFactory;
|
||||||
|
import org.apache.poi.util.POILogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* High level representation of a worksheet.
|
* High level representation of a worksheet.
|
||||||
@ -61,7 +74,7 @@ import java.awt.geom.AffineTransform;
|
|||||||
* @author Yegor Kozlov (yegor at apache.org) (Autosizing columns)
|
* @author Yegor Kozlov (yegor at apache.org) (Autosizing columns)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class HSSFSheet
|
public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
|
||||||
{
|
{
|
||||||
private static final int DEBUG = POILogger.DEBUG;
|
private static final int DEBUG = POILogger.DEBUG;
|
||||||
|
|
||||||
@ -227,7 +240,7 @@ public class HSSFSheet
|
|||||||
* @param row representing a row to remove.
|
* @param row representing a row to remove.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void removeRow(HSSFRow row)
|
public void removeRow(Row row)
|
||||||
{
|
{
|
||||||
sheet.setLoc(sheet.getDimsLoc());
|
sheet.setLoc(sheet.getDimsLoc());
|
||||||
if (rows.size() > 0)
|
if (rows.size() > 0)
|
||||||
@ -250,7 +263,7 @@ public class HSSFSheet
|
|||||||
sheet.removeValueRecord(row.getRowNum(),
|
sheet.removeValueRecord(row.getRowNum(),
|
||||||
cell.getCellValueRecord());
|
cell.getCellValueRecord());
|
||||||
}
|
}
|
||||||
sheet.removeRow(row.getRowRecord());
|
sheet.removeRow(((HSSFRow) row).getRowRecord());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1636,7 +1649,7 @@ public class HSSFSheet
|
|||||||
* @param column the column index
|
* @param column the column index
|
||||||
* @param style the style to set
|
* @param style the style to set
|
||||||
*/
|
*/
|
||||||
public void setDefaultColumnStyle(short column, HSSFCellStyle style) {
|
public void setDefaultColumnStyle(short column, CellStyle style) {
|
||||||
sheet.setColumn(column, new Short(style.getIndex()), null, null, null, null);
|
sheet.setColumn(column, new Short(style.getIndex()), null, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
package org.apache.poi.hssf.usermodel;
|
package org.apache.poi.hssf.usermodel;
|
||||||
|
|
||||||
|
import org.apache.poi.ss.usermodel.RichTextString;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A textbox is a shape that may hold a rich text string.
|
* A textbox is a shape that may hold a rich text string.
|
||||||
*
|
*
|
||||||
@ -53,9 +55,9 @@ public class HSSFTextbox
|
|||||||
/**
|
/**
|
||||||
* @param string Sets the rich text string used by this object.
|
* @param string Sets the rich text string used by this object.
|
||||||
*/
|
*/
|
||||||
public void setString( HSSFRichTextString string )
|
public void setString( RichTextString string )
|
||||||
{
|
{
|
||||||
this.string = string;
|
this.string = (HSSFRichTextString) string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,23 +23,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.poi.hssf.usermodel;
|
package org.apache.poi.hssf.usermodel;
|
||||||
|
|
||||||
import org.apache.poi.POIDocument;
|
|
||||||
import org.apache.poi.ddf.EscherBSERecord;
|
|
||||||
import org.apache.poi.ddf.EscherBitmapBlip;
|
|
||||||
import org.apache.poi.ddf.EscherRecord;
|
|
||||||
import org.apache.poi.ddf.EscherBlipRecord;
|
|
||||||
import org.apache.poi.hssf.eventmodel.EventRecordFactory;
|
|
||||||
import org.apache.poi.hssf.model.Sheet;
|
|
||||||
import org.apache.poi.hssf.model.Workbook;
|
|
||||||
import org.apache.poi.hssf.record.*;
|
|
||||||
import org.apache.poi.hssf.record.formula.Area3DPtg;
|
|
||||||
import org.apache.poi.hssf.record.formula.MemFuncPtg;
|
|
||||||
import org.apache.poi.hssf.record.formula.UnionPtg;
|
|
||||||
import org.apache.poi.hssf.util.CellReference;
|
|
||||||
import org.apache.poi.poifs.filesystem.*;
|
|
||||||
import org.apache.poi.util.POILogFactory;
|
|
||||||
import org.apache.poi.util.POILogger;
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -51,6 +34,38 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
|
|
||||||
|
import org.apache.poi.POIDocument;
|
||||||
|
import org.apache.poi.ddf.EscherBSERecord;
|
||||||
|
import org.apache.poi.ddf.EscherBitmapBlip;
|
||||||
|
import org.apache.poi.ddf.EscherBlipRecord;
|
||||||
|
import org.apache.poi.ddf.EscherRecord;
|
||||||
|
import org.apache.poi.hssf.eventmodel.EventRecordFactory;
|
||||||
|
import org.apache.poi.hssf.model.Sheet;
|
||||||
|
import org.apache.poi.hssf.model.Workbook;
|
||||||
|
import org.apache.poi.hssf.record.AbstractEscherHolderRecord;
|
||||||
|
import org.apache.poi.hssf.record.BackupRecord;
|
||||||
|
import org.apache.poi.hssf.record.DrawingGroupRecord;
|
||||||
|
import org.apache.poi.hssf.record.EmbeddedObjectRefSubRecord;
|
||||||
|
import org.apache.poi.hssf.record.ExtendedFormatRecord;
|
||||||
|
import org.apache.poi.hssf.record.FontRecord;
|
||||||
|
import org.apache.poi.hssf.record.LabelRecord;
|
||||||
|
import org.apache.poi.hssf.record.LabelSSTRecord;
|
||||||
|
import org.apache.poi.hssf.record.NameRecord;
|
||||||
|
import org.apache.poi.hssf.record.ObjRecord;
|
||||||
|
import org.apache.poi.hssf.record.Record;
|
||||||
|
import org.apache.poi.hssf.record.RecordFactory;
|
||||||
|
import org.apache.poi.hssf.record.SSTRecord;
|
||||||
|
import org.apache.poi.hssf.record.UnicodeString;
|
||||||
|
import org.apache.poi.hssf.record.UnknownRecord;
|
||||||
|
import org.apache.poi.hssf.record.WindowTwoRecord;
|
||||||
|
import org.apache.poi.hssf.record.formula.Area3DPtg;
|
||||||
|
import org.apache.poi.hssf.record.formula.MemFuncPtg;
|
||||||
|
import org.apache.poi.hssf.record.formula.UnionPtg;
|
||||||
|
import org.apache.poi.hssf.util.CellReference;
|
||||||
|
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||||
|
import org.apache.poi.util.POILogFactory;
|
||||||
|
import org.apache.poi.util.POILogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* High level representation of a workbook. This is the first object most users
|
* High level representation of a workbook. This is the first object most users
|
||||||
* will construct whether they are reading or writing a workbook. It is also the
|
* will construct whether they are reading or writing a workbook. It is also the
|
||||||
@ -64,7 +79,7 @@ import java.util.Stack;
|
|||||||
* @version 2.0-pre
|
* @version 2.0-pre
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class HSSFWorkbook extends POIDocument
|
public class HSSFWorkbook extends POIDocument implements org.apache.poi.ss.usermodel.Workbook
|
||||||
{
|
{
|
||||||
private static final int DEBUG = POILogger.DEBUG;
|
private static final int DEBUG = POILogger.DEBUG;
|
||||||
|
|
||||||
@ -495,7 +510,7 @@ public class HSSFWorkbook extends POIDocument
|
|||||||
* @param sheet the sheet to look up
|
* @param sheet the sheet to look up
|
||||||
* @return index of the sheet (0 based)
|
* @return index of the sheet (0 based)
|
||||||
*/
|
*/
|
||||||
public int getSheetIndex(HSSFSheet sheet)
|
public int getSheetIndex(org.apache.poi.ss.usermodel.Sheet sheet)
|
||||||
{
|
{
|
||||||
for(int i=0; i<sheets.size(); i++) {
|
for(int i=0; i<sheets.size(); i++) {
|
||||||
if(sheets.get(i) == sheet) {
|
if(sheets.get(i) == sheet) {
|
||||||
|
@ -18,7 +18,9 @@
|
|||||||
|
|
||||||
package org.apache.poi.hssf.util;
|
package org.apache.poi.hssf.util;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Hashtable;
|
||||||
|
|
||||||
|
import org.apache.poi.ss.usermodel.Color;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Intends to provide support for the very evil index to triplet issue and
|
* Intends to provide support for the very evil index to triplet issue and
|
||||||
@ -34,7 +36,7 @@ import java.util.*;
|
|||||||
* @author Brian Sanders (bsanders at risklabs dot com) - full default color palette
|
* @author Brian Sanders (bsanders at risklabs dot com) - full default color palette
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class HSSFColor
|
public class HSSFColor implements Color
|
||||||
{
|
{
|
||||||
private final static int PALETTE_SIZE = 56;
|
private final static int PALETTE_SIZE = 56;
|
||||||
private final static int DISTINCT_COLOR_COUNT = 46;
|
private final static int DISTINCT_COLOR_COUNT = 46;
|
||||||
|
Loading…
Reference in New Issue
Block a user