Hi,
I have updated from the version 2.4.2.0 to the version 2.8.6.1 and I’m having the following problems:
-
The method ‘SetActiveSheet’ of the object ‘Worksheets’ does not exist.
-
The property ‘Orientation’ of the object ‘Style’ does not exists.
-
When I try to open the ‘Api reference’ I’m obtaining the following error:
Cannot open the file: md:@MSITStore:c:\program files\aspose\aspose.excel\help\aspose.excel.chm
Please, can you help me?
Thanks in advance
Enric.
Hi Enric,
SetActiveSheet method is replaced with Worksheets.ActiveSheetIndex property.
http://www.aspose.com/Products/Aspose.Excel/Api/Aspose.Excel.Worksheets.ActiveSheetIndex.html
Style.Orientation property is replaced with Style.Rotation property.
http://www.aspose.com/Products/Aspose.Excel/Api/Aspose.Excel.CellFormat.Rotation.html
@e.boadaa3software,
Aspose.Excel is discarded and is replaced with Aspose.Cells. This new product contains a lot of features to access worksheets in a variety of ways including access to active worksheet. Similarly, you can set text rotation using the the Style object’s RotationAngle property. Here is an example to set active worksheet programatically.
//Open the excel file.
Workbook workbook = new Workbook();
//Declare a Worksheet object.
Worksheet newWorksheet;
//Add 5 new worksheets to the workbook and fill some data
//into the cells.
for (int i = 0; i < 5; i++)
{
//Add a worksheet to the workbook.
newWorksheet = workbook.Worksheets[workbook.Worksheets.Add()];
//Name the sheet.
newWorksheet.Name = "New_Sheet" + (i + 1).ToString();
//Get the Cells collection.
Cells cells = newWorksheet.Cells;
//Input a string value to a cell of the sheet.
cells[i, i].PutValue("New_Sheet" + (i + 1).ToString());
}
//Activate the first worksheet by default.
workbook.Worksheets.ActiveSheetIndex = 0;
//Save As the excel file.
workbook.Save("out_My_Book1.xls");
Similarly to set the orientation of the text, refer to the following sample code:
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Instantiating a Workbook object
Workbook workbook = new Workbook();
// Obtaining the reference of the worksheet
Worksheet worksheet = workbook.Worksheets[0];
// Accessing the "A1" cell from the worksheet
Aspose.Cells.Cell cell = worksheet.Cells["A1"];
// Adding some value to the "A1" cell
cell.PutValue("Visit Aspose!");
// Setting the horizontal alignment of the text in the "A1" cell
Style style = cell.GetStyle();
// Setting the rotation of the text (inside the cell) to 25
style.RotationAngle = 25;
cell.SetStyle(style);
// Saving the Excel file
workbook.Save(dataDir + "book1.out.xls", SaveFormat.Excel97To2003);
Refer to the following article for more information on orientation and alignment:
Configuring Alignment Settings
Here are the links to documents for more details about adding, accessing, and removing worksheets from a workbook :
Manage Worksheets
Worksheets
Download the free trial version of this product from the following link
Aspose.Cells for .NET(Latest version)
You can download a runnable project here that can be used to test multiple features of this product without writing any code.