Class LoadOptions

LoadOptions class

Represents the options of loading the file.

public class LoadOptions

Constructors

NameDescription
LoadOptions()Creates an options of loading the file.
LoadOptions(LoadFormat)Creates an options of loading the file.

Properties

NameDescription
AutoFilter { get; set; }Indicates whether auto filtering the data when loading the files.
AutoFitterOptions { get; set; }Gets and sets the auto fitter options
CheckDataValid { get; set; }Check whether data is valid in the template file.
CheckExcelRestriction { get; set; }Whether check restriction of excel file when user modify cells related objects. For example, excel does not allow inputting string value longer than 32K. When you input a value longer than 32K such as by Cell.PutValue(string), if this property is true, you will get an Exception. If this property is false, we will accept your input string value as the cell’s value so that later you can output the complete string value for other file formats such as CSV. However, if you have set such kind of value that is invalid for excel file format, you should not save the workbook as excel file format later. Otherwise there may be unexpected error for the generated excel file.
CultureInfo { get; set; }Gets or sets the system culture info at the time the file was loaded.
DefaultStyleSettings { get; }Gets the default style settings for initializing styles of the workbook
FontConfigs { get; set; }Gets and sets individual font configs. Only works for the Workbook which uses this LoadOptions to load.
IgnoreNotPrinted { get; set; }Ignore the data which are not printed if directly printing the file
IgnoreUselessShapes { get; set; }Indicates whether ignoring useless shapes.
InterruptMonitor { get; set; }Gets and sets the interrupt monitor.
KeepUnparsedData { get; set; }Whether keep the unparsed data in memory for the Workbook when it is loaded from template file. Default is true.
LanguageCode { get; set; }Gets or sets the user interface language of the Workbook version based on CountryCode that has saved the file.
LightCellsDataHandler { get; set; }The data handler for processing cells data when reading template file.
LoadFilter { get; set; }The filter to denote how to load data.
LoadFormat { get; }Gets the load format.
MemorySetting { get; set; }Gets or sets the memory usage options.
ParsingFormulaOnOpen { get; set; }Indicates whether parsing the formula when reading the file.
ParsingPivotCachedRecords { get; set; }Indicates whether parsing pivot cached records when loading the file. The default value is false.
Password { get; set; }Gets and set the password of the workbook.
PreservePaddingSpacesInFormula { get; set; }Indicates whether preserve those spaces and line breaks that are padded between formula tokens while getting and setting formulas. Default value is false.
Region { get; set; }Gets or sets the system regional settings based on CountryCode at the time the file was loaded.
StandardFont { get; set; }(Obsolete.) Sets the default standard font name
StandardFontSize { get; set; }(Obsolete.) Sets the default standard font size.
WarningCallback { get; set; }Gets or sets warning callback.

Methods

NameDescription
SetPaperSize(PaperSizeType)Sets the default print paper size from default printer’s setting.

Examples

[C#]

namespace Demos
{
    using Aspose.Cells;
    using System;
    using System.Globalization;

    public class LoadOptionsDemo
    {
        public static void LoadOptionsExample()
        {
            // Create an instance of LoadOptions
            LoadOptions loadOptions = new LoadOptions();

            // Setting properties
            loadOptions.Password = "password123";
            loadOptions.ParsingFormulaOnOpen = true;
            loadOptions.ParsingPivotCachedRecords = false;
            loadOptions.LanguageCode = CountryCode.USA;
            loadOptions.Region = CountryCode.USA;
            loadOptions.CultureInfo = new CultureInfo("en-US");
            loadOptions.IgnoreNotPrinted = true;
            loadOptions.CheckDataValid = true;
            loadOptions.CheckExcelRestriction = false;
            loadOptions.KeepUnparsedData = true;
            loadOptions.MemorySetting = MemorySetting.MemoryPreference;
            loadOptions.AutoFitterOptions = new AutoFitterOptions { AutoFitMergedCells = true };
            loadOptions.AutoFilter = true;
            loadOptions.IgnoreUselessShapes = true;
            loadOptions.PreservePaddingSpacesInFormula = false;

            // Load a workbook with the specified LoadOptions
            Workbook workbook = new Workbook("LoadOptionsExample_original.xlsx", loadOptions);

            // Perform operations on the workbook
            Worksheet worksheet = workbook.Worksheets[0];
            worksheet.Cells["A1"].PutValue("Hello, World!");

            // Save the workbook
            workbook.Save("LoadOptionsExample.xlsx");

            return;
        }
    }
}

See Also