Represents a worksheet render which can render worksheet to various images such as (BMP, PNG, JPEG, TIFF..)
The constructor of this class , must be used after modification of pagesetup, cell style.
Example:
Workbook wb = new Workbook("Book1.xlsx");
SheetRender sheetRender = new SheetRender(wb.getWorksheets().get(0), new ImageOrPrintOptions());
//Gets calculated page scale of the sheet.
double pageScale = sheetRender.getPageScale();
Get page size of output image. The size unit is in point.
NOTE: This method is now obsolete.
Instead, please use GetPageSizeInch(int pageIndex).
This property will be removed 12 months later since October 2021.
Aspose apologizes for any inconvenience you may have experienced.
Parameters:
pageIndex - The page index is based on zero.
Returns:
Page size of image, [0] for width and [1] for height
getPageSizeInch
public float[] getPageSizeInch(int pageIndex)
Get page size in inch of output image.
Parameters:
pageIndex - The page index is based on zero.
Returns:
Page size of image, [0] for width and [1] for height
toImage
public void toImage(int pageIndex, java.lang.String fileName)
throws java.lang.Exception
Render certain page to a file.
Parameters:
pageIndex - indicate which page is to be converted
fileName - filename of the output image
Example:
//load the source file with images.
Workbook wb = new Workbook("Book1.xlsx");
ImageOrPrintOptions imgOpt = new ImageOrPrintOptions();
//set output image type.
imgOpt.setImageType(ImageType.PNG);
//render the first sheet.
SheetRender sr = new SheetRender(wb.getWorksheets().get(0), imgOpt);
//output the first page of the sheet to image.
sr.toImage(0, "output.png");
toImage
public void toImage(int pageIndex, java.io.OutputStream stream)
throws java.lang.Exception
Render certain page to a stream.
Parameters:
pageIndex - indicate which page is to be converted
stream - the stream of the output image
toPrinter
public void toPrinter(java.lang.String printerName)
throws java.lang.Exception
Render worksheet to Printer
Parameters:
printerName - the name of the printer , for example: "Microsoft Office Document Image Writer"
toPrinter
public void toPrinter(java.lang.String printerName, java.lang.String jobName)
throws java.lang.Exception
Render worksheet to Printer
Parameters:
printerName - the name of the printer , for example: "Microsoft Office Document Image Writer"