テーブルと範囲
Contents
[
Hide
]
序章
場合によっては、Microsoft Excel でテーブルを作成し、付属のテーブル機能を使い続けたくないことがあります。代わりに、テーブルのようなものが必要です。書式設定を失わずにテーブル内のデータを保持するには、テーブルを通常のデータ範囲に変換します。 Aspose.Cells は、Microsoft Excel のテーブルおよびリスト オブジェクトのこの機能をサポートしています。
Microsoft エクセルを使う
使用範囲に変換書式設定を失うことなくテーブルを範囲にすばやく変換する機能。 Microsoft Excel 2007/2010:
- テーブル内の任意の場所をクリックして、アクティブ セルがテーブルの列にあることを確認します。
- 上でデザインタブのツールグループ、クリック範囲に変換.
テーブルが範囲に変換されると、テーブルの機能は使用できなくなります。たとえば、行ヘッダーには並べ替え矢印とフィルター矢印が含まれなくなり、数式で使用されていた構造化参照 (テーブル名を使用する参照) は通常のセル参照に変わります。
Aspose.Cells を使用
次のコード スニペットは、Aspose.Cells を使用して同じ機能を示しています。
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 | |
// Instantiate a Workbook object and open an Excel file | |
intrusive_ptr<IWorkbook> workbook =Factory::CreateIWorkbook(dataDir_Tables->StringAppend(new String("sample.xlsx"))); | |
// Accessing the first worksheet in the Excel file | |
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0); | |
// Get the List objects collection in the first worksheet. | |
intrusive_ptr<IListObjectCollection> listObjects = worksheet->GetIListObjects(); | |
// Convert the first table/list object (from the first worksheet) to normal range | |
listObjects->GetObjectByIndex(0)->ConvertToRange(); | |
// Saving the Excel file | |
workbook->Save(dataDir_Tables->StringAppend(new String("ConvertTableToRange_out.xls"))); |