poi sxssfworkbookk构造函数 多少比较好

他的最新文章
他的热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)POI3.8中&大数据量的处理
POI之前的版本不支持大数据量处理,如果数据过多则经常报OOM错误,有时候调整JVM大小效果也不是太好。3.8版本的POI新出来了SXSSFWorkbook,可以支持大数据量的操作,只是SXSSFWorkbook只支持.xlsx格式,不支持.xls格式。
3.8版本的POI对excel的导出操作,一般只使用HSSFWorkbook以及SXSSFWorkbook,HSSFWorkbook用来处理较少的数据量,SXSSFWorkbook用来处理大数据量以及超大数据量的导出。
HSSFWorkbook的使用方法和之前的版本的使用方法一致,这里就不在陈述使用方法了
SXSSFWorkbook的使用例子如下:
import junit.framework.A
import org.apache.poi.ss.usermodel.C&
import org.apache.poi.ss.usermodel.R&
import org.apache.poi.ss.usermodel.S&
import org.apache.poi.ss.usermodel.W&
import org.apache.poi.ss.util.CellR&
import org.apache.poi.xssf.streaming.SXSSFW&&
public static void main(String[] args) throws Throwable {&
&Workbook wb = new SXSSFWorkbook(100); // keep 100 rows in memory, exceeding rows will be flushed to disk&
&Sheet sh = wb.createSheet();&
&for(int rownum = 0; rownum & 100000; rownum++){
&Row row = sh.createRow(rownum);&
&for(int cellnum = 0; cellnum & 10; cellnum++){&
&Cell cell = row.createCell(cellnum);&
&String address = new CellReference(cell).formatAsString();&
&cell.setCellValue(address);
FileOutputStream out = new FileOutputStream("/temp/sxssf.xlsx");&
&wb.write(out);&
&out.close();
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。poi大数据导出20万没内存溢出过_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
poi大数据导出20万没内存溢出过
阅读已结束,下载文档到电脑
想免费下载更多文档?
定制HR最喜欢的简历
下载文档到电脑,方便使用
还剩2页未读,继续阅读
定制HR最喜欢的简历
你可能喜欢博客分类:
POI3.8的SXSSF包是XSSF的一个扩展版本,支持流处理,在生成大数据量的电子表格且堆空间有限时使用。SXSSF通过限制内存中可访问的记录行数来实现其低内存利用,当达到限定值时,新一行数据的加入会引起老一行的数据刷新到硬盘。
比如内存中限制行数为100,当行号到达101时,行号为0的记录刷新到硬盘并从内存中删除,当行号到达102时,行号为1的记录刷新到硬盘,并从内存中删除,以此类推。
rowAccessWindowSize代表指定的内存中缓存记录数,默认为100,此值可以通过
new SXSSFWorkbook(int rowAccessWindowSize)或SXSSFSheet.setRandomAccessWindowSize(intwindowSize)来设置。
SXSSF在把内存数据刷新到硬盘时,是把每个SHEET生成一个临时文件,这个临时文件可能会很大,有可以会达到G级别,如果文件的过大对你来说是一个问题,你可以使用下面的方法让SXSSF来进行压缩,当然性能也会有一定的影响。
SXSSFWorkbook wb = new SXSSFWorkbook();
wb.setCompressTempFiles(true); // temp files will be gzipped
生成三个SHEET,每个SHEET有6000行记录,共18万行记录
importjava.io.FileOutputS
importorg.apache.poi.ss.usermodel.C
importorg.apache.poi.ss.usermodel.R
importorg.apache.poi.ss.usermodel.S
importorg.apache.poi.ss.util.CellR
importorg.apache.poi.xssf.streaming.SXSSFS
importorg.apache.poi.xssf.streaming.SXSSFW
public classSXSSFWorkBookUtil {
public voidtestWorkBook() {
longcurr_time=System.currentTimeMillis();
introwaccess=100;//内存中缓存记录行数
/*keep 100 rowsin memory,exceeding rows will be flushed to disk*/
SXSSFWorkbook wb = newSXSSFWorkbook(rowaccess);
intsheet_num=3;//生成3个SHEET
for(inti=0;i&sheet_i++){
Sheet sh = wb.createSheet();
//每个SHEET有60000ROW
for(intrownum = 0; rownum & 60000; rownum++) {
Row row = sh.createRow(rownum);
//每行有10个CELL
for(intcellnum = 0; cellnum & 10; cellnum++) {
Cell cell = row.createCell(cellnum);
String address = newCellReference(cell).formatAsString();
cell.setCellValue(address);
//每当行数达到设置的值就刷新数据到硬盘,以清理内存
if(rownum%rowaccess==0){
((SXSSFSheet)sh).flushRows();
/*写数据到文件中*/
FileOutputStream os = newFileOutputStream("d:/data/poi/biggrid.xlsx");
wb.write(os);
os.close();
/*计算耗时*/
System.out.println("耗时:"+(System.currentTimeMillis()-curr_time)/1000);
} catch(Exception e) {
e.printStackTrace();
对于不同的rowAccessWindowSize值,用上面的例子进行耗时测试,结果如下:
rowAccessWindowSize
以上测试结果是在个人笔记本电脑上进行的,配置为:
Dual-Core CPU TGHz 2.19GHz
Memory 1.86GB
以上测试过程只是进行了一次,并没有多次测试求平均值,数据也只想表达当设置不同的rowAccessWindowSize值,耗时的一种趋势。
可见一般情况下,使用默认值100即可。
浏览 17192
浏览: 70253 次
先给楼主纠正一点,生成三个SHEET,每个SHEET有6000 ...
100条记录20秒,,这也太慢了,大数据正常200条才0.00 ...
多谢楼主分享,正好在项目中用上。三个sheet,两个8+W,一 ...
多谢楼主,问题完美解决。总条数50万,刷新阀值1000,毫无压 ...
有导出时间字段的代码吗
我试了好多都没用
(window.slotbydup=window.slotbydup || []).push({
id: '4773203',
container: s,
size: '200,200',
display: 'inlay-fix'SXSSFWorkbook (POI API Documentation)
org.apache.poi.xssf.streaming
Class SXSSFWorkbook
java.lang.Object
org.apache.poi.xssf.streaming.SXSSFWorkbook
All Implemented Interfaces:
public class SXSSFWorkbookextends java.lang.Objectimplements
Streaming version of XSSFWorkbook implementing the "BigGridDemo" strategy.
Alex Geller, Four J's Development Tools
static&int
&&&&&&&&&&Specifies how many rows can be accessed at most via getRow().
, , , , , , , ,
&&&&&&&&&&Construct a new workbook
(int&rowAccessWindowSize)
&&&&&&&&&&Construct an empty workbook and specify the window for row access.
(&workbook)
&&&&&&&&&&Construct a workbook from a template.
(&workbook,
int&rowAccessWindowSize)
&&&&&&&&&&Constructs an workbook from an existing workbook.
(&workbook,
int&rowAccessWindowSize,
boolean&compressTmpFiles)
&&&&&&&&&&Constructs an workbook from an existing workbook.
(byte[]&pictureData,
int&format)
&&&&&&&&&&Adds a picture to the workbook.
(&toopack)
&&&&&&&&&&Register a new toolpack in this workbook.
(int&sheetNum)
&&&&&&&&&&Create an Sheet from an existing sheet in the Workbook.
&&&&&&&&&&Create a new Cell style and add it to the workbook's style table
&&&&&&&&&&Returns the instance of DataFormat for this workbook.
&&&&&&&&&&Create a new Font and add it to the workbook's font table
&&&&&&&&&&Creates a new (uninitialised) defined name in this workbook
&&&&&&&&&&Sreate an Sheet for this Workbook, adds it to the sheets and returns
the high level representation.
(java.lang.String&sheetname)
&&&&&&&&&&Create an Sheet for this Workbook, adds it to the sheets and returns
the high level representation.
(short&boldWeight,
short&color,
short&fontHeight,
java.lang.String&name,
boolean&italic,
boolean&strikeout,
short&typeOffset,
byte&underline)
&&&&&&&&&&Finds a font that matches the one with the supplied attributes
&&&&&&&&&&Convenience method to get the active sheet.
&java.util.List&? extends &
&&&&&&&&&&Gets all pictures from the Workbook.
(short&idx)
&&&&&&&&&&Get the cell style object at the given index
&&&&&&&&&&Returns an object that handles instantiating concrete
classes of the various instances one needs for
HSSF and XSSF.
&&&&&&&&&&Gets the first tab that is displayed in the list of tabs in excel.
(short&idx)
&&&&&&&&&&Get the font at the given index number
&&&&&&&&&&Whether Excel will be asked to recalculate all formulas when the
workbook is opened.
&&&&&&&&&&Retrieves the current policy on what to do when
getting missing or blank cells from a row.
(java.lang.String&name)
&&&&&&&&&&&
(int&nameIndex)
&&&&&&&&&&&
(java.lang.String&name)
&&&&&&&&&&Gets the defined name index by name
Note: Excel defined names are case-insensitive and
this method performs a case-insensitive search.
&&&&&&&&&&Get the number of fonts in the font table
&&&&&&&&&&&
&&&&&&&&&&Get the number of spreadsheets in the workbook
&&&&&&&&&&Get the number of styles the workbook contains
&java.lang.String
(int&sheetIndex)
&&&&&&&&&&Retrieves the reference for the printarea of the specified sheet,
the sheet name is appended to the reference even if it was not specified.
&&&&&&&&&&&
(java.lang.String&name)
&&&&&&&&&&Get sheet with the given name
(int&index)
&&&&&&&&&&Get the Sheet object at the given index.
&&&&&&&&&&Returns the index of the given sheet
(java.lang.String&name)
&&&&&&&&&&Returns the index of the sheet by his name
&java.lang.String
(int&sheet)
&&&&&&&&&&Set the sheet name
&&&&&&&&&&&
&&&&&&&&&&&
(int&sheetIx)
&&&&&&&&&&Check whether a sheet is hidden.
(int&sheetIx)
&&&&&&&&&&Check whether a sheet is very hidden.
(int&index)
&&&&&&&&&&Remove the defined name at the specified index
(java.lang.String&name)
&&&&&&&&&&Remove a defined name by name
(int&sheetIndex)
&&&&&&&&&&Delete the printarea for the sheet specified
(int&index)
&&&&&&&&&&Removes sheet at the given index
(int&sheetIndex)
&&&&&&&&&&Convenience method to set the active sheet.
(boolean&compress)
&&&&&&&&&&Set whether temp files should be compressed.
(int&sheetIndex)
&&&&&&&&&&Sets the first tab that is displayed in the list of tabs in excel.
(boolean&value)
&&&&&&&&&&Whether the application shall perform a full recalculation when the workbook is opened.
(boolean&hiddenFlag)
&&&&&&&&&&&
(&missingCellPolicy)
&&&&&&&&&&Sets the policy on what to do when
getting missing or blank cells from a row.
(int&sheetIndex,
int&startColumn,
int&endColumn,
int&startRow,
int&endRow)
&&&&&&&&&&For the Convenience of Java Programmers maintaining pointers.
(int&sheetIndex,
java.lang.String&reference)
&&&&&&&&&&Sets the printarea for the sheet provided
(int&sheetIndex,
int&startColumn,
int&endColumn,
int&startRow,
int&endRow)
&&&&&&&&&&Sets the repeating rows and columns for a sheet (as found in
File->PageSetup->Sheet).
(int&index)
&&&&&&&&&&Sets the tab whose data is actually seen when the sheet is opened.
(int&sheetIx,
boolean&hidden)
&&&&&&&&&&Hide or unhide a sheet
(int&sheetIx,
int&hidden)
&&&&&&&&&&Hide or unhide a sheet.
(int&sheet,
java.lang.String&name)
&&&&&&&&&&Set the sheet name.
(java.lang.String&sheetname,
&&&&&&&&&&Sets the order of appearance for a given sheet.
(java.io.OutputStream&stream)
&&&&&&&&&&Write out this workbook to an Outputstream.
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
DEFAULT_WINDOW_SIZE
public static final int DEFAULT_WINDOW_SIZE
Specifies how many rows can be accessed at most via getRow().
When a new node is created via createRow() and the total number
of unflushed records would exeed the specified value, then the
row with the lowest index value is flushed and cannot be accessed
via getRow() anymore.
SXSSFWorkbook
public SXSSFWorkbook()
Construct a new workbook
SXSSFWorkbook
public SXSSFWorkbook(&workbook)
Construct a workbook from a template.
There are three use-cases to use SXSSFWorkbook(XSSFWorkbook) :
Append new sheets to existing workbooks. You can open existing
workbook from a file or create on the fly with XSSF.
Append rows to existing sheets. The row number MUST be greater
than max(rownum) in the template sheet.
Use existing workbook as a template and re-use global objects such
as cell styles, formats, images, etc.
All three use cases can work in a combination.
What is not supported:
Access initial cells and rows in the template. After constructing
SXSSFWorkbook(XSSFWorkbook) all internal windows are empty and
SXSSFSheet@getRow and SXSSFRow#getCell return null.
Override existing cells and rows. The API silently allows that but
the output file is invalid and Excel cannot read it.
Parameters:workbook - the template workbook
SXSSFWorkbook
public SXSSFWorkbook(&workbook,
int&rowAccessWindowSize)
Constructs an workbook from an existing workbook.
When a new node is created via createRow() and the total number
of unflushed records would exceed the specified value, then the
row with the lowest index value is flushed and cannot be accessed
via getRow() anymore.
A value of -1 indicates unlimited access. In this case all
records that have not been flushed by a call to flush() are available
for random access.
A value of 0 is not allowed because it would flush any newly created row
without having a chance to specify any cells.
Parameters:rowAccessWindowSize -
SXSSFWorkbook
public SXSSFWorkbook(&workbook,
int&rowAccessWindowSize,
boolean&compressTmpFiles)
Constructs an workbook from an existing workbook.
When a new node is created via createRow() and the total number
of unflushed records would exceed the specified value, then the
row with the lowest index value is flushed and cannot be accessed
via getRow() anymore.
A value of -1 indicates unlimited access. In this case all
records that have not been flushed by a call to flush() are available
for random access.
A value of 0 is not allowed because it would flush any newly created row
without having a chance to specify any cells.
Parameters:rowAccessWindowSize - compressTmpFiles - whether to use gzip compression for temporary files
SXSSFWorkbook
public SXSSFWorkbook(int&rowAccessWindowSize)
Construct an empty workbook and specify the window for row access.
When a new node is created via createRow() and the total number
of unflushed records would exceed the specified value, then the
row with the lowest index value is flushed and cannot be accessed
via getRow() anymore.
A value of -1 indicates unlimited access. In this case all
records that have not been flushed by a call to flush() are available
for random access.
A value of 0 is not allowed because it would flush any newly created row
without having a chance to specify any cells.
Parameters:rowAccessWindowSize -
getRandomAccessWindowSize
public int getRandomAccessWindowSize()
setCompressTempFiles
public void setCompressTempFiles(boolean&compress)
Set whether temp files should be compressed.
SXSSF writes sheet data in temporary files (a temp file per-sheet)
and the size of these temp files can grow to to a very large size,
e.g. for a 20 MB csv data the size of the temp xml file become few GB large.
If the "compress" flag is set to true then the temporary XML is gzipped.
Please note the the "compress" option may cause performance penalty.
Parameters:compress - whether to compress temp files
getXSSFWorkbook
getXSSFWorkbook()
getActiveSheetIndex
public int getActiveSheetIndex()
Convenience method to get the active sheet.
The active sheet is is the sheet
which is currently displayed when the workbook is viewed in Excel.
'Selected' sheet(s) is a distinct concept.
Specified by: in interface
Returns:the index of the active sheet (0-based)
setActiveSheet
public void setActiveSheet(int&sheetIndex)
Convenience method to set the active sheet.
The active sheet is is the sheet
which is currently displayed when the workbook is viewed in Excel.
'Selected' sheet(s) is a distinct concept.
Specified by: in interface
Parameters:sheetIndex - index of the active sheet (0-based)
getFirstVisibleTab
public int getFirstVisibleTab()
Gets the first tab that is displayed in the list of tabs in excel.
Specified by: in interface
Returns:the first tab that to display in the list of tabs (0-based).
setFirstVisibleTab
public void setFirstVisibleTab(int&sheetIndex)
Sets the first tab that is displayed in the list of tabs in excel.
Specified by: in interface
Parameters:sheetIndex - the first tab that to display in the list of tabs (0-based)
setSheetOrder
public void setSheetOrder(java.lang.String&sheetname,
Sets the order of appearance for a given sheet.
Specified by: in interface
Parameters:sheetname - the name of the sheet to reorderpos - the position that we want to insert the sheet into (0 based)
setSelectedTab
public void setSelectedTab(int&index)
Sets the tab whose data is actually seen when the sheet is opened.
This may be different from the "selected sheet" since excel seems to
allow you to show the data of one sheet when another is seen "selected"
in the tabs (at the bottom).
Specified by: in interface
Parameters:index - the index of the sheet to select (0 based)See Also:
setSheetName
public void setSheetName(int&sheet,
java.lang.String&name)
Set the sheet name.
Specified by: in interface
Parameters:sheet - number (0 based)
java.lang.IllegalArgumentException - if the name is greater than 31 chars or contains /\?*[]See Also:,
getSheetName
public java.lang.String getSheetName(int&sheet)
Set the sheet name
Specified by: in interface
Parameters:sheet - sheet number (0 based)
Returns:Sheet name
getSheetIndex
public int getSheetIndex(java.lang.String&name)
Returns the index of the sheet by his name
Specified by: in interface
Parameters:name - the sheet name
Returns:index of the sheet (0 based)
getSheetIndex
public int getSheetIndex(&sheet)
Returns the index of the given sheet
Specified by: in interface
Parameters:sheet - the sheet to look up
Returns:index of the sheet (0 based)
createSheet
createSheet()
Sreate an Sheet for this Workbook, adds it to the sheets and returns
the high level representation.
Use this to create new sheets.
Specified by: in interface
Returns:Sheet representing the new sheet.
createSheet
createSheet(java.lang.String&sheetname)
Create an Sheet for this Workbook, adds it to the sheets and returns
the high level representation.
Use this to create new sheets.
Specified by: in interface
Parameters:sheetname - sheetname to set for the sheet.
Returns:Sheet representing the new sheet.
java.lang.IllegalArgumentException - if the name is greater than 31 chars or contains /\?*[]See Also:
cloneSheet
cloneSheet(int&sheetNum)
Create an Sheet from an existing sheet in the Workbook.
Specified by: in interface
Returns:Sheet representing the cloned sheet.
getNumberOfSheets
public int getNumberOfSheets()
Get the number of spreadsheets in the workbook
Specified by: in interface
Returns:the number of sheets
getSheetAt
getSheetAt(int&index)
Get the Sheet object at the given index.
Specified by: in interface
Parameters:index - of the sheet number (0-based physical & logical)
Returns:Sheet at the provided index
getSheet(java.lang.String&name)
Get sheet with the given name
Specified by: in interface
Parameters:name - of the sheet
Returns:Sheet with the name provided or null if it does not exist
removeSheetAt
public void removeSheetAt(int&index)
Removes sheet at the given index
Specified by: in interface
Parameters:index - of the sheet to remove (0-based)
setRepeatingRowsAndColumns
public void setRepeatingRowsAndColumns(int&sheetIndex,
int&startColumn,
int&endColumn,
int&startRow,
int&endRow)
Sets the repeating rows and columns for a sheet (as found in
File->PageSetup->Sheet).
This is function is included in the workbook
because it creates/modifies name records which are stored at the
workbook level.
To set just repeating columns:
workbook.setRepeatingRowsAndColumns(0,0,1,-1-1);
To set just repeating rows:
workbook.setRepeatingRowsAndColumns(0,-1,-1,0,4);
To remove all repeating rows and columns for a sheet.
workbook.setRepeatingRowsAndColumns(0,-1,-1,-1,-1);
Specified by: in interface
Parameters:sheetIndex - 0 based index to sheet.startColumn - 0 based start of repeating columns.endColumn - 0 based end of repeating columns.startRow - 0 based start of repeating rows.endRow - 0 based end of repeating rows.
createFont
createFont()
Create a new Font and add it to the workbook's font table
Specified by: in interface
Returns:new font object
findFont(short&boldWeight,
short&color,
short&fontHeight,
java.lang.String&name,
boolean&italic,
boolean&strikeout,
short&typeOffset,
byte&underline)
Finds a font that matches the one with the supplied attributes
Specified by: in interface
Returns:the font with the matched attributes or null
getNumberOfFonts
public short getNumberOfFonts()
Get the number of fonts in the font table
Specified by: in interface
Returns:number of fonts
getFontAt(short&idx)
Get the font at the given index number
Specified by: in interface
Parameters:idx - index number (0-based)
Returns:font at the index
createCellStyle
createCellStyle()
Create a new Cell style and add it to the workbook's style table
Specified by: in interface
Returns:the new Cell Style object
getNumCellStyles
public short getNumCellStyles()
Get the number of styles the workbook contains
Specified by: in interface
Returns:count of cell styles
getCellStyleAt
getCellStyleAt(short&idx)
Get the cell style object at the given index
Specified by: in interface
Parameters:idx - index within the set of styles (0-based)
Returns:CellStyle object at the index
public void write(java.io.OutputStream&stream)
throws java.io.IOException
Write out this workbook to an Outputstream.
Specified by: in interface
Parameters:stream - - the java OutputStream you wish to write to
java.io.IOException - if anything can't be written.
getNumberOfNames
public int getNumberOfNames()
Specified by: in interface
Returns:the total number of defined names in this workbook
getName(java.lang.String&name)
Specified by: in interface
Parameters:name - the name of the defined name
Returns:the defined name with the specified name. null if not found.
getNameAt(int&nameIndex)
Specified by: in interface
Parameters:nameIndex - position of the named range (0-based)
Returns:the defined name at the specified index
java.lang.IllegalArgumentException - if the supplied index is invalid
createName
createName()
Creates a new (uninitialised) defined name in this workbook
Specified by: in interface
Returns:new defined name object
getNameIndex
public int getNameIndex(java.lang.String&name)
Gets the defined name index by name
Note: Excel defined names are case-insensitive and
this method performs a case-insensitive search.
Specified by: in interface
Parameters:name - the name of the defined name
Returns:zero based index of the defined name. -1 if not found.
removeName
public void removeName(int&index)
Remove the defined name at the specified index
Specified by: in interface
Parameters:index - named range index (0 based)
removeName
public void removeName(java.lang.String&name)
Remove a defined name by name
Specified by: in interface
Parameters:name - the name of the defined name
setPrintArea
public void setPrintArea(int&sheetIndex,
java.lang.String&reference)
Sets the printarea for the sheet provided
i.e. Reference = $A$1:$B$2
Specified by: in interface
Parameters:sheetIndex - Zero-based sheet index (0 Represents the first sheet to keep consistent with java)reference - Valid name Reference for the Print Area
setPrintArea
public void setPrintArea(int&sheetIndex,
int&startColumn,
int&endColumn,
int&startRow,
int&endRow)
For the Convenience of Java Programmers maintaining pointers.
Specified by: in interface
Parameters:sheetIndex - Zero-based sheet index (0 = First Sheet)startColumn - Column to begin printareaendColumn - Column to end the printareastartRow - Row to begin the printareaendRow - Row to end the printareaSee Also:
getPrintArea
public java.lang.String getPrintArea(int&sheetIndex)
Retrieves the reference for the printarea of the specified sheet,
the sheet name is appended to the reference even if it was not specified.
Specified by: in interface
Parameters:sheetIndex - Zero-based sheet index (0 Represents the first sheet to keep consistent with java)
Returns:String Null if no print area has been defined
removePrintArea
public void removePrintArea(int&sheetIndex)
Delete the printarea for the sheet specified
Specified by: in interface
Parameters:sheetIndex - Zero-based sheet index (0 = First Sheet)
getMissingCellPolicy
getMissingCellPolicy()
Retrieves the current policy on what to do when
getting missing or blank cells from a row.
The default is to return blank and null cells.
Specified by: in interface
setMissingCellPolicy
public void setMissingCellPolicy(&missingCellPolicy)
Sets the policy on what to do when
getting missing or blank cells from a row.
This will then apply to all calls to
Specified by: in interface
createDataFormat
createDataFormat()
Returns the instance of DataFormat for this workbook.
Specified by: in interface
Returns:the DataFormat object
addPicture
public int addPicture(byte[]&pictureData,
int&format)
Adds a picture to the workbook.
Specified by: in interface
Parameters:pictureData - The bytes of the pictureformat - The format of the picture.
Returns:the index to this picture (1 based).See Also:,
getAllPictures
public java.util.List&? extends & getAllPictures()
Gets all pictures from the Workbook.
Specified by: in interface
Returns:the list of pictures (a list of
getCreationHelper
getCreationHelper()
Returns an object that handles instantiating concrete
classes of the various instances one needs for
HSSF and XSSF.
Specified by: in interface
public boolean isHidden()
Specified by: in interface
Returns:false if this workbook is not visible in the GUI
public void setHidden(boolean&hiddenFlag)
Specified by: in interface
Parameters:hiddenFlag - pass false to make the workbook visible in the GUI
isSheetHidden
public boolean isSheetHidden(int&sheetIx)
Check whether a sheet is hidden.
Note that a sheet could instead be set to be very hidden, which is different
Specified by: in interface
Parameters:sheetIx - Number
Returns:true if sheet is hidden
isSheetVeryHidden
public boolean isSheetVeryHidden(int&sheetIx)
Check whether a sheet is very hidden.
This is different from the normal hidden status
Specified by: in interface
Parameters:sheetIx - sheet index to check
Returns:true if sheet is very hidden
setSheetHidden
public void setSheetHidden(int&sheetIx,
boolean&hidden)
Hide or unhide a sheet
Specified by: in interface
Parameters:sheetIx - the sheet index (0-based)hidden - True to mark the sheet as hidden, false otherwise
setSheetHidden
public void setSheetHidden(int&sheetIx,
int&hidden)
Hide or unhide a sheet.
0 - visible.
1 - hidden.
2 - very hidden.
Specified by: in interface
Parameters:sheetIx - the sheet index (0-based)hidden - one of the following Workbook constants:
Workbook.SHEET_STATE_VISIBLE,
Workbook.SHEET_STATE_HIDDEN, or
Workbook.SHEET_STATE_VERY_HIDDEN.
java.lang.IllegalArgumentException - if the supplied sheet index or state is invalid
addToolPack
public void addToolPack(&toopack)
Register a new toolpack in this workbook.
Specified by: in interface
Parameters:toopack - the toolpack to register
setForceFormulaRecalculation
public void setForceFormulaRecalculation(boolean&value)
Whether the application shall perform a full recalculation when the workbook is opened.
Typically you want to force formula recalculation when you modify cell formulas or values
of a workbook previously created by Excel. When set to 0, this flag will tell Excel
that it needs to recalculate all formulas in the workbook the next time the file is opened.
Specified by: in interface
Parameters:value - true if the application will perform a full recalculation of
workbook values when the workbook is openedSince:
getForceFormulaRecalculation
public boolean getForceFormulaRecalculation()
Whether Excel will be asked to recalculate all formulas when the
workbook is opened.
Specified by: in interface
Copyright 2012 The Apache Software Foundation or
its licensors, as applicable.

我要回帖

更多关于 sxssfworkbook 读取 的文章

 

随机推荐