GemBox.Spreadsheet
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    ImageSaveOptions Class

    Namespace:
    GemBox.Spreadsheet
    Assembly:
    GemBox.Spreadsheet.dll

    Represents a class which stores saving options for image files.

    • C#
    • VB.NET
    public sealed class ImageSaveOptions : SaveOptions
    Public NotInheritable Class ImageSaveOptions
        Inherits SaveOptions
    Inheritance:
    Object
    SaveOptions
    ImageSaveOptions

    Constructors

    ImageSaveOptions()

    Initializes a new instance of the ImageSaveOptions class.

    • C#
    • VB.NET
    public ImageSaveOptions()
    Public Sub New

    ImageSaveOptions(ImageSaveFormat)

    Initializes a new instance of the ImageSaveOptions class for a specific image format.

    • C#
    • VB.NET
    public ImageSaveOptions(ImageSaveFormat imageFormat)
    Public Sub New(imageFormat As ImageSaveFormat)
    Parameters
    imageFormat
    ImageSaveFormat

    The image format.

    Properties

    ContentType

    Gets the content-type for image file format:

    • image/png if Format is Png,
    • image/jpeg if Format is Jpeg,
    • image/gif if Format is Gif,
    • image/bmp if Format is Bmp,
    • image/tiff if Format is Tiff,
    • image/vnd.ms-photo if Format is Wmp.
    • C#
    • VB.NET
    public override string ContentType { get; }
    Public Overrides ReadOnly Property ContentType As String
    Property Value
    String

    The content-type for image file format.

    Overrides
    SaveOptions.ContentType

    CropToContent

    Gets or sets a value indicating whether the image should be cropped to fit the content of the sheet.

    If this property is set to true, only the content of the sheet is rendered, without headers or footers.

    • C#
    • VB.NET
    public bool CropToContent { get; set; }
    Public Property CropToContent As Boolean
    Property Value
    Boolean

    DpiX

    Gets or sets the horizontal dots per inch (dpi) of the image.

    Default value is NaN, which means that component specific default value will be used (currently 300).

    • C#
    • VB.NET
    public double DpiX { get; set; }
    Public Property DpiX As Double
    Property Value
    Double

    The horizontal dots per inch (dpi) of the image; that is, the dots per inch (dpi) along the x-axis.

    Exceptions
    ArgumentOutOfRangeException

    Value is not greater than 0.

    DpiY

    Gets or sets the vertical dots per inch (dpi) of the image.

    Default value is NaN, which means that component specific default value will be used (currently 300).

    • C#
    • VB.NET
    public double DpiY { get; set; }
    Public Property DpiY As Double
    Property Value
    Double

    The vertical dots per inch (dpi) of the image; that is, the dots per inch (dpi) along the y-axis.

    Exceptions
    ArgumentOutOfRangeException

    Value is not greater than 0.

    Format

    Gets or sets the image format.

    • C#
    • VB.NET
    public ImageSaveFormat Format { get; set; }
    Public Property Format As ImageSaveFormat
    Property Value
    ImageSaveFormat

    The image format.

    Height

    Gets or sets the image height in pixels.

    • C#
    • VB.NET
    public double Height { get; set; }
    Public Property Height As Double
    Property Value
    Double

    The image height in pixels.

    Remarks

    If both Width and Height are not specified, then image size will be equal to the page size.

    If only one of the Width or Height is specified, then the specified dimension will be respected and other dimension will be calculated so that original aspect ratio is maintained.

    If both Width and Height are specified, then both specified dimensions will be respected (which may result in non-uniformly scaled image, if aspect ratio is not equal to the original one.

    Limitations

    Gets limitations for saving to image file formats.

    • C#
    • VB.NET
    public override FileFormatLimitations Limitations { get; }
    Public Overrides ReadOnly Property Limitations As FileFormatLimitations
    Property Value
    FileFormatLimitations
    Overrides
    SaveOptions.Limitations
    Remarks

    These are the limits:

    • MaxRows: MaxValue
    • MaxColumns: MaxValue
    • MaxColors: MaxValue
    • MaxCellStyles: MaxValue

    MetafileScaleFactor

    Gets or sets the scaling factor for rendering metafile (WMF and EMF) images. Greater scaling factor improves quality but also increases file size. Default value is 1.

    • C#
    • VB.NET
    public double MetafileScaleFactor { get; set; }
    Public Property MetafileScaleFactor As Double
    Property Value
    Double

    The metafile scale factor for rendering metafile (WMF and EMF) images.

    Remarks

    Windows Metafile Format (WMF) and Enhanced Metafile Format (EMF) are vector image formats which contain a series of graphics drawing commands usually executed in Windows GDI layer.

    Metafile drawing commands could also be executed in PDF (or XPS) file which is also vector format, but for that Metafile drawing commands would have to be converted to PDF drawing commands.

    GemBox.Document currently doesn't perform this conversion of drawing commands, instead it uses Windows GDI to execute Metafile drawing commands into bitmap which is then encoded to PNG format and embedded into PDF file.

    MetafileScaleFactor specifies the size of the bitmap surface, based from the original Metafile surface size, into which Metafile should be drawn / rasterized.

    PDF viewer will still scale the bitmap to the original Metafile size, but if the page is zoomed or viewed on a larger surface, quality of the image will be better since it contains more pixels / dots which will become visible while PDF viewer scales down the image.

    MetafileScaleFactor increases the quality of the Metafile image in PDF file, but it also increases the size of the PDF file because greater MetafileScaleFactor means greater bitmap surface and more space to store bitmap pixel / color data. PNG encoding / compression helps in reducing the space requirement and for complex Metafiles (with a lot of drawing instructions), MetafileScaleFactor of 5 or even greater, might not incur any space overhead relative to the original (complex) Metafile.

    Default value for MetafileScaleFactor is 1.

    PageCount

    Gets or sets the number of pages which should be saved to a multi-frame image.

    If image format doesn't support multiple frames, this property is ignored.

    Default value is 1.

    To save all pages, set value to MaxValue.

    Only Tagged Image File Format (TIFF) and Graphics Interchange Format (GIF) format images support multiple frames.

    • C#
    • VB.NET
    public int PageCount { get; set; }
    Public Property PageCount As Integer
    Property Value
    Int32

    The number of pages which should be saved to a multi-frame image.

    PageNumber

    Gets or sets the zero-based page number of the document's page which should be saved to an image.

    • C#
    • VB.NET
    public int PageNumber { get; set; }
    Public Property PageNumber As Integer
    Property Value
    Int32

    The zero-based page number of the document's page which should be saved to an image.

    PixelFormat

    Gets or sets a pixel format, which will be used for the image.

    • C#
    • VB.NET
    public PixelFormat PixelFormat { get; set; }
    Public Property PixelFormat As PixelFormat
    Property Value
    PixelFormat

    The pixel format, which will be used for the image.

    SelectionType

    Gets or sets a value indicating whether to save a page from the whole ExcelFile or just ActiveWorksheet.

    • C#
    • VB.NET
    public SelectionType SelectionType { get; set; }
    Public Property SelectionType As SelectionType
    Property Value
    SelectionType
    Remarks

    Default value is ActiveSheet to optimize export since only active worksheet will be paginated.

    If you want to render a specific page from an un-active worksheet, set that worksheet as ActiveWorksheet or change this property to EntireFile.

    TiffCompression

    Gets or sets compression schema, which will be used when exporting to Tagged Image File Format (TIFF).

    • C#
    • VB.NET
    public TiffCompression TiffCompression { get; set; }
    Public Property TiffCompression As TiffCompression
    Property Value
    TiffCompression

    The compression schema, which will be used when exporting to Tagged Image File Format (TIFF).

    Width

    Gets or sets the image width in pixels.

    • C#
    • VB.NET
    public double Width { get; set; }
    Public Property Width As Double
    Property Value
    Double

    The image width in pixels.

    Remarks

    If both Width and Height are not specified, then image size will be equal to the page size.

    If only one of the Width or Height is specified, then the specified dimension will be respected and other dimension will be calculated so that original aspect ratio is maintained.

    If both Width and Height are specified, then both specified dimensions will be respected (which may result in non-uniformly scaled image, if aspect ratio is not equal to the original one.

    Events

    ProgressChanged

    Occurs when saving progress of a file has changed.

    • C#
    • VB.NET
    public event EventHandler<OperationProgressChangedEventArgs> ProgressChanged
    Public Event ProgressChanged As EventHandler(Of OperationProgressChangedEventArgs)
    Event Type
    EventHandler<OperationProgressChangedEventArgs>

    Inherited Properties

    CsvDefault

    Gets the default options for saving to Character Separated Values file format.

    (Inherited from SaveOptions)

    HtmlDefault

    Gets the default options for saving to HyperText Markup Language File format.

    (Inherited from SaveOptions)

    ImageDefault

    Gets the default options for saving to image formats.

    (Inherited from SaveOptions)

    OdsDefault

    Gets the default options for saving to OpenDocument Spreadsheet file format.

    (Inherited from SaveOptions)

    PdfDefault

    Gets the default options for saving to Portable Document Format file.

    (Inherited from SaveOptions)

    TxtDefault

    Gets the default options for saving to Tab delimited file format.

    (Inherited from SaveOptions)

    XlsDefault

    Gets the default options for saving to, XLS file format (Microsoft Excel Spreadsheet format; Excel 2003 and prior versions) .

    (Inherited from SaveOptions)

    XlsbDefault

    Gets the default options for saving to XLSB file format (Microsoft Excel Binary File Format).

    (Inherited from SaveOptions)

    XlsxDefault

    Gets the default options for saving to XLSX file format (Microsoft Excel Open XML Spreadsheet; Excel 2007 and later).

    (Inherited from SaveOptions)

    XpsDefault

    Gets the default options for saving to XML Paper Specification file format.

    (Inherited from SaveOptions)

    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.