I am not able to retrieve cell stylename i.e Normal or any custom cell stylename applied on a cell using Aspose.Cellls. Aspose.Cellls.Cell.GetStyle() method always returns null value.
Hi,
//Get the custom style and create a style object.
Style style = workbook.Styles[“styleName”];
How to get the style name as for now I am seeing only styleId in the available property of the cell style. Is there anyway to get the style name from this StyleId ?
Hi,
How to convert the Excel file into Aspose by knowing the Path of excel file where the Excel Styles and everything be preserved ?
Hi,
Hi,Corporateitcompliance:
How to convert the Excel file into Aspose by knowing the Path of excel file where the Excel Styles and everything be preserved ?
Thanks for your posting and using Aspose.Cells for .NET.
We are afraid, it's not very clear what you are trying to achieve. Could you please elaborate your requirements more?
Also, if you want to modify existing Styles, then please see this article.
Hi,
Thanks for your clarification.
You can iterate all the Named Styles in your Excel file using the Workbook.Styles collection.
For your cell B3, if you want to access the Named Style, you can use the Style.Parent property.
Please check the code below that illustrates these things. Please also see the Debug Output of this code at the bottom.
C#
string filePath = @“F:\Shak-Data-RW\Downloads\ExcelFile.xlsx”;
//Create a workbook object from the template file
Workbook workbook = new Workbook(filePath);
Worksheet worksheet = workbook.Worksheets[0];
Cell b3 = worksheet.Cells[“B3”];
Style b3Style = b3.GetStyle();
//This is the parent style which you have applied to cell B3
Style parentStyle = b3Style.ParentStyle;
Debug.WriteLine("B3 Parent Style Name: " + parentStyle.Name);
int styleCount = workbook.Styles.Count;
for (int i = 0; i < styleCount; i++)
{
Style style = workbook.Styles[i];
Debug.WriteLine("Style Name: " + style.Name);
}
B3 Parent Style Name: Style 1
Style Name: Normal
Style Name: Percent
Style Name: Currency
Style Name: Currency [0]
Style Name: Comma
Style Name: Comma [0]
Style Name: Style 1