SpreadsheetGear 2017
OutlineLevel Property (IRange)
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
'Declaration
 
Property OutlineLevel As System.Integer
'Usage
 
Dim instance As IRange
Dim value As System.Integer
 
instance.OutlineLevel = value
 
value = instance.OutlineLevel
System.int OutlineLevel {get; set;}
read-write property OutlineLevel: System.Integer; 
function get,set OutlineLevel : System.int
__property System.int get_OutlineLevel();
__property void set_OutlineLevel( 
   System.int value
);
property System.int OutlineLevel {
   System.int get();
   void set (    System.int value);
}
Example
// 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
var rand = new Random();
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;
' 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()
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 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

IRange Interface
IRange Members
ShowLevels Method