SpreadsheetGear
DisplayReference Property
See Also  Example Send Feedback
SpreadsheetGear.Windows.Forms Namespace > WorkbookView Class : DisplayReference Property

Gets or sets the property which specifies which workbook or set of cell ranges to display in the workbook view.

Syntax

Visual Basic (Declaration) 
<DescriptionAttribute("Determines which workbook or set of custom tabs to display in the control.")>
<CategoryAttribute("Display")>
<DefaultValueAttribute()>
Public Property DisplayReference As String
C# 
[DescriptionAttribute("Determines which workbook or set of custom tabs to display in the control.")]
[CategoryAttribute("Display")]
[DefaultValueAttribute()]
public string DisplayReference {get; set;}

Example

C#Copy Code
/*
        * Demonstrate DisplayReference and DisplayReferenceName usage.
        */
       
private void radioButton_CheckedChanged(object sender, EventArgs e)
       {
           
if (radioButtonWorkbook.Checked)
           {
               
// Change the display reference to a workbook.
               
workbookView.DisplayReference = "Book2";
               workbookView.DisplayReferenceName =
null;
           }
           
else if (radioButtonWorksheet.Checked)
           {
               
// Change the display reference to a worksheet and name it.
               
workbookView.DisplayReference = "[Book1]Sheet1!A:IV";
               workbookView.DisplayReferenceName =
"\"My Worksheet\"";
           }
           
else if (radioButtonRange.Checked)
           {
               
// Change the display reference to a range and name it.
               
workbookView.DisplayReference = "[Book3]Sheet2!A1:C3";
               workbookView.DisplayReferenceName =
"\"My Range\"";
           }
           
else if (radioButtonDefinedName.Checked)
           {
               
// Change the display reference to a defined name and name it.
               
workbookView.DisplayReference = "Book2!MyName";
               workbookView.DisplayReferenceName =
"\"My Defined Name\"";
           }
           
else if (radioButtonMultipleRanges.Checked)
           {
               
// Change the display reference to multiple ranges and name them.
               
workbookView.DisplayReference = "[Book1]Sheet1!A1:C3,[Book1]Sheet1!4:6,[Book1]Sheet1!D:F";
               workbookView.DisplayReferenceName =
"\"My Range1\",\"My Range2\",\"My Range3\"";
           }
       }
    

Remarks

Use the DisplayReference property to specify what should be displayed for each "sheet tab" of the workbook view control.

DisplayReference takes a comma separated list of formulas which must return a range. These formulas are evaluated each time a calculation completes in the workbook set associated with the workbook view control, by calling the ISheet.EvaluateRange method of the first worksheet of the first workbook of the workbook set.

Examples of valid settings for DisplayReference include:

  • "" displays the first workbook of the workbook set.
  • "A1:C3" displays the range A1:C3 from the first worksheet of the first workbook.
  • "Book2" displays the workbook named "Book2".
  • "[Book1]Sheet1!A1:C3, Book2!MyName" displays the range A1:C3 from the worksheet "Sheet1" of the workbook "Book1" on the first "sheet tab", and displays the range referred to by the defined name "MyName" of workbook "Book2" on the second sheet tab.
  • "INDIRECT([Book1]Sheet1!A1)" displays the range referred to by the text in the cell A1 of the worksheet "Sheet1" of the workbook "Book1".

Use the DisplayReferenceName property to specify the text to display on each "sheet tab".

Requirements

Platforms: x86 and x64 versions of Windows 2000, Windows XP, Windows Vista, Windows 7, Windows Server 2003 (including R2) and Windows Server 2008 (including R2). SpreadsheetGear 2009 requires the Microsoft .NET Framework 2.0 and supports .NET 3.0 and .NET 3.5.

See Also

Copyright © 2003-2009 SpreadsheetGear LLC. All Rights Reserved.Help Powered by Innovasys   
SpreadsheetGear is a registered trademark of SpreadsheetGear LLC.
Microsoft, Microsoft Excel and Visual Studio are trademarks or registered trademarks of Microsoft Corporation.