Excel テーブルをデータ範囲に変換する

Microsoft エクセルを使う

使用範囲に変換書式設定を失うことなくテーブルを範囲にすばやく変換する機能。 Microsoft Excel 2007/2010:

  1. テーブル内の任意の場所をクリックして、アクティブ セルがテーブルの列にあることを確認します。

todo:画像_代替_文章

  1. 上でデザインタブのツールグループ、クリック範囲に変換.

todo:画像_代替_文章

Aspose.Cells を使用

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// The path to the documents directory.
String dataDir = Utils.getSharedDataDir(ConvertTableToRange.class) + "tables/";
// Open an existing file that contains a table/list object in it
Workbook wb = new Workbook(dataDir + "book1.xlsx");
// Convert the first table/list object (from the first worksheet) to normal range
wb.getWorksheets().get(0).getListObjects().get(0).convertToRange();
// Save the file
wb.save(dataDir + "ConvertTableToRange_out.xlsx");

オプションを使用してテーブルを範囲に変換する

Aspose.Cells は、TableToRangeOptionsクラス。のTableToRangeOptionsクラスが提供する最後の行テーブル行の最後のインデックスを設定できるプロパティ。テーブルの書式設定は、指定された行インデックスまで保持され、残りの書式設定は削除されます。

以下のサンプル コードは、TableToRangeOptionsクラス。

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// The path to the documents directory.
String dataDir = Utils.getSharedDataDir(ConvertTableToRangeWithOptions.class) + "Tables/";
// Open an existing file that contains a table/list object in it
Workbook workbook = new Workbook(dataDir + "book1.xlsx");
TableToRangeOptions options = new TableToRangeOptions();
options.setLastRow(5);
// Convert the first table/list object (from the first worksheet) to normal range
workbook.getWorksheets().get(0).getListObjects().get(0).convertToRange(options);
// Save the file
workbook.save(dataDir + "ConvertTableToRangeWithOptions_out.xlsx");