Daniel's XL Toolbox NG
|
Provide access to an instance of Excel that the components are to work with. More...
Public Member Functions | |
Workbook | CreateWorkbook () |
Creates and returns a new workbook containing exactly one worksheet. More... | |
Workbook | CreateWorkbook (int numberOfSheets) |
Creates a workbook containing the specified number of sheets (not less than 1). More... | |
Workbook | LocateWorkbook (string name) |
Locates a workbook and returns it. If the workbook is loaded already, it will not be re-opened. If the workbook cannot be located, this method returns null. More... | |
Worksheet | LocateWorksheet (Workbook workbook, string name) |
Locates a worksheet in a given workbook. More... | |
void | DisableScreenUpdating () |
Disables screen updating. Increases an internal counter to be able to handle cascading calls to this method. More... | |
void | EnableScreenUpdating () |
Decreases the internal screen updating counter by one; if the counter reaches 0, the application's screen updating will resume. More... | |
void | DisableDisplayAlerts () |
Disables displaying of user alerts. Increases an internal counter to be able to handle cascading calls to this method. More... | |
void | EnableDisplayAlerts () |
Decreases the internal screen updating counter by one; if the counter reaches 0, the application's display of user alerts will be turned on again (in fact, it will be reset to its original state). More... | |
void | Reset () |
Debug method to reset the Excel application. The result is an application without open workbooks. More... | |
Workbook | FindWorkbook (string workbookName) |
Fetches a workbook if it is opened. If no workbook is found by the given name, this function returns null. Unlike the LocateWorkbook method, this method will not open a workbook that is currently not loaded. More... | |
AddIn | FindAddIn (string addInName) |
Fetches an add-in if it is opened. If no add-in is found by the given name, this function returns null. More... | |
bool | IsWorkbookLoaded (string workbookName) |
Returns true if a workbook is opened. More... | |
bool | IsAddInLoaded (string addInName) |
Returns true if an add-in is loaded. More... | |
void | Quit () |
Quits the current instance of Excel; no warning message will be shown. More... | |
void | ClearPivotCache () |
Instance () | |
Instantiates this class without an Excel instance More... | |
Instance (Application application) | |
Creates a new instance using application as Excel instance. More... | |
void | Dispose () |
override object | RevealModelObject () |
Returns the model object that this view model wraps or null if there is no wrapped model object. More... | |
Public Member Functions inherited from Bovender.Mvvm.ViewModels.ViewModelBase | |
bool | IsViewModelOf (object model) |
Determines whether the current object is a view model of a particular model object. Returns false if either the model or the viewmodel's wrapped model object is null. More... | |
Window | InjectInto< T > () |
Injects the ViewModel into a newly created View and wires the RequestCloseView event. More... | |
Window | InjectInto (Window view) |
Injects the view model into an existing view by setting the view's DataContext. More... | |
void | InjectAndShowInThread< T > (IntPtr ownerForm) |
Creates a new thread that creates a new instance of the view T , sets its Forms owner and shows it modelessly. Use this to show views during asynchronous operations. More... | |
void | InjectAndShowInThread< T > () |
Creates a new thread that creates a new instance of the view T and shows it modelessly. Use this to show views during asynchronous operations. More... | |
void | InjectAndShowDialogInThread< T > (IntPtr ownerForm) |
Creates a new thread that creates a new instance of the view T and shows it as a dialog. Use this to show dialogs during asynchronous operations. More... | |
bool | IsViewModelOf (object model) |
Determines whether the current object is a view model of a particular model object. Returns false if either the model or the viewmodel's wrapped model object is null. More... | |
Window | InjectInto< T > () |
Injects the ViewModel into a newly created View and wires the RequestCloseView event. More... | |
Window | InjectInto (Window view) |
Injects the view model into an existing view by setting the view's DataContext. More... | |
void | InjectAndShowInThread< T > (IntPtr ownerForm) |
Creates a new thread that creates a new instance of the view T , sets its Forms owner and shows it modelessly. Use this to show views during asynchronous operations. More... | |
void | InjectAndShowInThread< T > () |
Creates a new thread that creates a new instance of the view T and shows it modelessly. Use this to show views during asynchronous operations. More... | |
void | InjectAndShowDialogInThread< T > (IntPtr ownerForm) |
Creates a new thread that creates a new instance of the view T and shows it as a dialog. Use this to show dialogs during asynchronous operations. More... | |
Protected Member Functions | |
virtual void | Dispose (bool disposing) |
Protected Member Functions inherited from Bovender.Mvvm.ViewModels.ViewModelBase | |
virtual void | OnPropertyChanged (string propertyName) |
virtual bool | CanCloseView () |
virtual void | DoCloseView () |
ViewModelBase () | |
Does not allow public instantiation of this class. More... | |
virtual void | OnPropertyChanged (string propertyName) |
virtual bool | CanCloseView () |
virtual void | DoCloseView () |
ViewModelBase () | |
Does not allow public instantiation of this class. More... | |
Properties | |
static Instance | Default [get, set] |
DelegatingCommand | QuitInteractivelyCommand [get] |
DelegatingCommand | QuitSavingChangesCommand [get] |
DelegatingCommand | QuitDiscardingChangesCommand [get] |
Message< MessageContent > | ConfirmQuitSavingChangesMessage [get] |
Message< MessageContent > | ConfirmQuitDiscardingChangesMessage [get] |
Application | Application [get] |
Workbooks | Workbooks [get] |
Gets the Application's Workbooks collection. The underlying COM object is automatically released when the Instance object is disposed. More... | |
Workbook | ActiveWorkbook [get] |
string | ActivePath [get] |
Returns the active path. This is either the path of the active workbook, or the current working directory. More... | |
int | MajorVersion [get] |
Gets the major version number of the Excel instance as an integer. More... | |
string | HumanFriendlyVersion [get] |
Gets the Excel version and build number in a human-friendly form. More... | |
int | CountOpenWorkbooks [get] |
int | CountUnsavedWorkbooks [get] |
int | CountSavedWorkbooks [get] |
bool | IsSingleDocumentInterface [get] |
Gets whether the current Excel instance has an SDI (Excel 2013+) or not (Excel 2007/2010). More... | |
Properties inherited from Bovender.Mvvm.ViewModels.ViewModelBase | |
ICommand | CloseViewCommand [get] |
virtual string | DisplayString [get, set] |
bool | IsSelected [get, set] |
Dispatcher | ViewDispatcher [get, set] |
Dispatcher | Dispatcher [get] |
Captures the dispatcher of the thread that the object was created in. More... | |
Events | |
EventHandler< InstanceShutdownEventArgs > | ShuttingDown |
Events inherited from Bovender.Mvvm.ViewModels.ViewModelBase | |
EventHandler | RequestCloseView |
Raised by the CloseView Command, signals that associated views are to be closed. More... | |
PropertyChangedEventHandler | PropertyChanged |
Provide access to an instance of Excel that the components are to work with.
This class uses static fields to make sure only one instance of Excel is invoked. An internal counter records the number of class instances that are currently in use; when the last instance of this class is disposed of, the Excel instance will be closed.
Note that this class will only reference one single Excel instance, regardless whether this was started using a static method or by instantiating the class. Thus, there is no instance property to access the Exce instance, just the static property. Instantiating this class mainly serves the purpose of being able to automatically close Excel when the work is done by using Using() structures.
|
inline |
Instantiates this class without an Excel instance
|
inline |
|
inline |
|
inline |
Creates and returns a new workbook containing exactly one worksheet.
|
inline |
Creates a workbook containing the specified number of sheets (not less than 1).
If numberOfSheets is less than 1, the workbook will still contain one worksheet.
numberOfSheets | Number of sheets in the new workbook. |
|
inline |
Disables displaying of user alerts. Increases an internal counter to be able to handle cascading calls to this method.
|
inline |
Disables screen updating. Increases an internal counter to be able to handle cascading calls to this method.
|
inline |
|
inlineprotectedvirtual |
|
inline |
Decreases the internal screen updating counter by one; if the counter reaches 0, the application's display of user alerts will be turned on again (in fact, it will be reset to its original state).
|
inline |
Decreases the internal screen updating counter by one; if the counter reaches 0, the application's screen updating will resume.
|
inline |
Fetches an add-in if it is opened. If no add-in is found by the given name, this function returns null.
addInName | Add-in to fetch. |
|
inline |
Fetches a workbook if it is opened. If no workbook is found by the given name, this function returns null. Unlike the LocateWorkbook method, this method will not open a workbook that is currently not loaded.
workbookName | Workbook to fetch. |
|
inline |
Returns true if an add-in is loaded.
workbookName | Add-in name to query. |
|
inline |
Returns true if a workbook is opened.
addInName | Workbook name to query. |
|
inline |
Locates a workbook and returns it. If the workbook is loaded already, it will not be re-opened. If the workbook cannot be located, this method returns null.
name | Name (either bare name or full name with path) of the workbook being sought. If this is null or whitespace, the active workbook is returned. |
|
inline |
Locates a worksheet in a given workbook.
workbook | Workbook in which to look for the worksheet. If this is null, the active workbook is used. |
name | Name of the worksheet. |
|
inline |
Quits the current instance of Excel; no warning message will be shown.
|
inline |
Debug method to reset the Excel application. The result is an application without open workbooks.
|
inlinevirtual |
Returns the model object that this view model wraps or null if there is no wrapped model object.
This is a method rather than a property to make data binding more difficult (if not impossible), because binding directly to the model object is discouraged. However, certain users such as a ViewModelCollection might need access to the wrapped model object.
Implements Bovender.Mvvm.ViewModels.ViewModelBase.
|
get |
Returns the active path. This is either the path of the active workbook, or the current working directory.
If a workbook is opened as in Protected View and is the only open workbook, Application.ActiveWorkbook will be null. Therefore this helper property was invented.
|
get |
|
get |
|
get |
|
get |
|
get |
|
get |
|
get |
|
staticgetset |
|
get |
Gets the Excel version and build number in a human-friendly form.
See http://spreadsheetpage.com/index.php/resource/excel_version_history and http://blog.pathtosharepoint.com/2014/05/06/how-to-get-your-office-365-version-number/
excel | Excel application whose version information to to retrieve. |
|
get |
|
get |
Gets the major version number of the Excel instance as an integer.
|
get |
|
get |
|
get |
|
get |
Gets the Application's Workbooks collection. The underlying COM object is automatically released when the Instance object is disposed.
EventHandler<InstanceShutdownEventArgs> XLToolbox.Excel.ViewModels.Instance.ShuttingDown |