シートタブバーの制御方法
Contents
[
Hide
]
可能な使用シナリオ
Excel シートバーの表示を調整する必要がある場合、シートタブバーの制御方法(シートタブバーの非表示、表示、シートタブバー幅の変更、最初に表示されるタブの指定など)を知る必要があります。Aspose.Cells はこれらの機能をサポートしています。Aspose.Cells では、目標を達成するための次のプロパティとメソッドが提供されます。
Aspose.Cells for .NET を使用したシートタブバーの制御方法
この例では、次のことができます:
- ワークブックを作成する。
- 最初のワークシートのセルにデータを追加する。
- シートタブを表示してタブバーの幅を設定します。
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
//Instantiating an Workbook object | |
Workbook workbook = new Workbook(); | |
//Obtaining the reference of the newly added worksheet | |
Worksheet ws = workbook.Worksheets[0]; | |
Aspose.Cells.Cells cells = ws.Cells; | |
//Setting the value to the cells | |
Aspose.Cells.Cell cell = cells["A1"]; | |
cell.PutValue("Fruit"); | |
cell = cells["B1"]; | |
cell.PutValue("Count"); | |
cell = cells["C1"]; | |
cell.PutValue("Price"); | |
cell = cells["A2"]; | |
cell.PutValue("Apple"); | |
cell = cells["A3"]; | |
cell.PutValue("Mango"); | |
cell = cells["A4"]; | |
cell.PutValue("Blackberry"); | |
cell = cells["A5"]; | |
cell.PutValue("Cherry"); | |
//Display the sheet tab and set the width of the tab bar | |
workbook.Settings.ShowTabs = true; | |
workbook.Settings.SheetTabBarWidth = 150; | |
workbook.Save("out.xlsx"); |
結果ファイルのプレビュー: