WorkbookSettings

WorkbookSettings class

Represents all settings of the workbook.

Properties

NameTypeDescription
StreamProviderIStreamProviderGets and sets the stream provider for external resource. NOTE: This member is now obsolete. Instead, please use Resource
ResourceProviderIStreamProviderGets and sets the stream provider for external resource, such as loading image data for picture of type “LinkToFile”.
AuthorStringGets and sets the author of the file. It’’s not set, check BuiltInDocumentPropertyCollection.Author first, then check th
CheckCustomNumberFormatbooleanIndicates whether checking custom number format when setting Style.Custom.
EnableMacrosbooleanEnable macros; Now it only works when copying a worksheet to other worksheet in a workbook.
Date1904booleanGets or sets a value which represents if the workbook uses the 1904 date system.
ProtectionTypeintGets the protection type of the workbook. The value of the property is ProtectionType integer constant.
DisplayDrawingObjectsintIndicates whether and how to show objects in the workbook. The value of the property is DisplayDrawingObjects integer co
SheetTabBarWidthintWidth of worksheet tab bar (in 1/1000 of window width).
ShowTabsbooleanGet or sets a value whether the Workbook tabs are displayed. The default value is true.
FirstVisibleTabintGets or sets the first visible worksheet tab.
IsHScrollBarVisiblebooleanGets or sets a value indicating whether the generated spreadsheet will contain a horizontal scroll bar. The default valu
IsVScrollBarVisiblebooleanGets or sets a value indicating whether the generated spreadsheet will contain a vertical scroll bar. The default value
SharedbooleanGets or sets a value that indicates whether the Workbook is shared. The default value is false.
LanguageCodeintGets or sets the user interface language of the Workbook version based on CountryCode that has saved the file. The value
RegionintGets or sets the regional settings for workbook. The value of the property is CountryCode integer constant. 1. Regional
LocaleLocaleGets or sets the Locale used by this workbook. Returns null if neither Locale nor Region is set.
GlobalizationSettingsGlobalizationSettingsGets and sets the globalization settings.
NumberDecimalSeparatorcharGets or sets the decimal separator for formatting/parsing numeric values. Default is the decimal separator of current Re
NumberGroupSeparatorcharGets or sets the character that separates groups of digits to the left of the decimal in numeric values. Default is the
PasswordStringRepresents Workbook file encryption password.
WriteProtectionWriteProtectionProvides access to the workbook write protection options.
IsEncryptedbooleanGets a value that indicates whether a password is required to open this workbook.
IsProtectedbooleanGets a value that indicates whether the structure or window of the Workbook is protected.
IsDefaultEncryptedbooleanIndicates whether encrypting the workbook with default password if Structure and Windows of the workbook are locked. The
IsMinimizedbooleanRepresents whether the generated spreadsheet will be opened Minimized.
IsHiddenbooleanIndicates whether this workbook is hidden.
AutoCompressPicturesbooleanSpecifies a boolean value that indicates the application automatically compressed pictures in the workbook.
RemovePersonalInformationbooleanTrue if personal information can be removed from the specified workbook.
ShapeDisplayTypeintThe value of the property is ShapeDisplayType integer constant.
HidePivotFieldListbooleanGets and sets whether hide the field list for the PivotTable.
MaxUniqueItemsPerFieldint
UpdateLinksTypeintGets and sets how updates external links when the workbook is opened. The value of the property is UpdateLinksType integ
MaxRowintGets the max row index, zero-based. Returns 65535 if the file format is Excel97-2003;
MaxColumnintGets the max column index, zero-based. Returns 255 if the file format is Excel97-2003;
SmartTagOptionsSmartTagOptions
DefaultStyleSettingsDefaultStyleSettingsGets the settings for default values of style-related properties for this workbook.
WindowLeftfloatThe distance from the left edge of the client area to the left edge of the window, in unit of point.
WindowLeftInchfloatThe distance from the left edge of the client area to the left edge of the window. In unit of inch.
WindowLeftCMfloatThe distance from the left edge of the client area to the left edge of the window. In unit of centimeter.
WindowTopfloatThe distance from the top edge of the client area to the top edge of the window, in unit of point.
WindowTopInchfloatThe distance from the top edge of the client area to the top edge of the window, in unit of inch.
WindowTopCMfloatThe distance from the top edge of the client area to the top edge of the window, in unit of centimeter.
WindowWidthfloatThe width of the window, in unit of point.
WindowWidthInchfloatThe width of the window, in unit of inch.
WindowWidthCMfloatThe width of the window, in unit of centimeter.
WindowHeightfloatThe height of the window, in unit of point.
WindowHeightInchfloatThe height of the window, in unit of inch.
WindowHeightCMfloatThe height of the window, in unit of centimeter.
UpdateAdjacentCellsBorderbooleanIndicates whether update adjacent cells’ border. The default value is false. For example: the bottom border of the cell
SignificantDigitsintGets and sets the number of significant digits. The default value is CellsHelper.SignificantDigits . Only could be 15 or
SignificantDigitsTypeintThe value of the property is SignificantDigitsType integer constant.
CheckCompatibilitybooleanIndicates whether check compatibility with earlier versions when saving workbook. The default value is true. Only for Ex
CheckExcelRestrictionbooleanWhether check restriction of excel file when user modify cells related objects. For example, excel does not allow inputt
AutoRecoverbooleanIndicates whether the file is marked for auto-recovery.
CrashSavebooleanindicates whether the application last saved the workbook file after a crash.
DataExtractLoadbooleanindicates whether the application last opened the workbook for data recovery.
RepairLoadbooleanIndicates whether the application last opened the workbook in safe or repair mode.
BuildVersionStringSpecifies the incremental public release of the application.
MemorySettingintGets or sets the memory usage options. The new option will be taken as the default option for newly created worksheets b
PaperSizeintGets and sets the default print paper size. The value of the property is PaperSizeType integer constant. If there is no
MaxRowsOfSharedFormulaintGets and sets the max row number of shared formula. If the number is too large, the autofilter works very slow in MS Exc
ComplianceintSpecifies the OOXML version for the output document. The default value is Ecma376_2006. The value of the property is Oox
QuotePrefixToStylebooleanIndicates whether setting Style.QuotePrefix property when entering the string value(which starts with single quote mark
FormulaSettingsFormulaSettingsGets the settings for formula-related features.
PropertiesFollowChartPointboolean
DiscardImageEditDataboolean
DefaultImageResolutionint
WpsCompatibilityboolean

Methods

NameDescription
disposeReleases resources.
getThemeFontGets the default theme font name.
setPageOrientationTypeSet the type of print orientation for the whole workbook.

WorkbookSettings.StreamProvider property

Gets and sets the stream provider for external resource. NOTE: This member is now obsolete. Instead, please use ResourceProvider property. This property will be removed 12 months later since June 2022. Aspose apologizes for any inconvenience you may have experienced.

Type: IStreamProvider

WorkbookSettings.ResourceProvider property

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

Type: IStreamProvider

WorkbookSettings.Author property

Gets and sets the author of the file. It’’s not set, check BuiltInDocumentPropertyCollection.Author first, then check the user of Environment.

Type: String

WorkbookSettings.CheckCustomNumberFormat property

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

Type: boolean

WorkbookSettings.EnableMacros property

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

Type: boolean

WorkbookSettings.Date1904 property

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

Type: boolean

WorkbookSettings.ProtectionType property

Gets the protection type of the workbook. The value of the property is ProtectionType integer constant.

Type: int

WorkbookSettings.DisplayDrawingObjects property

Indicates whether and how to show objects in the workbook. The value of the property is DisplayDrawingObjects integer constant.

Type: int

WorkbookSettings.SheetTabBarWidth property

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

Type: int

WorkbookSettings.ShowTabs property

Get or sets a value whether the Workbook tabs are displayed. The default value is true.

Type: boolean

WorkbookSettings.FirstVisibleTab property

Gets or sets the first visible worksheet tab.

Type: int

WorkbookSettings.IsHScrollBarVisible property

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

Type: boolean

WorkbookSettings.IsVScrollBarVisible property

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

Type: boolean

WorkbookSettings.Shared property

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

Type: boolean

WorkbookSettings.LanguageCode property

Gets or sets the user interface language of the Workbook version based on CountryCode that has saved the file. The value of the property is CountryCode integer constant.

Type: int

WorkbookSettings.Region property

Gets or sets the regional settings for workbook. The value of the property is CountryCode integer constant. 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.

Type: int

WorkbookSettings.Locale property

Gets or sets the Locale used by this workbook. Returns null if neither Locale nor Region is set.

Type: Locale

WorkbookSettings.GlobalizationSettings property

Gets and sets the globalization settings.

Type: GlobalizationSettings

WorkbookSettings.NumberDecimalSeparator property

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

Type: char

WorkbookSettings.NumberGroupSeparator property

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.

Type: char

WorkbookSettings.Password property

Represents Workbook file encryption password.

Type: String

WorkbookSettings.WriteProtection property

Provides access to the workbook write protection options.

Type: WriteProtection

WorkbookSettings.IsEncrypted property

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

Type: boolean

WorkbookSettings.IsProtected property

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

Type: boolean

WorkbookSettings.IsDefaultEncrypted property

Indicates whether encrypting the workbook with default password if Structure and Windows of the workbook are locked. The default value is false now. It’s same as MS Excel 2013.

Type: boolean

WorkbookSettings.IsMinimized property

Represents whether the generated spreadsheet will be opened Minimized.

Type: boolean

WorkbookSettings.IsHidden property

Indicates whether this workbook is hidden.

Type: boolean

WorkbookSettings.AutoCompressPictures property

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

Type: boolean

WorkbookSettings.RemovePersonalInformation property

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

Type: boolean

WorkbookSettings.ShapeDisplayType property

The value of the property is ShapeDisplayType integer constant.

Type: int

WorkbookSettings.HidePivotFieldList property

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

Type: boolean

WorkbookSettings.MaxUniqueItemsPerField property

Type: int

WorkbookSettings.UpdateLinksType property

Gets and sets how updates external links when the workbook is opened. The value of the property is UpdateLinksType integer constant.

Type: int

WorkbookSettings.MaxRow property

Gets the max row index, zero-based. Returns 65535 if the file format is Excel97-2003;

Type: int

WorkbookSettings.MaxColumn property

Gets the max column index, zero-based. Returns 255 if the file format is Excel97-2003;

Type: int

WorkbookSettings.SmartTagOptions property

Type: SmartTagOptions

WorkbookSettings.DefaultStyleSettings property

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

Type: DefaultStyleSettings

WorkbookSettings.WindowLeft property

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

Type: float

WorkbookSettings.WindowLeftInch property

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

Type: float

WorkbookSettings.WindowLeftCM property

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

Type: float

WorkbookSettings.WindowTop property

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

Type: float

WorkbookSettings.WindowTopInch property

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

Type: float

WorkbookSettings.WindowTopCM property

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

Type: float

WorkbookSettings.WindowWidth property

The width of the window, in unit of point.

Type: float

WorkbookSettings.WindowWidthInch property

The width of the window, in unit of inch.

Type: float

WorkbookSettings.WindowWidthCM property

The width of the window, in unit of centimeter.

Type: float

WorkbookSettings.WindowHeight property

The height of the window, in unit of point.

Type: float

WorkbookSettings.WindowHeightInch property

The height of the window, in unit of inch.

Type: float

WorkbookSettings.WindowHeightCM property

The height of the window, in unit of centimeter.

Type: float

WorkbookSettings.UpdateAdjacentCellsBorder property

Indicates whether update adjacent cells’ border. 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.

Type: boolean

WorkbookSettings.SignificantDigits property

Gets and sets the number of significant digits. The default value is CellsHelper.SignificantDigits . Only could be 15 or 17 now.

Type: int

WorkbookSettings.SignificantDigitsType property

The value of the property is SignificantDigitsType integer constant.

Type: int

WorkbookSettings.CheckCompatibility property

Indicates whether check compatibility with earlier versions when saving workbook. The default value is true. Only for Excel97-2003 xls or xlt files.

Type: boolean

WorkbookSettings.CheckExcelRestriction property

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.

Type: boolean

WorkbookSettings.AutoRecover property

Indicates whether the file is marked for auto-recovery.

Type: boolean

WorkbookSettings.CrashSave property

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

Type: boolean

WorkbookSettings.DataExtractLoad property

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

Type: boolean

WorkbookSettings.RepairLoad property

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

Type: boolean

WorkbookSettings.BuildVersion property

Specifies the incremental public release of the application.

Type: String

WorkbookSettings.MemorySetting property

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. The value of the property is MemorySetting integer constant.

Type: int

WorkbookSettings.PaperSize property

Gets and sets the default print paper size. The value of the property is PaperSizeType integer constant. If there is no setting about paper size,MS Excel will use default printer’s setting.

Type: int

WorkbookSettings.MaxRowsOfSharedFormula property

Gets and sets the max row number of shared formula. If the number is too large, the autofilter works very slow in MS Excel 2013.

Type: int

WorkbookSettings.Compliance property

Specifies the OOXML version for the output document. The default value is Ecma376_2006. The value of the property is OoxmlCompliance integer constant. Only for .xlsx files.

Type: int

WorkbookSettings.QuotePrefixToStyle property

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

Type: boolean

WorkbookSettings.FormulaSettings property

Gets the settings for formula-related features.

Type: FormulaSettings

WorkbookSettings.PropertiesFollowChartPoint property

Type: boolean

WorkbookSettings.DiscardImageEditData property

Type: boolean

WorkbookSettings.DefaultImageResolution property

Type: int

WorkbookSettings.WpsCompatibility property

Type: boolean

dispose()

Releases resources.

getThemeFont(type)

Gets the default theme font name.

ParameterTypeDescription
typeintA FontSchemeType value. The scheme type of the font.

setPageOrientationType(pageOrientationType)

Set the type of print orientation for the whole workbook.

ParameterTypeDescription
pageOrientationTypeintA PageOrientationType value. The page orientation type