Free Support Forum - aspose.com

Regarding formatting

Hi,

I have default template which I am copying to my worksheet. I am unable to format the data which is in worksheet using style. for example Style style = new Style(); style.isBold = true; cell1.setstyle(style) style is not applying to cell “cell1”. Please suggest the solution

Hi,


I have tested your scenario and it works fine. I created a new workbook, create the style and specify the font attribute (set bold etc.), apply the style, and finally save the workbook. I don’t find any issue with the output file (attached).

Here is my sample code:

Sample code:

//Instantiating a Workbook object
Workbook workbook = new Workbook();

Worksheet worksheet = workbook.Worksheets[0];
Cells cells = worksheet.Cells;

//Adding the current system date to “A1” cell
Aspose.Cells.Cell cell = cells[“A1”];
cell.PutValue(“Hello…”);

//Setting the format of the cell.
Style style = new Style();
style.Font.IsBold = true;
cell.SetStyle(style);

workbook.Save(“e:\test2\outformattingcell.xlsx”);

Thank you.

Hi,


I am facing problem when I am copying a worksheet of other workbook to my workbook. After copying, I am populating the values and giving format to particular text.

for example: m_objExcelWorkSheet.Copy(m_objExcelCopyWorkSheet)
here m_objExcelWorkSheet is my workbook sheet and m_objExcelCopyWorkSheet is the workbook- worksheet which I have copied to my worksheet

Hi,


We cannot evaluate your issue unless we have your template Excel file(s) and source runnable code. Please create a console demo application, zip it and post it here with all the files. We will check your issue soon.

Thank you.