ワークシートへの列の追加または挿入
Contents
[
Hide
]
このトピックでは、Aspose.Cells.GridDesktopのAPIを使用して、ワークシートに列を動的に追加および挿入する基本的な機能について説明します。追加と挿入の基本的な違いは、追加では列がワークシートの列コレクションの最後に追加されるのに対して、挿入では任意の指定位置に列を追加できることです。
ワークシートへの列の追加
ワークシートに新しい列を追加するには、以下の手順に従ってください:
- Aspose.Cells.GridDesktop コントロールを Form に追加します
- 任意の Worksheet にアクセスします
- ワークシートに列を追加します
This file contains hidden or 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 | |
// Accessing first worksheet of the Grid | |
Worksheet sheet = gridDesktop1.Worksheets[0]; | |
// Adding column to the worksheet | |
sheet.AddColumn(); |
ワークシートに列を挿入
指定された位置に新しい列をワークシートに挿入するには、以下の手順に従ってください:
- Aspose.Cells.GridDesktop コントロールを Form に追加します
- 任意の Worksheet にアクセスします
- ワークシートに列を挿入します(挿入する位置の列のインデックスを指定することで)
// Accessing first worksheet of the Grid
Aspose.Cells.GridDesktop.Worksheet sheet = gridDesktop1.Worksheets[0];
// Inserting column to the worksheet to the first position.
sheet.Cells.InsertColumn(0);