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

Free Support Forum - aspose.com

How to apply Aspose.Words.Style to Aspose.cells.style

Hi


I would like to know how to apply Aspose.Words.Style to Aspose.cells.style?

Thanks

This message was posted using Email2Forum by babar.raza.

Hi Ajeesh,


Thanks for your inquiry. I think, in your case, you can not cast Aspose.Words.Style object to Aspose.Cells.Style instance directly. Instead, you can create a new Aspose.Cells.Style based on Aspose.Words.Style as follows:

// Get the
desired Aspose.Words style
<o:p></o:p>

Aspose.Words.Style wordStyle = doc.Styles[0];

//Instantiating a Workbook object

Workbook workbook = new Workbook();

//Adding a new Style to the styles collection of the Excel object

int i = workbook.Styles.Add();

//Accessing the newly added Style to the Excel object

Aspose.Cells.Style style = workbook.Styles[i];

//Setting the font color of the text in the "A1" cell

style.Font.Color = wordStyle.Font.Color;

style.Font.Size = (int)wordStyle.Font.Size;


I hope, this will help.

Best Regards,