xlsgen > overview > Outline

What is outline? Outline is the ability to group blocks of cells vertically, horizontally or both. A screen capture speaks a thousand words :


Outline in Excel workbooks

To add outline to a group of cells in Excel, just select the Data / Group menu option, and then choose if you want to group rows or columns.

In addition to grouping, users can choose the nesting level as well as whether the grouping is expanded or collapsed.

xlsgen provides the ability to outline merged cells. Furthermore, outline is completely separated to the actual content. Outline is a formatting option on cells and can be applied to just about any content.

 

Outline properties from the IXlsOutline object interface.

Outline has the following properties :

 

Programmatically accessing Outline

Here is a sample code that adds a vertical outline, typical code. For more information on outline properties, look at the IXlsOutline interface and the enumOutlineLevel.

VB code

Dim style1 As IXlsStyle
Set style1 = wksht.NewStyle()
style1.Pattern.BackgroundColor = &HFFAAAA

Dim style2 As IXlsStyle
Set style2 = wksht.NewStyle()
style2.Pattern.BackgroundColor = &HAAFFAA

style1.Apply
wksht.Number(4,2) = 5
style2.Apply
wksht.Float(5,2) = 5.5
style1.Apply
wksht.Label(6,2) = "six"

' create an outline between rows 4 and 6
Dim range As IXlsRange
Set range = wksht.NewRange("R4C2:R6C2")
Dim outline As IXlsOutline
Set outline = range.NewOutline
outline.VerticalOutlineLevel = outline_level1

C# code

xlsgen.IXlsStyle style1 = wksht.NewStyle();
style1.Pattern.BackgroundColor = 0xFFAAAA;

xlsgen.IXlsStylePtr style2 = wksht.NewStyle();
style2.Pattern.BackgroundColor = 0xAAFFAA;

style1.Apply();
wksht.set_Number(4,2, 5);
style2.Apply();
wksht.set_Float(5,2, 5.5);
style1.Apply();
wksht.set_Label(6,2, "six");

// create an outline between rows 4 and 6
xlsgen.IXlsRange range = wksht.NewRange("R4C2:R6C2");
xlsgen.IXlsOutline outline = range.NewOutline();
outline.VerticalOutlineLevel = xlsgen.enumOutlineLevel.outline_level1;

C/C++ code

xlsgen::IXlsStylePtr style1 = wksht->NewStyle();
style1->Pattern->BackgroundColor = 0xFFAAAA;

xlsgen::IXlsStylePtr style2 = wksht->NewStyle();
style2->Pattern->BackgroundColor = 0xAAFFAA;

style1->Apply();
wksht->Number[4][2] = 5;
style2->Apply();
wksht->Float[5][2] = 5.5;
style1->Apply();
wksht->Label[6][2] = L"six";

// create an outline between rows 4 and 6
xlsgen::IXlsRangePtr range = wksht->NewRange(L"R4C2:R6C2");
xlsgen::IXlsOutlinePtr outline = range->NewOutline();
outline->VerticalOutlineLevel = xlsgen::outline_level1;

 

xlsgen documentation. © ARsT Design all rights reserved.