SpreadsheetGear 2010
OutlineLevel Property
See Also  Example Send Feedback
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

Visual Basic (Declaration) 
Property OutlineLevel As Integer
C# 
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

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

Copyright © 2003-2010 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.