Get Address Cell Count Offset 範囲の列全体と行全体
Contents
[
Hide
]
考えられる使用シナリオ
Aspose.Cells は、ユーザーが Excel 範囲を簡単に操作できるようにするさまざまなユーティリティ メソッドを持つ Range オブジェクトを提供します。この記事では、Range オブジェクトの次のメソッドまたはプロパティの使用法について説明します。
- 住所
範囲のアドレスを取得します。
- Cell カウント
範囲内のすべてのセル数を取得します。
- オフセット
オフセットで範囲を取得します。
- 列全体
指定した範囲を含む 1 つまたは複数の列全体を表す Range オブジェクトを取得します。
- 行全体
指定した範囲を含む行全体を表す Range オブジェクトを取得します。
Get Address, Cell Count, Offset, 範囲の列全体と行全体
次のサンプル コードは、前述のメソッドとプロパティの使用法を説明しています。以下のコードのコンソール出力を参照してください。
サンプルコード
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-.NET | |
// Create empty workbook. | |
Workbook wb = new Workbook(); | |
// Access first worksheet. | |
Worksheet ws = wb.Worksheets[0]; | |
// Create range A1:B3. | |
Console.WriteLine("Creating Range A1:B3\n"); | |
Range rng = ws.Cells.CreateRange("A1:B3"); | |
// Print range address and cell count. | |
Console.WriteLine("Range Address: " + rng.Address); | |
Console.WriteLine("Range row Count: " + rng.RowCount); | |
Console.WriteLine("Range column Count: " + rng.ColumnCount); | |
// Formatting console output. | |
Console.WriteLine("----------------------"); | |
Console.WriteLine(""); | |
// Create range A1. | |
Console.WriteLine("Creating Range A1\n"); | |
rng = ws.Cells.CreateRange("A1"); | |
// Print range offset, entire column and entire row. | |
Console.WriteLine("Offset: " + rng.GetOffset(2, 2).Address); | |
Console.WriteLine("Entire Column: " + rng.EntireColumn.Address); | |
Console.WriteLine("Entire Row: " + rng.EntireRow.Address); | |
// Formatting console output. | |
Console.WriteLine("----------------------"); | |
Console.WriteLine(""); |
コンソール出力
Creating Range A1:B3
Range Address: A1:B3
Cell Count: 6
\----------------------
Creating Range A1
Offset: C3
Entire Column: A:A
Entire Row: 1:1
\----------------------