ImageOrPrintOptions

ImageOrPrintOptions class

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

public class ImageOrPrintOptions

Constructors

Name Description
ImageOrPrintOptions() The default constructor.

Properties

Name Description
AllColumnsInOnePagePerSheet { get; set; } If 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.
ChartImageType { get; set; } (Obsolete.) Indicate the chart imagetype when converting. default value: PNG.
CheckWorkbookDefaultFont { get; set; } When 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.
CustomPrintPageEventHandler { get; set; } Client can special output to printer when print each page using this EventHandler
CustomQueryPageSettingsEventHandler { get; set; } Client can control page setting of printer when print each page using this EventHandler
DefaultEditLanguage { get; set; } Gets or sets default edit language.
DefaultFont { get; set; } When 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.
DrawObjectEventHandler { get; set; } Implements this interface to get DrawObject and Bound when rendering.
EmbededImageNameInSvg { get; set; } Indicate the filename of embedded image in svg. This should be full path with directory like “c:\xpsEmbedded”
EmfType { get; set; } Gets or sets an EmfType that specifies the format of the Metafile.. The default value is EmfPlusDual.
GridlineType { get; set; } Gets or sets gridline type.
HorizontalResolution { get; set; } Gets or sets the horizontal resolution for generated images, in dots per inch. Applies generating image method except Emf format images.
ImageType { get; set; } Gets or sets the format of the generated images. default value: PNG.
IsCellAutoFit { get; set; } (Obsolete.) Indicates whether the width and height of the cells is automatically fitted by cell value. The default value is false.
IsFontSubstitutionCharGranularity { get; set; } Indicates whether to only substitute the font of character when the cell font is not compatibility for it.
IsOptimized { get; set; } Indicates whether to optimize the output elements.
OnePagePerSheet { get; set; } If 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.
OnlyArea { get; set; } If this property is true , one Area will be output, and no scale will take effect.
OutputBlankPageWhenNothingToPrint { get; set; } Indicates whether to output a blank page when there is nothing to print.
PageCount { get; set; } Gets or sets the number of pages to save.
PageIndex { get; set; } Gets or sets the 0-based index of the first page to save.
PageSavingCallback { get; set; } Control/Indicate progress of page saving process.
PixelFormat { get; set; } Gets or sets the pixel format for the generated images.
PrintingPage { get; set; } Indicates which pages will not be printed.
PrintWithStatusDialog { get; set; } If PrintWithStatusDialog = true , there will be a dialog that shows current print status. else no such dialog will show.
Quality { get; set; } Gets 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
SaveFormat { get; set; } (Obsolete.) Gets or sets the output file format type Support Tiff/XPS
SheetSet { get; set; } Gets or sets the sheets to render. Default is all visible sheets in the workbook: Visible.
SmoothingMode { get; set; } Specifies whether smoothing (antialiasing) is applied to lines and curves and the edges of filled areas. The default value is SmoothingMode.None
SVGFitToViewPort { get; set; } if this property is true, the generated svg will fit to view port.
TextCrossType { get; set; } Gets or sets displaying text type when the text width is larger than cell width.
TextRenderingHint { get; set; } Specifies the quality of text rendering. The default value is TextRenderingHint.SystemDefault
TiffColorDepth { get; set; } Gets or sets bit depth to apply only when saving pages to the Tiff format.
TiffCompression { get; set; } Gets or sets the type of compression to apply only when saving pages to the Tiff format.
Transparent { get; set; } Indicates if the background of generated image should be transparent.
VerticalResolution { get; set; } Gets or sets the vertical resolution for generated images, in dots per inch. Applies generating image method except Emf format image.
WarningCallback { get; set; } Gets or sets warning callback.

Methods

Name Description
SetDesiredSize(int, int) Sets desired width and height of image.

Examples


[C#]

//Set Image Or Print Options
ImageOrPrintOptions options = new ImageOrPrintOptions();

//Set output image format
options.ImageType = ImageType.Png;

//Set Horizontal resolution
options.HorizontalResolution = 300;

//Set Vertical Resolution
options.VerticalResolution = 300;

//Instantiate Workbook
Workbook book = new Workbook("test.xls");

//Save chart as Image using ImageOrPrint Options
book.Worksheets[0].Charts[0].ToImage("chart.png", options);

[VB.NET]

'Set Image Or Print Options
Dim options As New ImageOrPrintOptions()

'Set output image format
options.ImageType = ImageType.Png

'Set Horizontal resolution
options.HorizontalResolution = 300

'Set Vertical Resolution
options.VerticalResolution = 300

'Instantiate Workbook
Dim book As New Workbook("test.xls")

'Save chart as Image using ImageOrPrint Options
book.Worksheets(0).Charts(0).ToImage("chart.png", options)

See Also