public class ExcelDocument extends Object implements Printable
NO_SUCH_PAGE, PAGE_EXISTS
Constructor and Description |
---|
ExcelDocument(byte[] byteArray)
Load an Excel file from a byte array.
|
ExcelDocument(byte[] byteArray,
ExcelConvertOptions opts)
Load an Excel file from a byte array.
|
ExcelDocument(InputStream inputStream)
Load an Excel document from an input stream.
|
ExcelDocument(InputStream inputStream,
ExcelConvertOptions opts)
Load an Excel document from an input stream.
|
ExcelDocument(String filePath)
Load an Excel document from a file.
|
ExcelDocument(String filePath,
ExcelConvertOptions opts)
Load an Excel document from a file - with convert options
|
ExcelDocument(URL url)
Load an Excel file from a URL.
|
ExcelDocument(URL url,
ExcelConvertOptions opts)
Load an Excel file from a URL.
|
Modifier and Type | Method and Description |
---|---|
int |
getPageCount()
Return the number of pages in the converted document.
|
static String |
getVersion()
Returns version string for jOfficeConvert.
|
List<String> |
getWorkSheetNames() |
static void |
loadLicense(InputStream licenseStream)
Method to load a license file from an inputstream.
|
static void |
loadLicense(String licenseFile)
Method to load a license file.
|
int |
print(Graphics graphics,
PageFormat pageFormat,
int pageIndex)
Implementation of the print method to make ExcelDocument fulfill the Printable interface.
|
void |
print(PrintOptions options)
Prints this Excel document.
|
void |
print(String printerName,
PrintOptions options)
Prints this Excel document to the specified printer, by name.
|
void |
print(String printerName,
PrintOptions options,
PrintRequestAttributeSet printAttrSet)
Prints this Excel document to the specified printer, by name and passes the attribute set to the printer job.
|
void |
printToDefaultPrinter(PrintOptions options)
Prints the Excel document to the default printer.
|
void |
saveAsPDF(OutputStream pdfFileStream)
Converts the Excel document into a PDF document then
saves the created PDF Document to a file using an Output Stream
|
void |
saveAsPDF(OutputStream pdfFileStream,
PDFSecuritySettings securitySettings)
Converts the Excel document into a PDF document, applies
the security settings and then saves the created PDF Document to
a file using an Output Stream
|
void |
saveAsPDF(String pdfFile)
Converts the Excel document into a PDF document then
saves the created PDF Document to a file using a String filename
|
void |
saveAsPDF(String pdfFile,
PDFSecuritySettings securitySettings)
Converts the Excel document into a PDF document, applies
the security settings and then saves the created PDF Document to
a file using a String filename
|
void |
saveDocumentAsTIFF(OutputStream outStream,
TIFFOptions options)
Save the entire document as a multi-page TIFF image the given OutputStream.
|
void |
saveDocumentAsTIFF(String fileName,
TIFFOptions options)
Save the entire document as a multi-page TIFF image to the given String Filename.
|
void |
savePageAsGIF(int pageIndex,
OutputStream outStream,
int dpi)
Save the rendered image of the page to the given OutputStream in GIF format.
|
void |
savePageAsGIF(int pageIndex,
String fileName,
int dpi)
Save the rendered image of the page to the given String Filename in GIF format.
|
void |
savePageAsJPEG(int pageIndex,
OutputStream outStream,
int resDPI,
float quality)
Save the rendered image of the page to the given OutputStream in JPEG format.
|
void |
savePageAsJPEG(int pageIndex,
String fileName,
int resDPI,
float quality)
Save the rendered image of the page to the given String Filename in JPEG format.
|
void |
savePageAsPNG(int pageIndex,
OutputStream outStream,
int dpi)
Save the rendered image of the page to the given OutputStream in PNG format.
|
void |
savePageAsPNG(int pageIndex,
String fileName,
int dpi)
Save the rendered image of the page to the given String Filename in PNG format.
|
void |
savePageAsTIFF(int pageIndex,
OutputStream outStream,
TIFFOptions options)
Render a page to an image and save it in TIFF format.
|
void |
savePageAsTIFF(int pageIndex,
String fileName,
TIFFOptions options)
Render a page to an image and save it in TIFF format.
|
static boolean |
setKey(String key)
Sets product key.
|
static void |
setUserFontDirectories(List<String> userFontDirs)
Set user font directories.
|
void |
setWorksheetsToConvert(List<String> worksheetNamesToConvert)
Set a list of WorkSheet names to restrict PDF conversion to.
|
public ExcelDocument(String filePath, ExcelConvertOptions opts) throws IOException, OfficeException
filePath
- The path to the fileopts
- Excel file conversion optionsIOException
OfficeException
public ExcelDocument(String filePath) throws IOException, OfficeException
filePath
- The path to the fileIOException
OfficeException
public ExcelDocument(InputStream inputStream, ExcelConvertOptions opts) throws IOException, OfficeException
inputStream
- Input Stream representing the Excel fileopts
- Excel file conversion optionsIOException
OfficeException
public ExcelDocument(InputStream inputStream) throws IOException, OfficeException
inputStream
- Input Stream representing the Excel fileIOException
OfficeException
public ExcelDocument(byte[] byteArray, ExcelConvertOptions opts) throws IOException, OfficeException
byteArray
- byteArray representing the Excel fileopts
- Excel file conversion optionsIOException
OfficeException
public ExcelDocument(byte[] byteArray) throws IOException, OfficeException
byteArray
- byteArray representing the Excel fileIOException
OfficeException
public ExcelDocument(URL url, ExcelConvertOptions opts) throws IOException, OfficeException
url
- URL representing the Excel fileopts
- Excel file conversion optionsIOException
OfficeException
public ExcelDocument(URL url) throws IOException, OfficeException
url
- URL representing the Excel fileIOException
OfficeException
public static boolean setKey(String key)
key
- Product key.public static void loadLicense(InputStream licenseStream) throws com.qoppa.pdf.LicenseException
licenseStream
- The input stream for the license file contents.com.qoppa.pdf.LicenseException
- If there are any problems with the license filepublic static void loadLicense(String licenseFile) throws com.qoppa.pdf.LicenseException, IOException
licenseFile
- The full path to the license file.com.qoppa.pdf.LicenseException
- If there are any problems with the license fileIOException
public static String getVersion()
public void saveAsPDF(String pdfFile) throws IOException, PDFException
pdfFile
- String representing the name of the file to save toPDFException
IOException
public void saveAsPDF(OutputStream pdfFileStream) throws IOException, PDFException
pdfFileStream
- Output Stream the PDF document will be written toPDFException
IOException
public void saveAsPDF(String pdfFile, PDFSecuritySettings securitySettings) throws PDFException, IOException
pdfFile
- String representing the name of the file to save tosecuritySettings
- PDFSecuritySettings object containing encryption informationIOException
PDFException
public void saveAsPDF(OutputStream pdfFileStream, PDFSecuritySettings securitySettings) throws PDFException, IOException
pdfFileStream
- Output Stream the PDF document will be written tosecuritySettings
- PDFSecuritySettings object containing encryption informationIOException
PDFException
public int getPageCount() throws PDFException
PDFException
public void print(PrintOptions options) throws PrinterException, OfficeException
options
- Print job settings. Use this object to define
how to print the document. If null, it will print using default settings.PrinterException
OfficeException
public void print(String printerName, PrintOptions options) throws PrinterException, OfficeException
options
- Print job settings. Use this object to define
how to print the document. If null, it will print using default settings.printerName
- The name of the printer to print to. If this parameter
is set to null, the method will print to the default printer.PrinterException
- This exception is thrown if the printer is not
found or if there is an error while printing.OfficeException
public void print(String printerName, PrintOptions options, PrintRequestAttributeSet printAttrSet) throws PrinterException, OfficeException
options
- Print job settings. Use this object to define
how to print the document. If null, it will print using default settings.printerName
- The name of the printer to print to. If this parameter
is set to null, the method will print to the default printer.printAttrSet
- The attribute set to pass to the printer. This parameter simply gets passed through to the printer job to set options
such as the media tray, chromaticity and others. If null is passed, the print job will use default attributes.PrinterException
- This exception is thrown if the printer is not
found or if there is an error while printing.OfficeException
public void printToDefaultPrinter(PrintOptions options) throws PrinterException, OfficeException
options
- Print job settings. Use this object to define
how to print the document. If null, it will print using default settings.PrinterException
- This exception is thrown if the printer is not
found or if there is an error while printing.OfficeException
public void savePageAsPNG(int pageIndex, OutputStream outStream, int dpi) throws IOException, OfficeException
pageIndex
- The 0 based page index.outStream
- The stream to save the image to.dpi
- Dots per inch at which to render the image. 72 is the native PDF resolution and is equivalent to 100% scale.IOException
OfficeException
public void savePageAsPNG(int pageIndex, String fileName, int dpi) throws IOException, OfficeException
pageIndex
- The 0 based page index.fileName
- The name of the PNG file.dpi
- Dots per inch at which to render the image. 72 is the native PDF resolution and is equivalent to 100% scale.IOException
OfficeException
public void savePageAsGIF(int pageIndex, OutputStream outStream, int dpi) throws IOException, OfficeException
pageIndex
- The 0 based page index.outStream
- The stream to save the image to.dpi
- Dots per inch at which to render the image. 72 is the native PDF resolution and is equivalent to 100% scale.IOException
OfficeException
public void savePageAsGIF(int pageIndex, String fileName, int dpi) throws IOException, OfficeException
pageIndex
- The 0 based page index.fileName
- The name of the GIF file.dpi
- Dots per inch at which to render the image. 72 is the native PDF resolution and is equivalent to 100% scale.IOException
OfficeException
public void savePageAsJPEG(int pageIndex, OutputStream outStream, int resDPI, float quality) throws IOException, OfficeException
pageIndex
- The 0 based page index.outStream
- The stream to save the image to.resDPI
- Dots per inch at which to render the image. 72 is the native PDF resolution and is equivalent to 100% scale.quality
- The quality setting to use for JPEG compression. The range for this value is 0.0 to 1.0.
Lower values mean higher compression and lower quality. As a guideline, 0.25 is low quality, 0.5 is medium
quality and 0.75 is high quality.IOException
OfficeException
public void savePageAsJPEG(int pageIndex, String fileName, int resDPI, float quality) throws IOException, OfficeException
pageIndex
- The 0 based page index.fileName
- The name of the file to save to.resDPI
- Dots per inch at which to render the image. 72 is the native PDF resolution and is equivalent to 100% scale.quality
- The quality setting to use for JPEG compression. The range for this value is 0.0 to 1.0.
Lower values mean higher compression and lower quality. As a guideline, 0.25 is low quality, 0.5 is medium
quality and 0.75 is high quality.IOException
OfficeException
public void savePageAsTIFF(int pageIndex, String fileName, TIFFOptions options) throws IOException, OfficeException
pageIndex
- The 0 based page index.fileName
- The name of the file to save the image to.options
- Options to use when saving the image, such as the TIFF compression type.IOException
OfficeException
public void savePageAsTIFF(int pageIndex, OutputStream outStream, TIFFOptions options) throws IOException, OfficeException
pageIndex
- The 0 based page index.outStream
- The output stream to write the image to.options
- Options to use when saving the image, such as the TIFF compression type.IOException
OfficeException
public void saveDocumentAsTIFF(String fileName, TIFFOptions options) throws IOException, OfficeException
TIFFOptions
object as an argument to describe various
TIFF options when saving the file.fileName
- The name of the file to write the TIFF image to.options
- Options to use when saving the TIFF file.IOException
OfficeException
public void saveDocumentAsTIFF(OutputStream outStream, TIFFOptions options) throws IOException, OfficeException
TIFFOptions
object as an argument to describe various
TIFF options when saving the file.outStream
- The stream to save the image to.options
- Options to use when saving the TIFF file.IOException
OfficeException
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
print
in interface Printable
graphics
- The printer graphics to draw the page ontopageFormat
- The page format of the target pagepageIndex
- The page to printPrinterException
public static void setUserFontDirectories(List<String> userFontDirs)
userFontDirs
- - List of font directory path stringspublic List<String> getWorkSheetNames()
public void setWorksheetsToConvert(List<String> worksheetNamesToConvert)
worksheetNamesToConvert
- - list of worksheet names to be
appended in subsequent saveDocument* call(s), in order given.
If null, all worksheets will be appended in original order.
Null by default.