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

    Show / Hide Table of Contents

    DocxSaveOptions Class

    Namespace:
    GemBox.Document
    Assembly:
    GemBox.Document.dll

    Represents a class that stores saving options for Microsoft Word file.

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

    To save a document as a macro-enabled document, template document or macro-enabled template document, set Format property to appropriate value.

    Constructors

    DocxSaveOptions()

    Initializes a new instance of the DocxSaveOptions class.

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

    Properties

    ContentType

    Gets the content-type for DOCX file format: application/vnd.openxmlformats.

    • C#
    • VB.NET
    public override string ContentType { get; }
    Public Overrides ReadOnly Property ContentType As String
    Property Value
    System.String

    The content-type for DOCX file format.

    Overrides
    SaveOptions.ContentType

    DigitalSignatures

    Gets the digital signature options.

    • C#
    • VB.NET
    public IList<DocxDigitalSignatureSaveOptions> DigitalSignatures { get; }
    Public ReadOnly Property DigitalSignatures As IList(Of DocxDigitalSignatureSaveOptions)
    Property Value
    System.Collections.Generic.IList<DocxDigitalSignatureSaveOptions>

    The digital signature options.

    Format

    Gets or sets the Word file format into which to save the DocumentModel instance.

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

    The Word file format into which to save the DocumentModel instance.

    ImageDpi

    Gets or sets the saved images DPI.

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

    The saved images DPI.

    Remarks

    This property controls the image quality for all images in the file. Larger value results in better-quality images but increases the file size. Setting this property to 0 will disable image optimization. Standard DPI values are:

    • 330 - Good quality for HD displays
    • 220 - Good quality for most printers and displays
    • 150 - Good quality for web pages and projectors
    • 96 - Good quality for smaller file sizes

    Using this property you basically specify the DPI of the display device on which the file will be viewed and for which the images in the file should be optimized without losing any perceived quality because images go through the same resampling (reduction of pixel count) as they would in the viewer application if viewing the file using the default (100%) zoom factor on that display device.

    For example, if an image whose pixel size is 600px × 400px is shown on page where it occupies a slot whose physical size is 150pt × 100pt, then if the display device DPI is 144px/inch, the viewer application will show the image in a display slot whose pixel size is 300px × 200px if the default (100%) zoom factor is used (Rationale: there are always 72 points per inch and for the DPI of 144, there are 144 pixels per inch, so 150[pt] = 150[pt] × 144[px/inch] / 72[pt/inch] = 300[px]).
    So the viewer application has to fit an image into a smaller display slot and it will do so by resampling the image from 600px × 400px to 300px × 200px.
    Reducing the total number of pixels 4 times (from 240000 to 60000) would also reduce the image file size, so GemBox component can do this instead of the viewer application, thus achieving the overall smaller file size without any perceived loss of quality since the same image resampling would have been done by the viewer application anyway if the default (100%) zoom factor is used.
    Instructing the GemBox component to perform image resampling (by setting the ImageDpi property to the DPI of the display device on which the file is going to be viewed) has two effects:

    • Major benefit: output file size will be smaller if there are images whose pixel size is greater than their display size because those images are resampled to a smaller number of pixels without any perceived loss of quality since the same resampling would have been done by the viewer application anyway.
    • Minor benefit: viewer application will be able to present the image faster because it needs to decode a fewer number of pixels and because the display slot size will be exactly equal to the image pixel size so it doesn't have to perform any resampling if the default (100%) zoom factor is used.

    Password

    Gets or sets the password used to protect / encrypt the document.

    • C#
    • VB.NET
    public string Password { get; set; }
    Public Property Password As String
    Property Value
    System.String

    The password used to protect / encrypt the document.

    Events

    ProgressChanged

    Occurs when the saving progress of a document has changed.

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

    The file path or stream that was provided as a document destination is used as a System.ComponentModel.ProgressChangedEventArgs.UserState.

    Inherited Properties

    DocxDefault

    Gets the default saving options for Microsoft Word file format. Word file will be saved in Docx format.

    (Inherited from SaveOptions)

    HtmlDefault

    Gets the default saving options for HyperText Markup Language (HTML) format.

    (Inherited from SaveOptions)

    ImageDefault

    Gets the default saving options for image file format. Image will be saved in Bmp format.

    (Inherited from SaveOptions)

    OdtDefault

    Gets the default saving options for Open Document file format.

    (Inherited from SaveOptions)

    PageCount

    Gets or sets the number of pages which should be saved.

    (Inherited from SaveOptions)

    PageNumber

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

    (Inherited from SaveOptions)

    PdfDefault

    Gets the default saving options for Portable Document Format (PDF).

    (Inherited from SaveOptions)

    RtfDefault

    Gets the default saving options for Rich Text (RTF) format.

    (Inherited from SaveOptions)

    TxtDefault

    Gets the default saving options for Plain Text (TXT) format.

    (Inherited from SaveOptions)

    XmlDefault

    Gets the default saving options for XML file format.

    (Inherited from SaveOptions)

    XpsDefault

    Gets the default saving options for XML Paper Specification (XPS) format.

    (Inherited from SaveOptions)

    Examples

    Convert between Word files and HTML pages in C# and VB.NET
    Convert Word and HTML to PDF in C# and VB.NET
    Create and write to Word file in C# and VB.NET
    DOCX Encryption in C# and VB.NET

    See Also

    DocxDefault
    Save(String, SaveOptions)
    Save(Stream, SaveOptions)
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.