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

    Show / Hide Table of Contents

    FormattedExcelDrawing Class

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

    Represents a formatted drawing (picture, chart, etc.) which can be exported to PDF, XPS, image or be printed.

    • C#
    • VB.NET
    public sealed class FormattedExcelDrawing
    Public NotInheritable Class FormattedExcelDrawing
    Inheritance:
    System.Object
    FormattedExcelDrawing

    Properties

    Content

    Gets the drawing content.

    • C#
    • VB.NET
    public FrameworkElement Content { get; }
    Public ReadOnly Property Content As FrameworkElement
    Property Value
    System.Windows.FrameworkElement

    The drawing content.

    Height

    Gets the drawing height in Points.

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

    The drawing height in Points.

    Width

    Gets the drawing width in Points.

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

    The drawing width in Points.

    Methods

    Print()

    Prints the drawing to the default printer.

    • C#
    • VB.NET
    public void Print()
    Public Sub Print

    Print(String)

    Prints the drawing to the specified printer.

    • C#
    • VB.NET
    public void Print(string printerName)
    Public Sub Print(printerName As String)
    Parameters
    printerName
    System.String

    Printer name.

    Print(String, PrintOptions)

    Prints the drawing to the specified printer according to specified options.

    • C#
    • VB.NET
    public void Print(string printerName, PrintOptions options)
    Public Sub Print(printerName As String, options As PrintOptions)
    Parameters
    printerName
    System.String

    Printer name.

    options
    PrintOptions

    Print options.

    Save(Stream, SaveOptions)

    Saves the drawing in the specified stream.

    • C#
    • VB.NET
    public void Save(Stream stream, SaveOptions options)
    Public Sub Save(stream As Stream, options As SaveOptions)
    Parameters
    stream
    System.IO.Stream

    The stream in which to save the drawing.

    options
    SaveOptions

    The saving options which can be used to define settings for save operation.

    Remarks

    Parameter options, currently, must be of type PdfSaveOptions, XpsSaveOptions or ImageSaveOptions.

    Save(Object, String)

    Saves the drawing to a System.Web.HttpResponse or System.Web.HttpResponseBase output stream or a System.Net.Http.HttpResponseMessage and sets appropriate HTTP response headers (Content-Type and Content-Disposition). Use this method in ASP.NET application to send the drawing to a client browser. File format is resolved from fileName extension. See remarks why httpResponse parameter is of type System.Object.

    • C#
    • VB.NET
    public void Save(object httpResponse, string fileName)
    Public Sub Save(httpResponse As Object, fileName As String)
    Parameters
    httpResponse
    System.Object

    System.Web.HttpResponse object that can be retrieved through the Response property of the System.Web.HttpApplication, System.Web.HttpContext, System.Web.UI.Page or System.Web.UI.UserControl classes or System.Web.HttpResponseBase object or System.Net.Http.HttpResponseMessage object.

    fileName
    System.String

    File name that will be presented in client browser when downloading a file.

    Remarks
    note

    Supported only if updating the whole page with a postback and not if doing partial-page updates (when you use UpdatePanel controls to update selected regions of a page).

    This method accepts System.Object rather than HttpResponse, HttpResponseBase or HttpResponseMessage because otherwise GemBox.Document assembly would have a dependency on System.Web or System.Net.Http assemblies and could not be used in applications which target Client Profile .NET Framework.

    HttpResponse can be retrieved through the Response property of the HttpApplication, HttpContext, Page or UserControl classes.

    For supported file extensions, see remarks for Save(String) method.

    Exceptions
    System.ArgumentException

    If file extension is not specified or not supported. If file extension is not recognized, use Save(Object, String, SaveOptions) method overload instead.

    Save(Object, String, SaveOptions)

    Saves the drawing to a System.Web.HttpResponse or System.Web.HttpResponseBase output stream or a System.Net.Http.HttpResponseMessage and sets appropriate HTTP response headers (Content-Type and Content-Disposition). Use this method in ASP.NET application to send the drawing to a client browser. File format is defined with options parameter. See remarks why httpResponse parameter is of type System.Object.

    • C#
    • VB.NET
    public void Save(object httpResponse, string fileName, SaveOptions options)
    Public Sub Save(httpResponse As Object, fileName As String, options As SaveOptions)
    Parameters
    httpResponse
    System.Object

    System.Web.HttpResponse object that can be retrieved through the Response property of the System.Web.HttpApplication, System.Web.HttpContext, System.Web.UI.Page or System.Web.UI.UserControl classes or System.Web.HttpResponseBase object or System.Net.Http.HttpResponseMessage object.

    fileName
    System.String

    File name that will be presented in client browser when downloading a file.

    options
    SaveOptions

    The saving options which can be used to define settings for save operation.

    Remarks
    note

    Supported only if updating the whole page with a postback and not if doing partial-page updates (when you use UpdatePanel controls to update selected regions of a page).

    This method accepts System.Object rather than HttpResponse, HttpResponseBase or HttpResponseMessage because otherwise GemBox.Document assembly would have a dependency on System.Web or System.Net.Http assemblies and could not be used in applications which target Client Profile .NET Framework.

    HttpResponse can be retrieved through the Response property of the HttpApplication, HttpContext, Page or UserControl classes.

    Save(String)

    Saves the drawing to a file with the specified path. Path must include file extension.

    • C#
    • VB.NET
    public void Save(string path)
    Public Sub Save(path As String)
    Parameters
    path
    System.String

    The path to which to save the drawing.

    Remarks

    File extension that is extracted from the path is used to create the appropriate SaveOptions derived class instance that is then passed to the Save(String, SaveOptions) method.

    Following file extensions are supported:

    • Portable Document Format: .pdf
    • XML Paper Specification: .xps
    • Portable Network Graphics: .png
    • Joint Photographic Experts Group: .jpeg, .jpg
    • Bitmap: .bmp
    • Tagged Image File Format: .tiff, .tif
    • Windows Media Photo: .wdp
    Exceptions
    System.ArgumentException

    If file extension is not specified or not supported. If file extension is not recognized, use Save(String, SaveOptions) method overload instead.

    Save(String, SaveOptions)

    Saves the drawing to a file with the specified path.

    • C#
    • VB.NET
    public void Save(string path, SaveOptions options)
    Public Sub Save(path As String, options As SaveOptions)
    Parameters
    path
    System.String

    The path to which to save the drawing.

    options
    SaveOptions

    The saving options which can be used to define settings for save operation.

    Remarks

    Parameter options, currently, must be of type PdfSaveOptions, XpsSaveOptions or ImageSaveOptions.

    Examples

    Export Excel file with ASP.NET
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.