SpreadsheetGear The Performance Spreadsheet Component Company 
OutlineLevel Property
See Also  Example
SpreadsheetGear Namespace > IRange Interface : OutlineLevel Property
Gets or sets the outline level of a range of rows or columns, which provides the ability to group and summarize information.

Syntax

C# 
virtual int OutlineLevel {get; set;}

Example

C#Copy Code
// Create a new workbook. 
SpreadsheetGear.IWorkbook workbook = SpreadsheetGear.Factory.GetWorkbook(); 
SpreadsheetGear.IWorksheet worksheet = workbook.Worksheets["Sheet1"]; 
SpreadsheetGear.IRange cells = worksheet.Cells; 
  
// Set the worksheet name. 
worksheet.Name = "2004 Sales"; 
  
// Load column titles and center. 
cells["B1"].Formula = "Mary"; 
cells["C1"].Formula = "Tom"; 
cells["D1"].Formula = "Jane"; 
cells["E1"].Formula = "Rick"; 
cells["B1:E1"].HorizontalAlignment = SpreadsheetGear.HAlign.Center; 
  
// Load row titles and align right. 
for (int quarter = 1; quarter <= 4; quarter++) 
    cells[quarter, 0].Formula = "Q" + quarter; 
cells["A6"].Formula = "Total"; 
cells["A1:A6"].HorizontalAlignment = SpreadsheetGear.HAlign.Right; 
  
// Load random data 
Random rand = new Random(System.Environment.TickCount); 
for (int row = 1; row <= 4; row++) 

    for (int col = 1; col <= 4; col++) 
        cells[row, col].Value = rand.Next(1000, 10000); 

  
// Sum each column.  
cells["B6"].Formula = "=SUM(B2:B5)";  
cells["C6"].Formula = "=SUM(C2:C5)";  
cells["D6"].Formula = "=SUM(D2:D5)";  
cells["E6"].Formula = "=SUM(E2:E5)"; 
  
// Format values as currency.  
cells["B2:E6"].NumberFormat = "$#,##0_)";   
  
// Set the outline level 
cells["2:5"].Rows.OutlineLevel = 2; 
    
Visual BasicCopy Code
' Create a new workbook.
Dim workbook As SpreadsheetGear.IWorkbook = SpreadsheetGear.Factory.GetWorkbook()
Dim worksheet As SpreadsheetGear.IWorksheet = workbook.Worksheets("Sheet1")
Dim cells As SpreadsheetGear.IRange = worksheet.Cells

' Set the worksheet name.
worksheet.Name = "2004 Sales"

' Load column titles and center.
cells("B1").Formula = "Mary"
cells("C1").Formula = "Tom"
cells("D1").Formula = "Jane"
cells("E1").Formula = "Rick"
cells("B1:E1").HorizontalAlignment = SpreadsheetGear.HAlign.Center

' Load row titles and align right.
Dim quarter As Integer
For quarter = 1 To 4
    cells(quarter, 0).Formula = "Q" + Convert.ToString(quarter)
Next quarter
cells("A6").Formula = "Total"
cells("A1:A6").HorizontalAlignment = SpreadsheetGear.HAlign.Right

' Load random data
Dim rand As New Random(System.Environment.TickCount)
Dim row As Integer
For row = 1 To 4
    Dim col As Integer
    For col = 1 To 4
        cells(row, col).Value = rand.Next(1000, 10000)
    Next col
Next row

' Sum each column.
cells("B6").Formula = "=SUM(B2:B5)"
cells("C6").Formula = "=SUM(C2:C5)"
cells("D6").Formula = "=SUM(D2:D5)"
cells("E6").Formula = "=SUM(E2:E5)"

' Format values as currency.
cells("B2:E6").NumberFormat = "$#,##0_)"

' Set the outline level
cells("2:5").Rows.OutlineLevel = 2

Requirements

Platforms: Windows 98, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family. SpreadsheetGear for .NET 1.x requires the Microsoft .NET Framework 1.1 or .NET 2.0. SpreadsheetGear for .NET 2006 requires the Microsoft .NET Framework 2.0.

See Also