ImageOrPrintOptions class

ImageOrPrintOptions class

Allows to specify options when rendering worksheet to images, printing worksheet or rendering chart to image.

The ImageOrPrintOptions type exposes the following members:

Constructors

ConstructorDescription
initConstructs a new instance of ImageOrPrintOptions

Properties

PropertyDescription
save_formatGets or sets the output file format type
Support Tiff/XPS
print_with_status_dialogIf PrintWithStatusDialog = true , there will be a dialog that shows current print status.
else no such dialog will show.
horizontal_resolutionGets or sets the horizontal resolution for generated images, in dots per inch.
Applies generating image method except Emf format images.
vertical_resolutionGets or sets the vertical resolution for generated images, in dots per inch.
Applies generating image method except Emf format image.
tiff_compressionGets or sets the type of compression to apply only when saving pages to the Tiff format.
tiff_color_depthGets or sets bit depth to apply only when saving pages to the Tiff format.
tiff_binarization_methodGets or sets method used while converting images to 1 bpp format
when ImageOrPrintOptions.image_type is Tiff and ImageOrPrintOptions.tiff_compression is equal to Ccitt3 or Ccitt4.
printing_pageIndicates which pages will not be printed.
qualityGets or sets a value determining the quality of the generated images
to apply only when saving pages to the Jpeg format. The default value is 100
image_typeGets or sets the format of the generated images.
default value: PNG.
is_cell_auto_fitIndicates whether the width and height of the cells is automatically fitted by cell value.
The default value is false.
one_page_per_sheetIf OnePagePerSheet is true , all content of one sheet will output to only one page in result.
The paper size of pagesetup will be invalid, and the other settings of pagesetup
will still take effect.
all_columns_in_one_page_per_sheetIf AllColumnsInOnePagePerSheet is true , all column content of one sheet will output to only one page in result.
The width of paper size of pagesetup will be invalid, and the other settings of pagesetup
will still take effect.
draw_object_event_handlerImplements this interface to get DrawObject and Bound when rendering.
chart_image_typeIndicate the chart imagetype when converting.
default value: PNG.
embeded_image_name_in_svgIndicate the filename of embedded image in svg.
This should be full path with directory like “c:\xpsEmbedded”
svg_fit_to_view_portif this property is true, the generated svg will fit to view port.
only_areaIf this property is true , one Area will be output, and no scale will take effect.
text_rendering_hintSpecifies the quality of text rendering.
The default value is TextRenderingHint.SystemDefault
smoothing_modeSpecifies whether smoothing (antialiasing) is applied to lines and curves and the edges of filled areas.
The default value is SmoothingMode.None
transparentIndicates if the background of generated image should be transparent.
pixel_formatGets or sets the pixel format for the generated images.
warning_callbackGets or sets warning callback.
page_saving_callbackControl/Indicate progress of page saving process.
is_font_substitution_char_granularityIndicates whether to only substitute the font of character when the cell font is not compatibility for it.
page_indexGets or sets the 0-based index of the first page to save.
page_countGets or sets the number of pages to save.
is_optimizedIndicates whether to optimize the output elements.
default_fontWhen characters in the Excel are Unicode and not be set with correct font in cell style,
They may appear as block in pdf,image.
Set the DefaultFont such as MingLiu or MS Gothic to show these characters.
If this property is not set, Aspose.Cells will use system default font to show these unicode characters.
check_workbook_default_fontWhen characters in the Excel are Unicode and not be set with correct font in cell style,
They may appear as block in pdf,image.
Set this to true to try to use workbook’s default font to show these characters first.
output_blank_page_when_nothing_to_printIndicates whether to output a blank page when there is nothing to print.
gridline_typeGets or sets gridline type.
text_cross_typeGets or sets displaying text type when the text width is larger than cell width.
emf_typeGets or sets an EmfType that specifies the format of the Metafile..
The default value is EmfPlusDual.
default_edit_languageGets or sets default edit language.
sheet_setGets or sets the sheets to render. Default is all visible sheets in the workbook: SheetSet.visible.
emf_render_settingSetting for rendering Emf metafile.

Methods

MethodDescription
set_desired_sizeSets desired width and height of image.
set_desired_sizeSets desired width and height of image.

Example

from aspose.cells import Workbook
from aspose.cells.drawing import ImageType
from aspose.cells.rendering import ImageOrPrintOptions

# Set Image Or Print Options
options = ImageOrPrintOptions()
# Set output image format
options.image_type = ImageType.PNG
# Set Horizontal resolution
options.horizontal_resolution = 300
# Set Vertical Resolution
options.vertical_resolution = 300
# Instantiate Workbook
book = Workbook("test.xls")
# Save chart as Image using ImageOrPrint Options
book.worksheets[0].charts[0].to_image("chart.png", options)

See Also