Class SpreadsheetMLPackage
java.lang.Object
org.docx4j.openpackaging.Base
org.docx4j.openpackaging.packages.OpcPackage
org.docx4j.openpackaging.packages.SpreadsheetMLPackage
- All Implemented Interfaces:
PackageIdentifier
public class SpreadsheetMLPackage extends OpcPackage
- Author:
- jharrop
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.LoggerlogFields inherited from class org.docx4j.openpackaging.packages.OpcPackage
contentTypeManager, customXmlDataStorageParts, docPropsCorePart, docPropsCustomPart, docPropsExtendedPart, externalResources, handled, parts -
Constructor Summary
Constructors Constructor Description SpreadsheetMLPackage()Constructor.SpreadsheetMLPackage(ContentTypeManager contentTypeManager)Constructor. -
Method Summary
Modifier and Type Method Description static SpreadsheetMLPackagecreatePackage()Create an empty presentation.WorksheetPartcreateWorksheetPart(PartName partName, java.lang.String sheetName, long sheetId)Create a worksheet and add it to the packageProtectWorkbookgetProtectionSettings()WorkbookPartgetWorkbookPart()static SpreadsheetMLPackageload(java.io.File xlsxFile)Convenience method to create a SpreadsheetMLPackage from an existing File (.xlsx or .xml Flat OPC).static SpreadsheetMLPackageload(java.io.InputStream xlsxInputStream)Creates aSpreadsheetMLPackagefrom anInputStream.static voidmain(java.lang.String[] args)voidreset()Reinit fields so this pkg object can be re-used.booleansetPartShortcut(Part part, java.lang.String relationshipType)Tell the source Part about this target Part, so the source can use this part via a convenience method.Methods inherited from class org.docx4j.openpackaging.packages.OpcPackage
addDocPropsCorePart, addDocPropsCustomPart, addDocPropsExtendedPart, clone, cloneAs, getContentTypeManager, getCustomXmlDataStorageParts, getDocPropsCorePart, getDocPropsCustomPart, getDocPropsExtendedPart, getExternalResources, getPackage, getParts, getSourcePartStore, getTargetPartStore, getTitle, isNew, load, load, load, load, load, load, load, load, load, load, name, save, save, save, save, save, save, setContentTypeManager, setName, setNew, setSourcePartStore, setTargetPartStore, setTitleMethods inherited from class org.docx4j.openpackaging.Base
addTargetPart, addTargetPart, addTargetPart, addTargetPart, getContentType, getPartName, getRelationshipsPart, getRelationshipsPart, getUserData, setContentType, setPartName, setRelationships, setUserData
-
Field Details
-
log
protected static org.slf4j.Logger log
-
-
Constructor Details
-
SpreadsheetMLPackage
public SpreadsheetMLPackage()Constructor. Also creates a new content type manager -
SpreadsheetMLPackage
Constructor.- Parameters:
contentTypeManager- The content type manager to use
-
-
Method Details
-
getProtectionSettings
-
getWorkbookPart
-
load
Convenience method to create a SpreadsheetMLPackage from an existing File (.xlsx or .xml Flat OPC).- Parameters:
xlsxFile- The xlsx file- Throws:
Docx4JException
-
load
public static SpreadsheetMLPackage load(java.io.InputStream xlsxInputStream) throws Docx4JExceptionCreates aSpreadsheetMLPackagefrom anInputStream.- Parameters:
xlsxInputStream- anInputStreamof an .xlsx file- Returns:
- a
PresentationMLPackagerepresenting the .xlsx file - Throws:
Docx4JException- if an exception is encountered in processing
-
setPartShortcut
Description copied from class:BaseTell the source Part about this target Part, so the source can use this part via a convenience method.- Overrides:
setPartShortcutin classOpcPackage- Returns:
- true if the source Part does use the target Part in a convenience method.
-
createPackage
Create an empty presentation.- Returns:
- Throws:
InvalidFormatException
-
createWorksheetPart
public WorksheetPart createWorksheetPart(PartName partName, java.lang.String sheetName, long sheetId) throws InvalidFormatException, javax.xml.bind.JAXBExceptionCreate a worksheet and add it to the package- Parameters:
wb-partName-sheetName-sheetId-- Returns:
- Throws:
InvalidFormatExceptionjavax.xml.bind.JAXBException
-
reset
public void reset()Reinit fields so this pkg object can be re-used.- Overrides:
resetin classOpcPackage- Since:
- 3.3.7
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception- Throws:
java.lang.Exception
-