Daniel's XL Toolbox NG
XLToolbox.Excel.ViewModels.SheetViewModel Class Reference

A view model for Excel sheets (worksheets, charts). More...

Inheritance diagram for XLToolbox.Excel.ViewModels.SheetViewModel:
Collaboration diagram for XLToolbox.Excel.ViewModels.SheetViewModel:

Public Member Functions

int CountShapes ()
 Counts the charts and shapes that are embedded in the worksheet, or counts the chart sheet as 1. More...
 
int CountCharts ()
 
bool SelectShapes ()
 Selects all shapes (chart and other graphic objects) on the sheet, or the chart if the sheet is a chart sheet. More...
 
bool SelectCharts ()
 Selects all charts on the sheet. More...
 
 SheetViewModel ()
 
 SheetViewModel (object sheet)
 
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...
 

Static Public Member Functions

static bool RequiresQuote (string sheetName)
 Determines whether or not a sheet name must be quoted in references. If the name contains certain characters, it will be quoted. See https://www.xltoolbox.net/blog/2015/05/excel-address-syntax.html More...
 
static bool RequiresQuote (string workbookPath, string sheetName)
 Determines whether or not a sheet name and workbook path must be quoted in references. If the name contains certain characters, it will be quoted. See https://www.xltoolbox.net/blog/2015/05/excel-address-syntax.html More...
 
static bool IsValidName (string name)
 Tests whether a string represents a valid Excel sheet name. More...
 

Properties

override string DisplayString [get, set]
 
dynamic Sheet [get, set]
 
Worksheet Worksheet [get]
 Returns the Sheet as a Worksheet, or Null if the Sheet is a Chart. More...
 
Chart Chart [get]
 Returns the Sheet as a Chart, or Null if the Sheet is a Worksheet. More...
 
bool IsChart [get]
 Indicates whether the Sheet model is a worksheet or a chart. This property is set by the constructor and provides quicker repeat access to the information than "myobject [AI]s Chart" statements. More...
 
string RefName [get]
 Returns the name of the sheet suitable for referencing. If the name contains certain characters, it will be quoted. See https://www.xltoolbox.net/blog/2015/05/excel-address-syntax.html More...
 
string RefNameWithWorkbook [get]
 
string RefNameWithWorkbookAndPath [get]
 
long MaxRows [get]
 
long MaxCols [get]
 
string MaxColNotation [get]
 
- 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...
 

Additional Inherited Members

- 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...
 
- 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
 

Detailed Description

A view model for Excel sheets (worksheets, charts).

Constructor & Destructor Documentation

◆ SheetViewModel() [1/2]

XLToolbox.Excel.ViewModels.SheetViewModel.SheetViewModel ( )
inline

◆ SheetViewModel() [2/2]

XLToolbox.Excel.ViewModels.SheetViewModel.SheetViewModel ( object  sheet)
inline

Member Function Documentation

◆ CountCharts()

int XLToolbox.Excel.ViewModels.SheetViewModel.CountCharts ( )
inline

◆ CountShapes()

int XLToolbox.Excel.ViewModels.SheetViewModel.CountShapes ( )
inline

Counts the charts and shapes that are embedded in the worksheet, or counts the chart sheet as 1.

Returns
Number of embedded charts and shapes, or 1 if the sheet is a chart.

◆ Dispose()

void XLToolbox.Excel.ViewModels.SheetViewModel.Dispose ( )
inline

◆ IsValidName()

static bool XLToolbox.Excel.ViewModels.SheetViewModel.IsValidName ( string  name)
inlinestatic

Tests whether a string represents a valid Excel sheet name.

Excel sheet names must be 1 to 31 characters long and must not contain the characters ":/\[]*?".

Parameters
nameString to test.
Returns
True if name can be used as a sheet name, false if not.

◆ RequiresQuote() [1/2]

static bool XLToolbox.Excel.ViewModels.SheetViewModel.RequiresQuote ( string  sheetName)
inlinestatic

Determines whether or not a sheet name must be quoted in references. If the name contains certain characters, it will be quoted. See https://www.xltoolbox.net/blog/2015/05/excel-address-syntax.html

◆ RequiresQuote() [2/2]

static bool XLToolbox.Excel.ViewModels.SheetViewModel.RequiresQuote ( string  workbookPath,
string  sheetName 
)
inlinestatic

Determines whether or not a sheet name and workbook path must be quoted in references. If the name contains certain characters, it will be quoted. See https://www.xltoolbox.net/blog/2015/05/excel-address-syntax.html

◆ RevealModelObject()

override object XLToolbox.Excel.ViewModels.SheetViewModel.RevealModelObject ( )
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.

Returns
Model object.

Implements Bovender.Mvvm.ViewModels.ViewModelBase.

◆ SelectCharts()

bool XLToolbox.Excel.ViewModels.SheetViewModel.SelectCharts ( )
inline

Selects all charts on the sheet.

Returns
True if the sheet is a chart or contains embedded charts; false if not.

◆ SelectShapes()

bool XLToolbox.Excel.ViewModels.SheetViewModel.SelectShapes ( )
inline

Selects all shapes (chart and other graphic objects) on the sheet, or the chart if the sheet is a chart sheet.

Returns
True if there are any charts and shapes on the sheet or if the sheet is a chart sheet; false if not.

Property Documentation

◆ Chart

Chart XLToolbox.Excel.ViewModels.SheetViewModel.Chart
get

Returns the Sheet as a Chart, or Null if the Sheet is a Worksheet.

◆ DisplayString

override string XLToolbox.Excel.ViewModels.SheetViewModel.DisplayString
getset

◆ IsChart

bool XLToolbox.Excel.ViewModels.SheetViewModel.IsChart
get

Indicates whether the Sheet model is a worksheet or a chart. This property is set by the constructor and provides quicker repeat access to the information than "myobject [AI]s Chart" statements.

◆ MaxColNotation

string XLToolbox.Excel.ViewModels.SheetViewModel.MaxColNotation
get

◆ MaxCols

long XLToolbox.Excel.ViewModels.SheetViewModel.MaxCols
get

◆ MaxRows

long XLToolbox.Excel.ViewModels.SheetViewModel.MaxRows
get

◆ RefName

string XLToolbox.Excel.ViewModels.SheetViewModel.RefName
get

Returns the name of the sheet suitable for referencing. If the name contains certain characters, it will be quoted. See https://www.xltoolbox.net/blog/2015/05/excel-address-syntax.html

◆ RefNameWithWorkbook

string XLToolbox.Excel.ViewModels.SheetViewModel.RefNameWithWorkbook
get

◆ RefNameWithWorkbookAndPath

string XLToolbox.Excel.ViewModels.SheetViewModel.RefNameWithWorkbookAndPath
get

◆ Sheet

dynamic XLToolbox.Excel.ViewModels.SheetViewModel.Sheet
getset

◆ Worksheet

Worksheet XLToolbox.Excel.ViewModels.SheetViewModel.Worksheet
get

Returns the Sheet as a Worksheet, or Null if the Sheet is a Chart.


The documentation for this class was generated from the following file: