XlsxSaveOptions Class
Represent options for saving to XLSX file format (Microsoft Excel Open XML Spreadsheet; Excel 2007 and later).
public sealed class XlsxSaveOptions : SaveOptions
Public NotInheritable Class XlsxSaveOptions
Inherits SaveOptions
- Inheritance:
- System.ObjectXlsxSaveOptions
Constructors
XlsxSaveOptions()
Initializes a new instance of the XlsxSaveOptions class.
Properties
ContentType
Gets the content-type for XLSX file format:
public override string ContentType { get; }
Public Overrides ReadOnly Property ContentType As String
Property Value
- System.String
The content-type for XLSX file format.
Overrides
DigitalSignatures
Gets the digital signature options.
public IList<XlsxDigitalSignatureSaveOptions> DigitalSignatures { get; }
Public ReadOnly Property DigitalSignatures As IList(Of XlsxDigitalSignatureSaveOptions)
Property Value
- System.Collections.Generic.IList<XlsxDigitalSignatureSaveOptions>
The digital signature options.
ImageDpi
Gets or sets the saved images DPI.
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.
Limitations
Gets limitations for saving to XLSX file format.
public override FileFormatLimitations Limitations { get; }
Public Overrides ReadOnly Property Limitations As FileFormatLimitations
Property Value
Overrides
Remarks
These are the limits:
- MaxRows: 1048576
- MaxColumns: 16384
- MaxColors: 16000000
- MaxCellStyles: 64000
Password
Gets or sets the password used to protect / encrypt the workbook.
Property Value
- System.String
Type
Specifies type of generated file. Set this property only if you want to override default type.
Property Value
- System.Nullable<XlsxType>
Events
ProgressChanged
Occurs when the saving progress of a file has changed.
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 file destination is used as a System.ComponentModel.ProgressChangedEventArgs.UserState.
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) |