Package ch.rabanti.nanoxlsx4j.lowLevel
Class Packer
java.lang.Object
ch.rabanti.nanoxlsx4j.lowLevel.Packer
Class representing a packer to compile XLSX files
- Author:
- Raphael Stoeckli
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classNested class representing a relationship (MSXML) -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a Part to the filevoidAdds a Part to the filecreateRelationship(String path) Creates a relationship.voidpack(OutputStream stream) Method to pack the data into a XLSX file.
-
Constructor Details
-
Packer
Default constructor with parameter- Parameters:
reference- Reference to the low level instance
-
-
Method Details
-
addPart
Adds a Part to the file- Parameters:
name- Filename with relative pathcontentType- URL with information about the content type (MSXML).
This information is used in the main content type filedocument- XML document to add- Throws:
IOException- Thrown if the document could not be converted to a byte array
-
addPart
public void addPart(String name, String contentType, Document document, boolean includeInContentType) throws IOException Adds a Part to the file- Parameters:
name- Filename with relative pathcontentType- URL with information about the content type (MSXML).
This information is used in the main content type filedocument- XML document to addincludeInContentType- If true, the content type will be added in the main content type file, otherwise not- Throws:
IOException- Thrown if the document could not be converted to a byte array
-
createRelationship
Creates a relationship. This will be used to generate a .rels file in the compilation (MSXML)- Parameters:
path- relative path and filename to rels file (e.g. _rels/.rels)- Returns:
- Returns the object reference to add relationship entries
-
pack
Method to pack the data into a XLSX file. This is the actual compiling and writing method (to a OutputStream)- Parameters:
stream- OutputStream to save the data into- Throws:
IOException- Thrown in case of an error while packing or writing
-