Class XmlSaveOptions

XmlSaveOptions class

Represents the options of saving the workbook as an xml file.

public class XmlSaveOptions : SaveOptions

Constructors

NameDescription
XmlSaveOptions()Creates options for saving xml file.

Properties

NameDescription
CachedFileFolder { get; set; }The cached file folder is used to store some large data.(Inherited from SaveOptions.)
ClearData { get; set; }Make the workbook empty after saving the file.(Inherited from SaveOptions.)
CreateDirectory { get; set; }If true and the directory does not exist, the directory will be automatically created before saving the file.(Inherited from SaveOptions.)
DataAsAttribute { get; set; }Indicates whether exporting data as attributes of element.
EncryptDocumentProperties { get; set; }Indicates whether encrypt document properties when saving as .xls file. The default value is true.(Inherited from SaveOptions.)
ExportArea { get; set; }Gets or sets the exporting range.
HasHeaderRow { get; set; }Indicates whether the range contains header row.
MergeAreas { get; set; }Indicates whether merge the areas of conditional formatting and validation before saving the file.(Inherited from SaveOptions.)
RefreshChartCache { get; set; }Indicates whether refreshing chart cache data(Inherited from SaveOptions.)
SaveFormat { get; }Gets the save file format.(Inherited from SaveOptions.)
SheetIndexes { get; set; }Represents the indexes of exported sheets.
SheetNameAsElementName { get; set; }Indicates whether exporting sheet’s name as the name of the element.
SortExternalNames { get; set; }Indicates whether sorting external defined names before saving file.(Inherited from SaveOptions.)
SortNames { get; set; }Indicates whether sorting defined names before saving file.(Inherited from SaveOptions.)
UpdateSmartArt { get; set; }Indicates whether updating smart art setting. The default value is false.(Inherited from SaveOptions.)
ValidateMergedAreas { get; set; }Indicates whether validate merged cells before saving the file.(Inherited from SaveOptions.)
WarningCallback { get; set; }Gets or sets warning callback.(Inherited from SaveOptions.)
XmlMapName { get; set; }Indicates whether exporting xml map in the file.

Examples

[C#]

namespace Demos
{
    using Aspose.Cells;
    using System;

    public class XmlSaveOptionsDemo
    {
        public static void XmlSaveOptionsExample()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            // Fill some data in the worksheet
            worksheet.Cells["A1"].PutValue("Header1");
            worksheet.Cells["B1"].PutValue("Header2");
            worksheet.Cells["A2"].PutValue("Data1");
            worksheet.Cells["B2"].PutValue("Data2");

            // Create an instance of XmlSaveOptions
            XmlSaveOptions saveOptions = new XmlSaveOptions();

            // Setting properties
            saveOptions.ExportArea = new CellArea { StartRow = 0, EndRow = 1, StartColumn = 0, EndColumn = 1 };
            saveOptions.HasHeaderRow = true;
            saveOptions.XmlMapName = "MyXmlMap";
            saveOptions.SheetNameAsElementName = true;
            saveOptions.DataAsAttribute = false;
            saveOptions.ClearData = false;
            saveOptions.CachedFileFolder = "C:\\Temp";
            saveOptions.ValidateMergedAreas = true;
            saveOptions.MergeAreas = false;
            saveOptions.SortNames = true;
            saveOptions.SortExternalNames = false;
            saveOptions.RefreshChartCache = true;
            saveOptions.UpdateSmartArt = false;

            // Save the workbook as an XML file
            workbook.Save("XmlSaveOptionsExample.xml", saveOptions);

            return;
        }
    }
}

See Also