Package ch.rabanti.picoxlsx4j.lowLevel
Class Packer
- java.lang.Object
-
- ch.rabanti.picoxlsx4j.lowLevel.Packer
-
public class Packer extends Object
Class representing packer to compile XLSX files- Author:
- Raphael Stoeckli
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Packer.Relationship
Nested class representing a relationship (MSXML)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPart(String name, String contentType, Document document)
Adds a Part to the filevoid
addPart(String name, String contentType, Document document, boolean includeInContentType)
Adds a Part to the filePacker.Relationship
createRelationship(String path)
Creates a relationship.void
pack(OutputStream stream)
Method to pack the data into a XLSX file.
-
-
-
Constructor Detail
-
Packer
public Packer(LowLevel reference)
Default constructor with parameter- Parameters:
reference
- Reference to the low level instance
-
-
Method Detail
-
addPart
public void addPart(String name, String contentType, Document document) 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 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
public Packer.Relationship createRelationship(String path)
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
public void pack(OutputStream stream) throws IOException
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 a error while packing or writing
-
-