Get Address Cell Count Offset 範囲の列全体と行全体

考えられる使用シナリオ

Aspose.Cells は範囲ユーザーが Excel Ranges を簡単に操作できるようにするさまざまなユーティリティ メソッドを持つオブジェクトです。この記事では、次のメソッドまたはプロパティの使用法について説明します。範囲物体。

  • 住所

範囲のアドレスを取得します。

  • Cell カウント

範囲内のすべてのセル数を取得します。

  • オフセット

オフセットで範囲を取得します。

  • 列全体

指定した範囲を含む 1 つまたは複数の列全体を表す Range オブジェクトを取得します。

  • 行全体

指定した範囲を含む行全体を表す Range オブジェクトを取得します。

Get Address, Cell Count, Offset, 範囲の列全体と行全体

次のサンプル コードは、前述のメソッドとプロパティの使用法を説明しています。以下のコードのコンソール出力を参照してください。

サンプルコード

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// Create empty workbook.
Workbook wb = new Workbook();
// Access first worksheet.
Worksheet ws = wb.getWorksheets().get(0);
// Create range A1:B3.
System.out.println("Creating Range A1:B3\n");
Range rng = ws.getCells().createRange("A1:B3");
// Print range address and cell count.
System.out.println("Range Address: " + rng.getAddress());
System.out.println("Cell Count: " + rng.getCellCount());
// Formatting console output.
System.out.println("----------------------");
System.out.println("");
// Create range A1.
System.out.println("Creating Range A1\n");
rng = ws.getCells().createRange("A1");
// Print range offset, entire column and entire row.
System.out.println("Offset: " + rng.getOffset(2, 2).getAddress());
System.out.println("Entire Column: " + rng.getEntireColumn().getAddress());
System.out.println("Entire Row: " + rng.getEntireRow().getAddress());
// Formatting console output.
System.out.println("----------------------");
System.out.println("");

コンソール出力

 Creating Range A1:B3

Range Address: A1:B3

Cell Count: 6

\----------------------

Creating Range A1

Offset: C3

Entire Column: A:A

Entire Row: 1:1

\----------------------