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.
[Visual Basic]
Overridable Property OutlineLevel As Integer
[C#]
virtual int OutlineLevel {get; set;}
[C++]
__property virtual int get_OutlineLevel();
__property virtual void set_OutlineLevel(
int value
);
[C++/CLI]
virtual property int OutlineLevel {
int get();
void set (int value);
}
[C#]
// 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 Basic]
' 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
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
IRange Interface | IRange Members | ShowLevels Method
See our live Excel Reporting, Excel Charting, Excel to DataGrid and Excel Calculation Samples.
Copyright © 2003-2007 SpreadsheetGear LLC. All Rights Reserved.
SpreadsheetGear and Spreadsheet Gear are trademarks of SpreadsheetGear LLC.