Apache poi java xssfworkbook

Apache poi java xssfworkbook

High level representation of a SpreadsheetML workbook. This is the first object most users will construct whether they are reading or writing a workbook. It is also the top level object for creating new sheets/etc.

Nested Class Summary

Nested classes/interfaces inherited from class org.apache.poi.ooxml.POIXMLDocumentPart

Field Summary

Fields inherited from class org.apache.poi.ooxml.POIXMLDocument

Fields inherited from interface org.apache.poi.ss.usermodel.Workbook

Constructor Summary

Constructs a XSSFWorkbook object, by buffering the whole stream into memory and then opening an OPCPackage object for it.

Constructs a XSSFWorkbook object given a OpenXML4J Package object, see https://poi.apache.org/oxml4j/.

Method Summary

All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
Modifier and Type Method and Description
int addOlePackage (byte[] oleData, java.lang.String label, java.lang.String fileName, java.lang.String command)

Create an XSSFSheet for this workbook, adds it to the sheets and returns the high level representation.

Retrieves the reference for the printarea of the specified sheet, the sheet name is appended to the reference even if it was not specified.

Adds the External Link Table part and relations required to allow formulas referencing the specified external workbook to be added to this one.

Fired when a formula is deleted from this workbook, for example when calling cell.setCellFormula(null)

Not normally to be called externally, but possibly to be overridden to avoid the DOM based parse of large sheets (see examples).

Validate the password against the stored hash, the hashing method will be determined by the existing password attributes

Validate the password against the stored hash, the hashing method will be determined by the existing password attributes

Methods inherited from class org.apache.poi.ooxml.POIXMLDocument

Methods inherited from class org.apache.poi.ooxml.POIXMLDocumentPart

Methods inherited from class java.lang.Object

Methods inherited from interface org.apache.poi.ss.usermodel.Workbook

Methods inherited from interface java.lang.Iterable

Field Detail

PICTURE_TYPE_GIF

public static final int PICTURE_TYPE_GIF

PICTURE_TYPE_TIFF

public static final int PICTURE_TYPE_TIFF

PICTURE_TYPE_EPS

public static final int PICTURE_TYPE_EPS

PICTURE_TYPE_BMP

public static final int PICTURE_TYPE_BMP

PICTURE_TYPE_WPG

public static final int PICTURE_TYPE_WPG

Constructor Detail

XSSFWorkbook

XSSFWorkbook

XSSFWorkbook

XSSFWorkbook

public XSSFWorkbook(OPCPackage pkg) throws java.io.IOException

Constructs a XSSFWorkbook object given a OpenXML4J Package object, see https://poi.apache.org/oxml4j/. Once you have finished working with the Workbook, you should close the package by calling either close() or OPCPackage.close() , to avoid leaving file handles open. Creating a XSSFWorkbook from a file-backed OPC Package has a lower memory footprint than an InputStream backed one.

XSSFWorkbook

public XSSFWorkbook(java.io.InputStream is) throws java.io.IOException

Constructs a XSSFWorkbook object, by buffering the whole stream into memory and then opening an OPCPackage object for it. Using an InputStream requires more memory than using a File, so if a File is available then you should instead do something like

 OPCPackage pkg = OPCPackage.open(path); XSSFWorkbook wb = new XSSFWorkbook(pkg); // work with the wb object . pkg.close(); // gracefully closes the underlying zip file 

XSSFWorkbook

Constructs a XSSFWorkbook object from a given file. Once you have finished working with the Workbook, you should close the package by calling close() , to avoid leaving file handles open. Opening a XSSFWorkbook from a file has a lower memory footprint than opening from an InputStream

XSSFWorkbook

public XSSFWorkbook(java.lang.String path) throws java.io.IOException

Constructs a XSSFWorkbook object given a file name. Once you have finished working with the Workbook, you should close the package by calling close() , to avoid leaving file handles open. Opening a XSSFWorkbook from a file has a lower memory footprint than opening from an InputStream

XSSFWorkbook

public XSSFWorkbook(PackagePart part) throws java.io.IOException

Method Detail

beforeDocumentRead

protected void beforeDocumentRead()

onDocumentRead

protected void onDocumentRead() throws java.io.IOException

parseSheet

public void parseSheet(java.util.MapXSSFSheet> shIdMap, org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheet ctSheet)

Not normally to be called externally, but possibly to be overridden to avoid the DOM based parse of large sheets (see examples).

newPackage

protected static OPCPackage newPackage(XSSFWorkbookType workbookType)

getCTWorkbook

@Internal public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook getCTWorkbook()

addPicture

public int addPicture(byte[] pictureData, int format)

addPicture

public int addPicture(java.io.InputStream is, int format) throws java.io.IOException

cloneSheet

Create an XSSFSheet from an existing sheet in the XSSFWorkbook. The cloned sheet is a deep copy of the original.

close

public void close() throws java.io.IOException

Closes the underlying OPCPackage from which this document was read, if there is one Once this has been called, no further operations, updates or reads should be performed on the document.

cloneSheet

public XSSFSheet cloneSheet(int sheetNum, java.lang.String newName)

Create an XSSFSheet from an existing sheet in the XSSFWorkbook. The cloned sheet is a deep copy of the original but with a new given name.

createCellStyle

createDataFormat

createFont

createName

createSheet

Create an XSSFSheet for this workbook, adds it to the sheets and returns the high level representation. Use this to create new sheets.

createSheet

public XSSFSheet createSheet(java.lang.String sheetname)

Create a new sheet for this Workbook and return the high level representation. Use this to create new sheets. Note that Excel allows sheet names up to 31 chars in length but other applications (such as OpenOffice) allow more. Some versions of Excel crash with names longer than 31 chars, others — truncate such names to 31 character. POI’s SpreadsheetAPI silently truncates the input argument to 31 characters. Example:

 Sheet sheet = workbook.createSheet("My very long sheet name which is longer than 31 chars"); // will be truncated assert 31 == sheet.getSheetName().length(); assert "My very long sheet name which i" == sheet.getSheetName(); 
  • 0x0000
  • 0x0003
  • colon (:)
  • backslash (\)
  • asterisk (*)
  • question mark (?)
  • forward slash (/)
  • opening square bracket ([)
  • closing square bracket (])

createDialogsheet

protected XSSFDialogsheet createDialogsheet(java.lang.String sheetname, org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDialogsheet dialogsheet)

findFont

public XSSFFont findFont(boolean bold, short color, short fontHeight, java.lang.String name, boolean italic, boolean strikeout, short typeOffset, byte underline)

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.

getAllPictures

getCellStyleAt

Источник

Читайте также:  Expecting to variable php
Оцените статью