[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IWorkbook

Interface IWorkbook

Namespace
GrapeCity.Documents.Excel
Assembly
GcDocs.Excel.dll

Represents an IWorkbook object.

public interface IWorkbook

Properties

ActiveSheet

Returns an object that represents the active sheet (the sheet on top) in the active workbook or in the specified window or workbook. Returns null if no sheet is active (read-only).

IWorksheet ActiveSheet { get; }

Property Value

IWorksheet

AllowDynamicArray

Gets or sets whether allow dynamic array formula.

bool AllowDynamicArray { get; set; }

Property Value

bool

AutoParse

Determines whether to automatically parse when setting a range value to a string value.

bool AutoParse { get; set; }

Property Value

bool

AutoRoundValue

Determines whether to round the number to 15 significant figures when getting the value.

bool AutoRoundValue { get; set; }

Property Value

bool

BookView

Returns an object that represents the view settings of this workbook(read-only).

IWorkbookView BookView { get; }

Property Value

IWorkbookView

BuiltInDocumentProperties

Gets a collection that represents all the built-in document properties of the workbook.

IBuiltInDocumentPropertyCollection BuiltInDocumentProperties { get; }

Property Value

IBuiltInDocumentPropertyCollection

Culture

[Init-only] Gets or sets culture for the workbook. The culture must contain both country/region and language.

CultureInfo Culture { get; set; }

Property Value

System.Globalization.CultureInfo

Remarks

This property must be set within the initialization expression of the workbook instance.

CustomDocumentProperties

Gets a collection that represents all the custom document properties of the workbook.

ICustomDocumentPropertyCollection CustomDocumentProperties { get; }

Property Value

ICustomDocumentPropertyCollection

CustomViews

Gets the custom views of the workbook.

ICustomViews CustomViews { get; }

Property Value

ICustomViews

DefaultTableStyle

Specifies the table style name from the ITableStyleCollection collection that is used as the default TableStyle (read/write).

string DefaultTableStyle { get; set; }

Property Value

string

DeferUpdateDirtyState

Gets or sets whether update the dirty state of the formula cells immediately when changing the value of a cell.

bool DeferUpdateDirtyState { get; set; }

Property Value

bool

EnableCalculation

Gets or sets whether the calculation engine is valid.

bool EnableCalculation { get; set; }

Property Value

bool

FullName

Returns the name of the workbook, including its path on disk.

string FullName { get; }

Property Value

string

GraphicsInfo

Provides graphics information. If this property doesn't have value, the workbook will use built-in graphic information.

IGraphicsInfo GraphicsInfo { get; set; }

Property Value

IGraphicsInfo

Name

Gets or sets a string value that represents the name of the workbook.

string Name { get; set; }

Property Value

string

Names

Returns the INames collection that represents the workbook-specified names. This is a read-only INames object.

INames Names { get; }

Property Value

INames

Options

Returns the IExcelOptions object that represents some settings to control workbook behavior.

IExcelOptions Options { get; }

Property Value

IExcelOptions

Path

Gets or sets a string that represents the path to the workbook file that this workbook object represents.

string Path { get; set; }

Property Value

string

PivotCaches

Returns the IPivotCaches collection that represents all the IPivotTable caches in the specified workbook (read-only).

IPivotCaches PivotCaches { get; }

Property Value

IPivotCaches

ProtectStructure

True if the order of the sheets in the workbook is protected. Read-only Boolean.

bool ProtectStructure { get; }

Property Value

bool

ProtectWindows

True if the windows of the workbook are protected. Read-only Boolean.

bool ProtectWindows { get; }

Property Value

bool

ReferenceStyle

Gets or sets the reference style.

ReferenceStyle ReferenceStyle { get; set; }

Property Value

ReferenceStyle

ResetAdjacentRangeBorder

Determines whether to reset adjacent range's border when setting border for a range. The default value of this property is true.

bool ResetAdjacentRangeBorder { get; set; }

Property Value

bool

SelectedSheets

Returns a IWorksheets collection that represents all the selected sheets in the specified workbook.

IWorksheets SelectedSheets { get; }

Property Value

IWorksheets

Signatures

Gets a collection of Signature objects that correspond to the digital signature attached to a document.

ISignatureSet Signatures { get; }

Property Value

ISignatureSet

SlicerCaches

Gets the ISlicerCaches object associated with the workbook.

ISlicerCaches SlicerCaches { get; }

Property Value

ISlicerCaches

Styles

Returns the IStyleCollection collection that represents all the styles in the specified workbook (read-only).

IStyleCollection Styles { get; }

Property Value

IStyleCollection

TableStyles

Returns the ITableStyleCollection collection object for the current workbook that refers to the styles used in the current workbook (read-only).

ITableStyleCollection TableStyles { get; }

Property Value

ITableStyleCollection

Theme

Returns or sets the theme applied to the current workbook.

ITheme Theme { get; set; }

Property Value

ITheme

Worksheets

Returns the IWorksheets collection that represents all the worksheets in the specified workbook. This is a read-only Sheets object.

IWorksheets Worksheets { get; }

Property Value

IWorksheets

WriteProtection

Provides access to the workbook write protection options.

WriteProtection WriteProtection { get; }

Property Value

WriteProtection

Methods

AddDataSource(string, object)

Add data source for template.

void AddDataSource(string name, object dataSource)

Parameters

name string

the alias name of the data source.

dataSource object

Can be object of DataSet, DataTable, Custom object and variable.

Calculate()

Calculates formulas of the workbook as needed.

void Calculate()

ConvertBarcodeToPicture(ImageType)

Convert the calculated barcodes to pictures and place them in their respective positions. The original barcode formulas will be cleared.
Not support EMF and WMF image types.

void ConvertBarcodeToPicture(ImageType imageType = ImageType.SVG)

Parameters

imageType ImageType

Specify the ImageType of converted image.

Exceptions

System.NotSupportedException

If convert to EMF or WMF image type.

Dirty()

Designates all the formulas of the workbook to be recalculated when the next calculation occurs.

void Dirty()

FromJson(Stream, DeserializationOptions)

Generates a workbook from a JSON stream.

IList<JsonError> FromJson(Stream stream, DeserializationOptions deserializationOptions = null)

Parameters

stream System.IO.Stream

The stream

deserializationOptions DeserializationOptions

The DeserializationOptions object.

Returns

System.Collections.Generic.IList<T><JsonError>

The errors in the JSON.

FromJson(string, DeserializationOptions)

Generates a workbook from a JSON string.

IList<JsonError> FromJson(string json, DeserializationOptions deserializationOptions = null)

Parameters

json string

The JSON

deserializationOptions DeserializationOptions

The DeserializationOptions object.

Returns

System.Collections.Generic.IList<T><JsonError>

The errors in the JSON.

FromSjsJson(Stream, SjsOpenOptions)

Generates a workbook from a JSON stream containing the contents of .sjs file format.

void FromSjsJson(Stream stream, SjsOpenOptions openOptions)

Parameters

stream System.IO.Stream

The JSON stream.

openOptions SjsOpenOptions

The open options for opening SpreadJS .sjs file.

FromSjsJson(Stream)

Generates a workbook from a JSON stream containing the contents of .sjs file format.

void FromSjsJson(Stream stream)

Parameters

stream System.IO.Stream

The JSON stream.

FromSjsJson(string, SjsOpenOptions)

Generates a workbook from a JSON string containing the contents of .sjs file format.

void FromSjsJson(string json, SjsOpenOptions openOptions)

Parameters

json string

The JSON string.

openOptions SjsOpenOptions

The open options for opening SpreadJS .sjs file.

FromSjsJson(string)

Generates a workbook from a JSON string containing the contents of .sjs file format.

void FromSjsJson(string json)

Parameters

json string

The JSON string.

GenerateReport()

Process the template and return the instance of report workbook.

IWorkbook GenerateReport()

Returns

IWorkbook

The new IWorkbook.

GenerateReport(params IWorksheet[])

Process the template and return the instance of report workbook.

IWorkbook GenerateReport(params IWorksheet[] worksheets)

Parameters

worksheets IWorksheet[]

IWorksheet collection that need to be processed.

Returns

IWorkbook

The new IWorkbook.

GetExcelLinkSources()

Returns the names of the linked excel documents.

IEnumerable<string> GetExcelLinkSources()

Returns

System.Collections.Generic.IEnumerable<T><string>

GetUsedFonts()

Gets all fonts information that used on workbook.

IEnumerable<FontInfo> GetUsedFonts()

Returns

System.Collections.Generic.IEnumerable<T><FontInfo>

IsEncryptedFile(Stream)

Specifies whether the file is password protected.

bool IsEncryptedFile(Stream fileStream)

Parameters

fileStream System.IO.Stream

The file stream.

Returns

bool

True if the file is encrypted, false otherwise.

IsEncryptedFile(string)

Specifies whether the file is password protected.

bool IsEncryptedFile(string fileName)

Parameters

fileName string

The file name.

Returns

bool

True if the file is encrypted, false otherwise.

Open(Stream, OpenFileFormat)

Opens the specified format file stream.

void Open(Stream fileStream, OpenFileFormat fileFormat)

Parameters

fileStream System.IO.Stream

The specified file stream.

fileFormat OpenFileFormat

The format of the file stream.

Open(Stream, OpenOptionsBase)

Opens the stream with specified options.

void Open(Stream fileStream, OpenOptionsBase options)

Parameters

fileStream System.IO.Stream

The file stream.

options OpenOptionsBase

The format of opening the file stream. Possible types:

Open(Stream, string, OpenOptions)

Opens the specified excel file stream.

void Open(Stream fileStream, string password = null, OpenOptions openOptions = null)

Parameters

fileStream System.IO.Stream

The file stream.

password string

The password of the file.

openOptions OpenOptions

Options for opening.

Remarks

This method is now obsolete.

Open(Stream)

Opens the file stream.

void Open(Stream fileStream)

Parameters

fileStream System.IO.Stream

The specified file stream.

Open(string, DeserializationOptions)

Opens the JSON file.

IList<JsonError> Open(string fileName, DeserializationOptions deserializationOptions)

Parameters

fileName string

The specified JSON file.

deserializationOptions DeserializationOptions

The JSON deserialization options.

Returns

System.Collections.Generic.IList<T><JsonError>

The error list of the JSON.

Open(string, OpenFileFormat)

Opens the specified format file.

void Open(string fileName, OpenFileFormat fileFormat)

Parameters

fileName string

The specified file.

fileFormat OpenFileFormat

The format of the file.

Open(string, OpenOptionsBase)

Opens the file with specified options.

void Open(string fileName, OpenOptionsBase options)

Parameters

fileName string

The excel file.

options OpenOptionsBase

The options of opening the file. Possible types:

Open(string, string, OpenOptions)

Opens the specified excel file.

void Open(string fileName, string password = null, OpenOptions openOptions = null)

Parameters

fileName string

The excel file.

password string

The password of the file.

openOptions OpenOptions

Options for opening.

Remarks

This method is now obsolete.

Open(string)

Opens the file.

void Open(string fileName)

Parameters

fileName string

The specified file.

PrintOut(PrintOutOptions)

Prints the workbook.

void PrintOut(PrintOutOptions options = null)

Parameters

options PrintOutOptions

Options for printing the workbook.

ProcessTemplate()

Start to process the template

void ProcessTemplate()

ProcessTemplate(CancellationToken)

Start to process the template with global options and cancellation support.

void ProcessTemplate(CancellationToken cancellationToken)

Parameters

cancellationToken System.Threading.CancellationToken

The token to monitor for cancellation requests.

Remarks

The caller must decide whether to accept the partially expanded template or revert to the previous state. If the caller needs to revert to the previous state, it must serialize the workbook before calling this method, then deserialize the workbook after canceling the operation.

Exceptions

System.OperationCanceledException

Throws when the System.Threading.CancellationToken was canceled.

Protect(bool, bool)

Protects a workbook so that it cannot be modified.

void Protect(bool structure = true, bool windows = false)

Parameters

structure bool

True to protect the structure of the workbook (To prevent other users from viewing hidden worksheets, adding, moving, deleting, or hiding worksheets, and renaming worksheets). The default value is true.

windows bool

True to prevent users from moving, resizing, or closing the workbook window, or hide/unhide windows. This option is available only in Excel 2007, Excel 2010, Excel for Mac 2011, and Excel 2016 for Mac.

Protect(string, bool, bool)

Protects a workbook so that it cannot be modified.

void Protect(string password, bool structure = true, bool windows = false)

Parameters

password string

Password to protect the workbook.

structure bool

True to protect the structure of the workbook (To prevent other users from viewing hidden worksheets, adding, moving, deleting, or hiding worksheets, and renaming worksheets).

windows bool

True to prevent users from moving, resizing, or closing the workbook window, or hide/unhide windows. This option is available only in Excel 2007, Excel 2010, Excel for Mac 2011, and Excel 2016 for Mac.

Save(Stream, SaveFileFormat)

Saves the specified format file stream.

void Save(Stream fileStream, SaveFileFormat fileFormat)

Parameters

fileStream System.IO.Stream

The specified file stream.

fileFormat SaveFileFormat

The format of the file stream.

Save(Stream, SaveOptionsBase)

Saves workbook to stream with specified options.

void Save(Stream fileStream, SaveOptionsBase options)

Parameters

fileStream System.IO.Stream

The specified file stream.

options SaveOptionsBase

The options of saving the file stream. Possible types:

Save(Stream, string, SaveOptions)

Saves data to the specified excel file stream.

void Save(Stream fileStream, string password = null, SaveOptions saveOptions = null)

Parameters

fileStream System.IO.Stream

The file stream.

password string

The password of the file.

saveOptions SaveOptions

Options for saving.

Save(Stream)

Saves the workbook to the stream.

void Save(Stream fileStream)

Parameters

fileStream System.IO.Stream

The file stream.

Save(string, SaveFileFormat)

Saves the specified format file.

void Save(string fileName, SaveFileFormat fileFormat)

Parameters

fileName string

The specified file.

fileFormat SaveFileFormat

The format of the file.

Save(string, SaveOptionsBase)

Saves workbook to file with specified options.

void Save(string fileName, SaveOptionsBase options)

Parameters

fileName string

The specified file.

options SaveOptionsBase

The options of saving the file. Possible types:

Save(string, string, SaveOptions)

Saves data to the specified excel file.

void Save(string fileName, string password = null, SaveOptions saveOptions = null)

Parameters

fileName string

The excel file.

password string

The password of the file.

saveOptions SaveOptions

Options for saving.

Save(string)

Saves the workbook to the disk.

void Save(string fileName)

Parameters

fileName string

The file name.

ToJson(SerializationOptions)

Generates a JSON string from a workbook.

string ToJson(SerializationOptions serializationOptions = null)

Parameters

serializationOptions SerializationOptions

The SerializationOptions object.

Returns

string

The JSON string.

ToJson(Stream, SerializationOptions)

Generates a JSON stream from a workbook.

void ToJson(Stream stream, SerializationOptions serializationOptions = null)

Parameters

stream System.IO.Stream

The specified JSON stream.

serializationOptions SerializationOptions

The SerializationOptions object.

ToSjsJson()

Generates a JSON string from a workbook. It integrates all JSON files from the SJS file into a single string.

string ToSjsJson()

Returns

string

Json data.

ToSjsJson(SjsSaveOptions)

Generates a JSON string from a workbook. It integrates all JSON files from the SJS file into a single string.

string ToSjsJson(SjsSaveOptions options)

Parameters

options SjsSaveOptions

Option for saving sjs file.

Returns

string

Json data.

ToSjsJson(Stream, SjsSaveOptions)

Integrates all JSON files from the SJS file into a single string, then put the string into the stream.

void ToSjsJson(Stream stream, SjsSaveOptions options)

Parameters

stream System.IO.Stream

The specified file stream.

options SjsSaveOptions

Option for saving sjs file.

ToSjsJson(Stream)

Integrates all JSON files from the SJS file into a single string, then put the string into the stream.

void ToSjsJson(Stream stream)

Parameters

stream System.IO.Stream

The specified file stream.

Unprotect(string)

Removes protection from the workbook.

void Unprotect(string password = null)

Parameters

password string

Password to protect the workbook.

Updates a excel link.

void UpdateExcelLink(string name, IWorkbook sourceWorkbook)

Parameters

name string

the link name.

sourceWorkbook IWorkbook

the workbook instance for the link.

Updates a excel link.

void UpdateExcelLink(string name)

Parameters

name string

the link name.

Updates all the excel links.

void UpdateExcelLinks()

WaitForCalculationToFinish()

Waits for all calculation to complete, including asynchronous calculations. This method blocks the current thread until all calculations have finished. Users can call this method to ensure that all necessary computations have been performed before proceeding with any other operations that depend on the calculation results.

void WaitForCalculationToFinish()

Events

AfterSave

Occurs after the workbook is saved.

event EventHandler AfterSave

Event Type

System.EventHandler

BeforeSave

Occurs before the workbook is saved.

event EventHandler BeforeSave

Event Type

System.EventHandler

NewSheet

Occurs when a new sheet is created in the workbook.

event EventHandler<SheetEventArgs> NewSheet

Event Type

System.EventHandler<TEventArgs><SheetEventArgs>

Opened

Occurs when the workbook is opened.

event EventHandler Opened

Event Type

System.EventHandler

SheetActivate

Occurs when a sheet is activate.

event EventHandler<SheetEventArgs> SheetActivate

Event Type

System.EventHandler<TEventArgs><SheetEventArgs>

SheetBeforeDelete

Occurs before a sheet is deleted.

event EventHandler<SheetEventArgs> SheetBeforeDelete

Event Type

System.EventHandler<TEventArgs><SheetEventArgs>

SheetChange

Occurs when something changes in the cells of a sheet.

event EventHandler<RangeEventArgs> SheetChange

Event Type

System.EventHandler<TEventArgs><RangeEventArgs>

SheetDeactivate

Occurs when a sheet is deactivated.

event EventHandler<SheetEventArgs> SheetDeactivate

Event Type

System.EventHandler<TEventArgs><SheetEventArgs>

SheetSelectionChange

Occurs when the selection changes on a sheet.

event EventHandler<RangeEventArgs> SheetSelectionChange

Event Type

System.EventHandler<TEventArgs><RangeEventArgs>