|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jet.report.xls.Worksheet
public class Worksheet
It specifies a WorkSheet of a WorkBook.
GlobalWorksheet gws = null;//get it from theWorkbook
object Worksheet sheet = new Worksheet( null ); int r = 1, c = 1; double v = 99.8; Xf xf = new Xf(); int xfIndx = gws.getXfIndex( xf ); BNumber number = new BNumber(r, c, xfIndx, v); sheet.addCell( number );//write a number cell to the second row and the second column cell r = 2; v = 99.888; xf = new Xf(); xf.setFormatIndex( gws.getFormatIndex( "($#,##0.00_);[Red]($#,##0.00)", null ) );//set the cell format as "($#,##0.00_);[Red]($#,##0.00)". number = new BNumber( r, c, gws.getXfIndex( xf ), v ); sheet.addCell( number ); r = 3; xf = new Xf(); BFont font = new BFont(); font.setFontName( "Wingdings 3" );//set the font name asWingdings 3
font.setFontHeight( ( short )(15*20) );//set the font height as 15 point font.setBoldStyle( true );//set the font as bold xf.setFontIndex( ( short ) gws.getFontIndex( font ) ); xfIndx = gws.getXfIndex( xf ); BLabel label = new BLabel(r, c, xfIndx, "Jinfonet", null );//create a label cell, and its position is the fourth row, second column sheet.addLabel( label, gws ); r = 8; xf = new Xf(); font = new BFont(); font.setColor( ColorConstants.RED );//set the font color as red //font.setColor( ( short ) gws.getColorIndex( Color.red.getRGB() & 0x00ffffff ) );//you can also set the font color as red with this method
Note: There are two formats to get the Color
index:
GlobalWorksheet.getColorIndex(int)
.
ColorConstants
.
GlobalWorksheet.addColor(int)
and invoke the method GlobalWorksheet.makePalette()
after all colors are added before invoking GlobalWorksheet.getColorIndex(int)
.
These two formats can not be used at the same time. Otherwise, the result might be incorrect. In other words, you should select one of them to use.
xf.setFontIndex( ( short ) gws.getFontIndex( font ) ); xfIndx = gws.getXfIndex( xf ); BLabel label = new BLabel(r, c, xfIndx, "This is Red Jinfonet", null );//create a label cell, and its position is the fourth row, the second column sheet.addLabel( label, gws );
Field Summary | |
---|---|
static byte |
X
It is an index used to get the freeze panel column position. |
static byte |
Y
It is an index used to get the freeze panel row position. |
Constructor Summary | |
---|---|
Worksheet(java.lang.String encoding)
Creates an empty Worksheet object with all the fields empty. |
Method Summary | |
---|---|
void |
addCell(Blank cell)
Adds a cell to the Worksheet. |
void |
addChart(ChartInfo chartInfo,
GlobalWorksheet gws,
java.lang.String encoding)
Adds a chart to the Worksheet. |
java.lang.StringBuffer |
addFormula(Formula formula,
GlobalWorksheet gws)
Adds a formula to the Worksheet. |
void |
addHyperLink(jet.report.xls.HLink link)
Adds a Label hyperlink object to this object. |
void |
addHyperLink(jet.report.xls.HLink link,
GlobalWorksheet gws,
java.lang.String encoding,
BFont font,
boolean defFont)
Adds a HyperLink in the sheet. |
void |
addLabel(BLabel cell,
GlobalWorksheet gws)
Adda a Label record to the Worksheet. |
int |
addMergeRegion(Region region)
Adds a merged region. |
void |
addPicture(GlobalWorksheet gws,
java.lang.String path,
jet.report.xls.ImgInfo imgInfo)
Adds a picture to the Worksheet. |
void |
addPicture(GlobalWorksheet gws,
java.lang.String path,
jet.report.xls.ImgInfo imgInfo,
jet.report.xls.HLink link)
Adds a picture with link format to the Worksheet . |
void |
addShapes(GlobalWorksheet gws,
jet.report.xls.ShapesInfo shapesInfo)
Adds a shape to the Worksheet. |
void |
clearFreeze()
Unfreezes panes. |
void |
converLabel()
Converts the Label record to LabelSST record in the Worksheet for share label in the whole worksheet. |
short |
getCalcMode()
Gets the calculation mode. |
short |
getColumnWidth(short column)
Gets the width of a given column in the unit of 1/20th of a point width (twips?). |
short |
getDefaultRowHeight()
Gets the default row height. |
short |
getDefaultRowHeightOptions()
Gets the default row height option |
short |
getDefColWidth()
Gets the default width of the column. |
java.lang.String |
getFooter()
Gets the print footer string. |
short[] |
getFrozen()
Gets the freezing position. |
boolean |
getGridLine()
Gets whether the window should display gridlines. |
boolean |
getGridset()
Gets whether the user has ever changed the setting of the Gridlines option. |
boolean |
getHCenter()
Gets whether the sheet is to be centered between horizontal margins when printed. |
java.lang.String |
getHeader()
Gets the print header string. |
double |
getMaxChange()
Gets the Maximum iteration changes. |
Region |
getMergeRegionAt(int index)
Gets a special merged region. |
int |
getNumMergeRegions()
Gets the number of all merged regions. |
boolean |
getPageBreak()
Gets whether to have the window display the page break option. |
boolean |
getPrintGridlines()
Gets whether to print gridlines. |
boolean |
getPrintHeaders()
Gets whether to print row and column heading. |
boolean |
getRecalc()
Gets whether to recalculate before saving. |
short |
getRefMode()
Gets the Reference mode. |
java.lang.String |
getSheetName()
Gets the Worksheet name. |
boolean |
getVCenter()
Gets whether the sheet is to be centered between vertical margins when printed. |
short |
getWSBool()
Gets the WSBool option flag. |
boolean |
isIteration()
Gets the Iteration option. |
void |
modifyMsoDrawing(int increase)
Modifies the MsoDrawing record. |
void |
removeMergeRegion(int index)
Removes a merged region. |
void |
setCalcMode(short mode)
Sets the calculation mode. |
void |
setColumnWidth(short column,
short width)
Sets the width of a given column in the unit of 1/20th of a character width. |
void |
setDefaultRowHeight(short rowheight)
Sets the default row height. |
void |
setDefaultRowHeightOptions(short flags)
Sets the default row height option. |
void |
setDefColWidth(short colwidth)
Sets the default width of the column. |
void |
setFooter(java.lang.String printPageFooter)
Sets print footer string and the length of the footer string. |
void |
setFreezePane(short x,
short y)
Sets to freeze Panes. |
void |
setGridLine(boolean bool)
Sets whether the window should display gridlines. |
void |
setGridset(boolean bool)
Sets whether the user has ever changed the setting of the Gridlines option. |
void |
setHCenter(boolean center)
Sets whether the sheet is to be centered between horizontal margins when printed. |
void |
setHeader(java.lang.String printPageHeader)
Sets the print header string and the length of the header string. |
void |
setIteration(boolean bool)
Sets the Iteration option. |
void |
setMaxChange(double change)
Sets the Maximum iteration changes. |
void |
setPageBreak(boolean bool)
Sets whether to have the window display the page break option. |
void |
setPrintGridlines(boolean print)
Sets whether to print gridlines. |
void |
setPrintHeaders(boolean print)
Sets whether to print row and column heading. |
void |
setPrintLandscape(boolean isLandscape)
Sets the Print Landscape according to the flag. |
void |
setRecalc(boolean recalc)
Sets whether to recalculate before saving. |
void |
setRefMode(short mode)
Sets the Reference mode. |
void |
setRowHeight(int rowNum,
short height)
Sets the height of the special row. |
void |
setSheetName(java.lang.String sheetname)
Sets the Worksheet name. |
void |
setVCenter(boolean center)
Sets whether the sheet is to be centered between vertical margins when printed. |
void |
setWSBool(short flag)
Sets the WSBool option flag. |
void |
setZoomValue(int value)
Sets the zoom value. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte X
public static final byte Y
Constructor Detail |
---|
public Worksheet(java.lang.String encoding)
Worksheet
object with all the fields empty.
encoding
- the encoding parameter can be null or whatever, we don't use it nowMethod Detail |
---|
public void setSheetName(java.lang.String sheetname)
sheetname
- The name of the Worksheet.public void setZoomValue(int value)
value
- the max value is 400 and the min value is 10
That is, the value scope is from 10% to 400%.public void setPrintLandscape(boolean isLandscape)
isLandscape
- public void setFreezePane(short x, short y)
x
- the column indexy
- the row indexpublic void clearFreeze()
public short[] getFrozen()
public java.lang.String getSheetName()
public void addLabel(BLabel cell, GlobalWorksheet gws)
cell
- the Label to be addedgws
- the GloabalWorksheet in which the Sst is to be addedpublic void addHyperLink(jet.report.xls.HLink link)
link
- public void addHyperLink(jet.report.xls.HLink link, GlobalWorksheet gws, java.lang.String encoding, BFont font, boolean defFont)
link
- the HyperLink to be addedgws
- the GloabalWorksheet of the workbookdefFont
- whether to use the default font of the HyperLink to the cell in which to add the HyperLinkpublic void converLabel()
public void addCell(Blank cell)
cell
- the cell to be added, which can be BNumber or BoolErrpublic java.lang.StringBuffer addFormula(Formula formula, GlobalWorksheet gws) throws java.io.IOException
formula
- the formula to be added
java.io.IOException
public void modifyMsoDrawing(int increase)
public void addPicture(GlobalWorksheet gws, java.lang.String path, jet.report.xls.ImgInfo imgInfo)
gws
- the GlobalWorksheet
objectpath
- the image path, such as "pic.jpg"imgInfo
- the ImgInfo
objectpublic void addPicture(GlobalWorksheet gws, java.lang.String path, jet.report.xls.ImgInfo imgInfo, jet.report.xls.HLink link)
Worksheet
.
gws
- the GlobalWorksheet
objectpath
- the image path, such as "pic.jpg"imgInfo
- the ImgInfo
objectlink
- the link infopublic void addShapes(GlobalWorksheet gws, jet.report.xls.ShapesInfo shapesInfo)
gws
- the GlobalWorksheet
objectshapesInfo
- the ShapesInfo
objectpublic void addChart(ChartInfo chartInfo, GlobalWorksheet gws, java.lang.String encoding) throws java.io.IOException
chartInfo
- the information of the chart to be addded
java.io.IOException
public void setCalcMode(short mode)
mode
- the calculation mode, 0 for manual, 1 for automatic
-1 for automatic, except for tablespublic short getCalcMode()
public void setRefMode(short mode)
mode
- the Reference mode, 0 for R1C1 mode and 1 for A1 modepublic short getRefMode()
public void setIteration(boolean bool)
bool
- no matter the Iteration option is on or not, 0 is for off and 1 is for onpublic boolean isIteration()
public void setMaxChange(double change)
change
- changes of the maximum iterationpublic double getMaxChange()
public void setRecalc(boolean recalc)
recalc
- whether or not to recalculate before savingpublic boolean getRecalc()
public void setPrintHeaders(boolean print)
print
- whether to print row and column heading or notpublic boolean getPrintHeaders()
public void setPrintGridlines(boolean print)
print
- whether to print gridlines or notpublic boolean getPrintGridlines()
public void setGridset(boolean bool)
bool
- whether the user has ever changed the setting of the Gridlines option or notpublic boolean getGridset()
public void setPageBreak(boolean bool)
bool
- whether to have window display page break option or notpublic boolean getPageBreak()
public void setGridLine(boolean bool)
bool
- whether the window should display gridlinespublic boolean getGridLine()
public void setDefaultRowHeight(short rowheight)
rowheight
- the default row heightpublic short getDefaultRowHeight()
public void setDefaultRowHeightOptions(short flags)
flags
- the default row height option
The value of the flags can be INCOMPATIBLE, ZERO, EXASC or EXDSC in class DefRowHeight or the combined value of them.public short getDefaultRowHeightOptions()
public void setWSBool(short flag)
flag
- the WSBool option flag
The value of the flags can be SHOWAUTOBREAKS, DIALOG, APPLYSTYLES, RWSUMSBELOW, COLSUMSRIGHT,
FITTOPAGE, DSPGUTS, AEE, AFE in class WSBool or the combined value of them.public short getWSBool()
public void setHeader(java.lang.String printPageHeader)
printPageHeader
- the header stringpublic java.lang.String getHeader()
public void setFooter(java.lang.String printPageFooter)
printPageFooter
- the footer stringpublic java.lang.String getFooter()
public void setHCenter(boolean center)
center
- whether the sheet is to be centered between horizontal margins when printedpublic boolean getHCenter()
public void setVCenter(boolean center)
center
- whether the sheet is to be centered between vertical margins when printedpublic boolean getVCenter()
public void setDefColWidth(short colwidth)
colwidth
- the default width of the columnpublic short getDefColWidth()
public short getColumnWidth(short column)
public void setColumnWidth(short column, short width)
column
- - the column numberwidth
- (in the unit of 1/20th of a character width)public int addMergeRegion(Region region)
region
- the merged regionpublic void removeMergeRegion(int index)
index
- the index of the merged region to be removedpublic Region getMergeRegionAt(int index)
index
- the index of the merged region to be gottenpublic int getNumMergeRegions()
public void setRowHeight(int rowNum, short height)
rowNum
- the row number to setheight
- the row height to set
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |