行と列のグループ化、グループ解除
Contents
[
Hide
]
序章
Microsoft Excel ファイルでは、データのアウトラインを作成して、マウスを 1 回クリックするだけで詳細レベルを表示および非表示にすることができます。
クリック外形記号、1、2、3、+、および - を使用して、ワークシート内のセクションの要約または見出しを提供する行または列のみをすばやく表示したり、記号を使用して個々の要約または見出しの下に詳細を表示したりできます。
行と列のグループ管理
Aspose.Cells はクラスを提供し、IワークブックMicrosoft Excel ファイルを表します。のIワークブッククラスにはIワークシートExcel ファイル内の各ワークシートにアクセスできるコレクション。ワークシートは、Iワークシートクラス。のIワークシートクラスはIセルワークシート内のすべてのセルを表すコレクション。
のIセルcollection は、ワークシートの行または列を管理するためのいくつかの方法を提供します。これらのいくつかについては、以下で詳しく説明します。
行と列のグループ化
行または列をグループ化するには、グループ行とグループ列のメソッドIセルコレクション。どちらのメソッドも、次のパラメーターを取ります。
- 最初の行/列インデックス、グループ内の最初の行または列。
- 最後の行/列インデックス、グループ内の最後の行または列。
- グループ化後に行/列を非表示にするかどうかを指定するブール値パラメーターです。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr sampleGroupingUngroupingRowsAndColumns = dirPath->StringAppend(new String("sampleGroupingUngroupingRowsAndColumns.xlsx")); | |
//Path of output excel file | |
StringPtr outputGroupingUngroupingRowsAndColumns = outPath->StringAppend(new String("outputGroupingUngroupingRowsAndColumns.xlsx")); | |
//Read input excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleGroupingUngroupingRowsAndColumns); | |
//Accessing the first worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
//Grouping first seven rows and first four columns | |
worksheet->GetICells()->GroupRows(0, 6, true); | |
worksheet->GetICells()->GroupColumns(0, 3, true); | |
//Save the Excel file. | |
workbook->Save(outputGroupingUngroupingRowsAndColumns); |
グループ設定
Microsoft Excel では、表示するグループ設定を構成できます。
- 詳細の下の要約行。
- 詳細の右側にある要約列。
行と列のグループ解除
グループ化された行または列のグループ化を解除するには、Iセルコレクションの行のグループ化を解除と列のグループ化を解除メソッド。どちらのメソッドも次の 2 つのパラメーターを取ります。
- 最初の行または列のインデックス、グループ化を解除する最初の行/列。
- 最後の行または列のインデックス、グループ化を解除する最後の行/列。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input excel file | |
StringPtr sampleGroupingUngroupingRowsAndColumns = dirPath->StringAppend(new String("sampleGroupingUngroupingRowsAndColumns.xlsx")); | |
//Path of output excel file | |
StringPtr outputGroupingUngroupingRowsAndColumns = outPath->StringAppend(new String("outputGroupingUngroupingRowsAndColumns.xlsx")); | |
//Read input excel file | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(sampleGroupingUngroupingRowsAndColumns); | |
//Accessing the second worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(1); | |
//UnGroup first seven rows and first four columns | |
worksheet->GetICells()->UngroupRows(0, 6); | |
worksheet->GetICells()->UngroupColumns(0, 3); | |
//Save the Excel file. | |
workbook->Save(outputGroupingUngroupingRowsAndColumns); |