We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Set visual properties of a workbook

If MS Excel opens a workbook, certain visual properties are restored. Such as…

  • Which worksheet to display
  • Vertical / horizontal scrolling of all worksheets
  • Selected cell in each worksheet

Can I specify these settings with Aspose.Cells?

Michael G. Schneider


Thanks for considering Aspose.

Well, you need to use the licensed version of Aspose.Cells to set these visual proprties.

May the following sample help you for your need. In the Example I utilize certain APIs of the component. The example covers all your three bulleted visual atttributes settings.

Aspose.Cells.License license = new Aspose.Cells.License();
license.SetLicense( "Aspose.Cells.lic" );
//Instantiate a new Workbook.
Workbook workbook = new Workbook();
//Set the horizontal scroll bars invisible.
workbook.IsHScrollBarVisible = false;
//Set the vertical scrollbars visible (by default).
workbook.IsVScrollBarVisible = true;
//Get the first worksheet (defauult)in the workbook.
Worksheet worksheet1 = workbook.Worksheets[0];
//Get the cells in the worksheet.
Cells cells = worksheet1.Cells;
//Input data into B2 cell.
cells[1,1].PutValue("Hello World!");
//Add a new worksheet.
int idx = workbook.Worksheets.Add();
//Input some data to it.
workbook.Worksheets[1].Cells["D10"].PutValue("Second Sheet");
//Set the first sheet as an active sheet.
workbook.Worksheets.ActiveSheetIndex = 0;
//Set B2 cell as an active cell in the worksheet.
worksheet1.ActiveCell= "B2";
//Set the B column as the first visible column in the worksheet.
worksheet1.FirstVisibleColumn =1;
//Set the 2nd row as the first visible row in the worksheet.
worksheet1.FirstVisibleRow = 1;
//Save the excel file.

Thank you.

Hello Amjad,

thanks a lot for the answer. It worked.

Michael G. Schneider