Style namespace?

Hello, I’m testing aspose.excel .
But I have errors when using Style.

What’s namespace must I use (unsing …)

I’ve done using aspose.excel and have add reference aspose.excel.

Please help.

What’s the error? Is it “‘Style’ is an ambiguous reference.”?

If yes, I think your program is a web application.

In a web application, VS.net cannot distinguish it from System.Web.UI.WebControls.Style class. You have to write your code like this:

[C#]
Aspose.Excel.Style styleObj;

[VB]
Dim styleObj as Aspose.Excel.Style

@GoraExcel,
Aspose.Cells has replaced Aspose.Excel that is no more continued now. This new product has provided all the latest features available in different versions of MS Excel. You can format the cells by adding borders to a cell and a range of cells. Colors and palettes related features provide options to set custom colors to palettes along with the option to set colors and back grounds.

Here is an example that can be used to set borders in a worksheet.

// 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 first (default) worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[0];

// Accessing the "A1" cell from the worksheet
Aspose.Cells.Cell cell = worksheet.Cells["B2"];

// Adding some value to the "A1" cell
cell.PutValue("Visit Aspose!");

// Create a style object
Style style = cell.GetStyle();

// Setting the line style of the top border
style.Borders[BorderType.TopBorder].LineStyle = CellBorderType.Thick;

// Setting the color of the top border
style.Borders[BorderType.TopBorder].Color = Color.Black;

// Setting the line style of the bottom border
style.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thick;

// Setting the color of the bottom border
style.Borders[BorderType.BottomBorder].Color = Color.Black;

// Setting the line style of the left border
style.Borders[BorderType.LeftBorder].LineStyle = CellBorderType.Thick;

// Setting the color of the left border
style.Borders[BorderType.LeftBorder].Color = Color.Black;

// Setting the line style of the right border
style.Borders[BorderType.RightBorder].LineStyle = CellBorderType.Thick;

// Setting the color of the right border
style.Borders[BorderType.RightBorder].Color = Color.Black;

// Apply the border styles to the cell
cell.SetStyle(style);

// Saving the Excel file
workbook.Save("book1.out.xls");

Follow the below link to get more information about Style and cells formatting:
Cells Formatting
Format Cells using GetStyle and SetStyle Methods
Conditional Formatting
Apply Advanced Conditional Formatting

Here you will find the latest version of this new product which can be freely downloaded for trials:
Aspose.Cells for .NET (Latest Version)

A detailed runnable solution is prepared which can be used to test the product features without writing any code. It can be downloaded here.