Class WorkbookSettings

Class WorkbookSettings

Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)

Represents all settings of the workbook.

public class WorkbookSettings : IDisposable

Inheritance

objectWorkbookSettings

Implements

IDisposable

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Examples

Workbook workbook = new Workbook();

WorkbookSettings settings = workbook.Settings;

//do your business
Dim workbook as Workbook = new Workbook()

Dim settings as WorkbookSettings = workbook.Settings

'do your business

Properties

Author

Gets and sets the author of the file.

public string Author { get; set; }

Property Value

string

Remarks

It’’s not set, check Aspose.Cells.Properties.BuiltInDocumentPropertyCollection.Author first, then check the user of Environment.

AutoCompressPictures

Specifies a boolean value that indicates the application automatically compressed pictures in the workbook.

public bool AutoCompressPictures { get; set; }

Property Value

bool

AutoRecover

Indicates whether the file is marked for auto-recovery.

public bool AutoRecover { get; set; }

Property Value

bool

BuildVersion

Specifies the incremental public release of the application.

public string BuildVersion { get; set; }

Property Value

string

CheckCompatibility

Indicates whether check compatibility with earlier versions when saving workbook.

public bool CheckCompatibility { get; set; }

Property Value

bool

Remarks

The default value is true. Only for Excel97-2003 xls or xlt files.

CheckCustomNumberFormat

Indicates whether checking custom number format when setting Style.Custom.

public bool CheckCustomNumberFormat { get; set; }

Property Value

bool

CheckExcelRestriction

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.

public bool CheckExcelRestriction { get; set; }

Property Value

bool

Compliance

Specifies the OOXML version for the output document. The default value is Ecma376_2006.

public OoxmlCompliance Compliance { get; set; }

Property Value

OoxmlCompliance

Remarks

Only for .xlsx files.

CrashSave

indicates whether the application last saved the workbook file after a crash.

public bool CrashSave { get; set; }

Property Value

bool

CultureInfo

Gets or sets the system culture info.

public CultureInfo CultureInfo { get; set; }

Property Value

CultureInfo

Remarks

Returns null if culture info is not set and Aspose.Cells.WorkbookSettings.Region is not set.

DataExtractLoad

indicates whether the application last opened the workbook for data recovery.

public bool DataExtractLoad { get; set; }

Property Value

bool

Date1904

Gets or sets a value which represents if the workbook uses the 1904 date system.

public bool Date1904 { get; set; }

Property Value

bool

DefaultImageResolution

Gets and sets default resolution of image.

public int DefaultImageResolution { get; set; }

Property Value

int

DefaultStyleSettings

Gets the settings for default values of style-related properties for this workbook.

public DefaultStyleSettings DefaultStyleSettings { get; }

Property Value

DefaultStyleSettings

DiscardImageEditData

Indicates whether discarding editting image data.

public bool DiscardImageEditData { get; set; }

Property Value

bool

DisplayDrawingObjects

Indicates whether and how to show objects in the workbook.

public DisplayDrawingObjects DisplayDrawingObjects { get; set; }

Property Value

DisplayDrawingObjects

EnableMacros

Enable macros;

public bool EnableMacros { get; set; }

Property Value

bool

Remarks

Now it only works when copying a worksheet to other worksheet in a workbook.

FirstVisibleTab

Gets or sets the first visible worksheet tab.

public int FirstVisibleTab { get; set; }

Property Value

int

FormulaSettings

Gets the settings for formula-related features.

public FormulaSettings FormulaSettings { get; }

Property Value

FormulaSettings

GlobalizationSettings

Gets and sets the globalization settings.

public GlobalizationSettings GlobalizationSettings { get; set; }

Property Value

GlobalizationSettings

HidePivotFieldList

Gets and sets whether hide the field list for the PivotTable.

public bool HidePivotFieldList { get; set; }

Property Value

bool

IsDefaultEncrypted

Indicates whether encrypting the workbook with default password if Structure and Windows of the workbook are locked.

public bool IsDefaultEncrypted { get; set; }

Property Value

bool

Remarks

The default value is false now. It’s same as MS Excel 2013.

IsEncrypted

Gets a value that indicates whether a password is required to open this workbook.

public bool IsEncrypted { get; }

Property Value

bool

IsHScrollBarVisible

Gets or sets a value indicating whether the generated spreadsheet will contain a horizontal scroll bar.

public bool IsHScrollBarVisible { get; set; }

Property Value

bool

Examples

The following code makes the horizontal scroll bar invisible for the spreadsheet.

// Hide the horizontal scroll bar of the Excel file.
settings.IsHScrollBarVisible = false;
' Hide the horizontal scroll bar of the Excel file.
settings.IsHScrollBarVisible = False

Remarks

The default value is true.

IsHidden

Indicates whether this workbook is hidden.

public bool IsHidden { get; set; }

Property Value

bool

IsMinimized

Represents whether the generated spreadsheet will be opened Minimized.

public bool IsMinimized { get; set; }

Property Value

bool

IsProtected

Gets a value that indicates whether the structure or window of the Workbook is protected.

public bool IsProtected { get; }

Property Value

bool

IsVScrollBarVisible

Gets or sets a value indicating whether the generated spreadsheet will contain a vertical scroll bar.

public bool IsVScrollBarVisible { get; set; }

Property Value

bool

Examples

The following code makes the vertical scroll bar invisible for the spreadsheet. ```csharp // Hide the vertical scroll bar of the Excel file. settings.IsVScrollBarVisible = false;

```vb
' Hide the vertical scroll bar of the Excel file.
             settings.IsVScrollBarVisible = False

Remarks

The default value is true.

LanguageCode

Gets or sets the user interface language of the Workbook version based on CountryCode that has saved the file.

public CountryCode LanguageCode { get; set; }

Property Value

CountryCode

MaxColumn

Gets the max column index, zero-based.

public int MaxColumn { get; }

Property Value

int

Remarks

Returns 255 if the file format is Excel97-2003;

MaxRow

Gets the max row index, zero-based.

public int MaxRow { get; }

Property Value

int

Remarks

Returns 65535 if the file format is Excel97-2003;

MaxRowsOfSharedFormula

Gets and sets the max row number of shared formula.

public int MaxRowsOfSharedFormula { get; set; }

Property Value

int

Remarks

If the number is too large, the autofilter works very slow in MS Excel 2013.

MemorySetting

Gets or sets the memory usage options. The new option will be taken as the default option for newly created worksheets but does not take effect for existing worksheets.

public MemorySetting MemorySetting { get; set; }

Property Value

MemorySetting

NumberDecimalSeparator

Gets or sets the decimal separator for formatting/parsing numeric values. Default is the decimal separator of current Region.

public char NumberDecimalSeparator { get; set; }

Property Value

char

NumberGroupSeparator

Gets or sets the character that separates groups of digits to the left of the decimal in numeric values. Default is the group separator of current Region.

public char NumberGroupSeparator { get; set; }

Property Value

char

PaperSize

Gets and sets the default print paper size.

public PaperSizeType PaperSize { get; set; }

Property Value

PaperSizeType

Remarks

If there is no setting about paper size,MS Excel will use default printer’s setting.

Password

Represents Workbook file encryption password.

public string Password { get; set; }

Property Value

string

PropertiesFollowChartPoint

Indicates whether datapoint properties and datalabels in all charts in this workbook follow their reference.

public bool PropertiesFollowChartPoint { get; set; }

Property Value

bool

ProtectionType

Gets the protection type of the workbook.

public ProtectionType ProtectionType { get; }

Property Value

ProtectionType

QuotePrefixToStyle

Indicates whether setting Aspose.Cells.Style.QuotePrefix property when entering the string value(which starts with single quote mark ) to the cell

public bool QuotePrefixToStyle { get; set; }

Property Value

bool

Region

Gets or sets the regional settings for workbook.

public CountryCode Region { get; set; }

Property Value

CountryCode

Remarks

  1. Regional settings used by Aspose.Cells component for a workbook loaded from template file: i). For an XLS file, there are fields defined for regional settings and MS Excel does save regional settings data into the file when saving the XLS file. So, we use the saved region in the template file for the workbook. If you do not want to use the region saved in the XLS file, please reset it to the expected one (such as, CountryCode.Default) after loading the template file. And, we save the user specified value (by this method) into the file too when saving an XLS file. ii). For other file formats, such as, XLSX, XLSB…etc., there is no field defined for regional settings in the file format specification. So, we use the regional settings of application’s environment for the workbook. And, the user specified value (by this method) cannot be kept for the generated files with those file formats.
  2. For the view effect in MS Excel: The applied regional settings here can take effect only at runtime with Aspose.Cells component and not when viewing the generated file with MS Excel. Even for the generated XLS file in which the specified regional settings data has been saved, when viewing/editing it with MS Excel, the used region to perform formatting by MS Excel is always the default regional settings of the environment where MS Excel is running, not the one saved in the file. It is MS Excel’s behavior and cannot be changed by code.

RemovePersonalInformation

True if personal information can be removed from the specified workbook.

public bool RemovePersonalInformation { get; set; }

Property Value

bool

RepairLoad

Indicates whether the application last opened the workbook in safe or repair mode.

public bool RepairLoad { get; set; }

Property Value

bool

ResourceProvider

Gets and sets the stream provider for external resource, such as loading image data for picture of type “LinkToFile”.

public IStreamProvider ResourceProvider { get; set; }

Property Value

IStreamProvider

Shared

Gets or sets a value that indicates whether the Workbook is shared.

public bool Shared { get; set; }

Property Value

bool

Remarks

The default value is false.

SheetTabBarWidth

Width of worksheet tab bar (in 1/1000 of window width).

public int SheetTabBarWidth { get; set; }

Property Value

int

ShowTabs

Get or sets a value whether the Workbook tabs are displayed.

public bool ShowTabs { get; set; }

Property Value

bool

Examples

The following code hides the Sheet Tabs and Tab Scrolling Buttons for the spreadsheet. ``` csharp // Hide the spreadsheet tabs. workbook.Settings.ShowTabs = false;

        ' Hide the spreadsheet tabs.
        workbook.Settings.ShowTabs = False

#### Remarks

The default value is true.

### <a id="Aspose_Cells_WorkbookSettings_SignificantDigits"></a> SignificantDigits

Gets and sets the number of significant digits.
The default value is Aspose.Cells.CellsHelper.SignificantDigits.

```csharp
public int SignificantDigits { get; set; }

Property Value

int

Remarks

Only could be 15 or 17 now.

UpdateAdjacentCellsBorder

Indicates whether update adjacent cells’ border.

public bool UpdateAdjacentCellsBorder { get; set; }

Property Value

bool

Remarks

The default value is false. For example: the bottom border of the cell A1 is update, the top border of the cell A2 should be changed too.

UpdateLinksType

Gets and sets how updates external links when the workbook is opened.

public UpdateLinksType UpdateLinksType { get; set; }

Property Value

UpdateLinksType

WarningCallback

Gets or sets warning callback.

public IWarningCallback WarningCallback { get; set; }

Property Value

IWarningCallback

WindowHeight

The height of the window, in unit of point.

public double WindowHeight { get; set; }

Property Value

double

WindowHeightCM

The height of the window, in unit of centimeter.

public double WindowHeightCM { get; set; }

Property Value

double

WindowHeightInch

The height of the window, in unit of inch.

public double WindowHeightInch { get; set; }

Property Value

double

WindowLeft

The distance from the left edge of the client area to the left edge of the window, in unit of point.

public double WindowLeft { get; set; }

Property Value

double

WindowLeftCM

The distance from the left edge of the client area to the left edge of the window. In unit of centimeter.

public double WindowLeftCM { get; set; }

Property Value

double

WindowLeftInch

The distance from the left edge of the client area to the left edge of the window. In unit of inch.

public double WindowLeftInch { get; set; }

Property Value

double

WindowTop

The distance from the top edge of the client area to the top edge of the window, in unit of point.

public double WindowTop { get; set; }

Property Value

double

WindowTopCM

The distance from the top edge of the client area to the top edge of the window, in unit of centimeter.

public double WindowTopCM { get; set; }

Property Value

double

WindowTopInch

The distance from the top edge of the client area to the top edge of the window, in unit of inch.

public double WindowTopInch { get; set; }

Property Value

double

WindowWidth

The width of the window, in unit of point.

public double WindowWidth { get; set; }

Property Value

double

WindowWidthCM

The width of the window, in unit of centimeter.

public double WindowWidthCM { get; set; }

Property Value

double

WindowWidthInch

The width of the window, in unit of inch.

public double WindowWidthInch { get; set; }

Property Value

double

WriteProtection

Provides access to the workbook write protection options.

public WriteProtection WriteProtection { get; }

Property Value

WriteProtection

Methods

Dispose()

Releases resources.

public void Dispose()

GetThemeFont(FontSchemeType)

Gets the default theme font name.

public string GetThemeFont(FontSchemeType type)

Parameters

type FontSchemeType

The scheme type of the font.

Returns

string

SetPageOrientationType(PageOrientationType)

Set the type of print orientation for the whole workbook.

public void SetPageOrientationType(PageOrientationType pageOrientationType)

Parameters

pageOrientationType PageOrientationType

The page orientation type