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 Details

    • log

      protected static org.slf4j.Logger log
  • Constructor Details

    • SpreadsheetMLPackage

      public SpreadsheetMLPackage()
      Constructor. Also creates a new content type manager
    • SpreadsheetMLPackage

      public SpreadsheetMLPackage​(ContentTypeManager contentTypeManager)
      Constructor.
      Parameters:
      contentTypeManager - The content type manager to use
  • Method Details

    • getProtectionSettings

      public ProtectWorkbook getProtectionSettings()
    • getWorkbookPart

      public WorkbookPart getWorkbookPart()
    • load

      public static SpreadsheetMLPackage load​(java.io.File xlsxFile) throws Docx4JException
      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 Docx4JException
      Creates a SpreadsheetMLPackage from an InputStream.
      Parameters:
      xlsxInputStream - an InputStream of an .xlsx file
      Returns:
      a PresentationMLPackage representing the .xlsx file
      Throws:
      Docx4JException - if an exception is encountered in processing
    • setPartShortcut

      public boolean setPartShortcut​(Part part, java.lang.String relationshipType)
      Description copied from class: Base
      Tell the source Part about this target Part, so the source can use this part via a convenience method.
      Overrides:
      setPartShortcut in class OpcPackage
      Returns:
      true if the source Part does use the target Part in a convenience method.
    • createPackage

      public static SpreadsheetMLPackage createPackage() throws InvalidFormatException
      Create an empty presentation.
      Returns:
      Throws:
      InvalidFormatException
    • createWorksheetPart

      public WorksheetPart createWorksheetPart​(PartName partName, java.lang.String sheetName, long sheetId) throws InvalidFormatException, jakarta.xml.bind.JAXBException
      Create a worksheet and add it to the package
      Parameters:
      wb -
      partName -
      sheetName -
      sheetId -
      Returns:
      Throws:
      InvalidFormatException
      jakarta.xml.bind.JAXBException
    • reset

      public void reset()
      Reinit fields so this pkg object can be re-used.
      Overrides:
      reset in class OpcPackage
      Since:
      3.3.7
    • main

      public static void main​(java.lang.String[] args) throws java.lang.Exception
      Throws:
      java.lang.Exception