Aspose.Cells でスクロール バーを表示または非表示にする

Aspose.Cells はクラスを提供し、ワークブックこれは Excel ファイルを表します。のワークブッククラスには、Excel ファイルを管理するためのさまざまなプロパティとメソッドが用意されています。スクロール バーの表示を制御するには、ワークブック設定クラス'IsVScrollBarVisibleIsHScrollBarVisibleプロパティ。IsVScrollBarVisibleIsHScrollBarVisibleはブール型のプロパティです。つまり、これらのプロパティは格納のみ可能です。真実また間違い値。

以下は、Excel ファイル book1.xls を開き、両方のスクロール バーを非表示にしてから、変更したファイルを output.xls として保存する完全なコードです。

以下のスクリーンショットは、両方のスクロール バーを含む Book1.xls ファイルを示しています。変更されたファイルは output.xls ファイルとして保存されます。これも以下に示します。

Book1.xls: 変更前の Excel ファイル

todo:画像_代替_文章

output.xls:修正後のExcelファイル

todo:画像_代替_文章

C#

 //Creating a file stream containing the Excel file to be opened

FileStream fstream = new FileStream("book1.xls", FileMode.Open);

//Instantiating a Workbook object

//Opening the Excel file through the file stream

Workbook workbook = new Workbook(fstream);

//Hiding the vertical scroll bar of the Excel file

workbook.Settings.IsVScrollBarVisible = false;

//Hiding the horizontal scroll bar of the Excel file

workbook.Settings.IsHScrollBarVisible = false;

//Saving the modified Excel file

workbook.Save("output.xls");

//Closing the file stream to free all resources

fstream.Close();

実行中のコードをダウンロード

サンプルコードをダウンロード