Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

You can set the display to allow rows or columns to be grouped as an outline according to the headers. This creates a separate area beyond the headers that contains outlines for expanding or collapsing levels of rows or columns. Use the group method to create the range group.
The column group area is above the column headers and the row group area is to the left of the row headers.
The level button and number show the number of levels.  The level button or the icon can be used to expand or collapse the group.
Image Removed
You can display or hide groups with the showRowOutline and showColumnOutline methods. You can use the unGroup method to remove a range group.
Image Removed
Using Code
This example creates a column group and a row group.你可以将指定的行或者列组合,

本操作将会在表头创建一个额外的区域来显示组合的大纲。点击该区域的加号或者减号来展开或者收起分组。

使用 group 方法来创建分组。

行分组区域在行标题的左侧,列分组的区域在列标题的顶端。

级别按钮中的数字显示了分组有几个层级。

点击级别按钮来展开相应的层级。

Image Added

你可以使用 showRowOutline 或者 showColumnOutline 显示或者隐藏分组。

你可以使用 unGroup 来取消分组


Image Added
示例代码

以下代码创建了一个列分组和一个行分组。

JavaScript

Copy Code

activeSheet.setRowCount(34);activeSheet.setValue(0,0,"Western");activeSheet.setValue(0,1,"Western");activeSheet.setValue(0,2,"Western");activeSheet.setValue(1,0,"A"); activeSheet.setValue(1,1,"B");activeSheet.setValue(1,2,"C");activeSheet.setValue(2,0,"A");activeSheet.setValue(2,1,"B");activeSheet.setValue(2,2,"C");activeSheet.rowOutlines.group(0,2);activeSheet.columnOutlines.group(0,1);//activeSheet.rowOutlines.expand(0,false);//activeSheet.columnOutlines.expand(0,false);spread.invalidateLayout();spread.repaint();

 

Using Code
This example specifies the group direction.示例代码
以下代码展示了分组方向。

JavaScript

Copy Code

activeSheet.rowOutlines.group(3,2);activeSheet.columnOutlines.group(4,1);activeSheet.rowOutlines.direction(GC.Spread.Sheets.Outlines.OutlineDirection.backward);activeSheet.columnOutlines.direction(GC.Spread.Sheets.Outlines.OutlineDirection.forward);spread.invalidateLayout();spread.repaint();

 

Using Code
示例代码

以下代码使用 execute 方法指定了分组时的动作。
This example specifies an action and uses the execute method.

JavaScript

Copy Code

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="437fef3a-b118-4303-a4e6-8379df51afa5"><ac:plain-text-body><![CDATA[

var spread = new GC.Spread.Sheets.Workbook($("#ss")[0]);var activeSheet = spread.getActiveSheet();spread.commandManager().execute({cmd: "outlineRow", sheetName: activeSheet.name(), index: 4, count: 3});

 

]]></ac:plain-text-body></ac:structured-macro>

Using Code
This example finds and collapses a group.示例代码
以下代码演示了如何查找一个分组。

JavaScript

Copy Code

activeSheet.rowOutlines.group(0,5);var rgi = activeSheet.rowOutlines.find(1, 0);rgi.state(GC.Spread.Sheets.Outlines.OutlineState.collapsed);spread.invalidateLayout();spread.repaint();

 

Using Code
示例代码

以下代码设使用了 showRowOutline 和 showColumnOutline 方法
This example sets the showRowOutline and showColumnOutline methods.

JavaScript

Copy Code

activeSheet.showRowOutline(true);activeSheet.rowOutlines.group(0, 2);activeSheet.showColumnOutline(true);activeSheet.columnOutlines.group(0, 2);//activeSheet.rowOutlines.ungroup(0, 2);//activeSheet.columnOutlines.ungroup(0, 2);spread.invalidateLayout();spread.repaint();

 

See Also另见
expandGroup Method
expand Method
group Method
Workbook Method