Hello to all,
I have to manipulate the Style of a cell of an Excel sheet by code D365, not Ax 2012/09.
I have to change the name of the style and set from 'Normal' (standard style), to 'Heading 1' (existing style in excel).
This is my scenario:
1. OfficeOpenXml.ExcelWorksheets worksheetsExcel;
2. OfficeOpenXml.ExcelWorksheet worksheet;
//create new sheet
3. worksheet = worksheetsExcel.Add("New sheet");
4. var cells = worksheet.get_Cells();
//insert header cell
5. OfficeOpenXml.ExcelRange cell = cells.get_Item("B8:B8");
6. cell.set_Value("Header"); //set the value show in the cell
7. cell.set_styleName("Heading 1"); //set StyleName of cell
8. cell.AutoFitColumns();
//do: extact the excel file
In the 7th line I can try the other code -> cell.StyleName = 'Heading 1'; //but I havn't good result
In debugger I see that the default value of cell.StyleName = 'Normal' and after my change, the value remains the same.
Can anyone tell me if there is another way to manipulate the style of an excel cell?
NB: the code of ax 2012 don't work -> worksheet.range("B8:B8").style('Heading 1');