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

Free Support Forum - aspose.com

Copy font style and color from one cell to another is not working

Result.png (4.6 KB)
Template.png (4.4 KB)
Hi aspose Team,
we are copying cell text from above cell to newly inserted cells , but font color is not coping into newly inserted cells.Text is coming in black color. I am using below code.

CurrentWorksheet.Cells.InsertRows(idesRow - Constants.ONE, DataTableRows - rowStart);
Row row = CurrentWorksheet.Cells.Rows[startRowsIndex];

                for (int irow = idesRow - Constants.ONE; irow <= startRowsIndex + DataTableRows - Constants.ONE; irow++)
                    foreach (var iResultSet in reportColumns)
                        string dataValue = row[iResultSet.ColumnNumber].Value == null ? string.Empty : row[iResultSet.ColumnNumber].Value.ToString();
                        CurrentWorksheet.Cells[irow, iResultSet.ColumnNumber].PutValue(dataValue);

                        if (row[iResultSet.ColumnNumber].Value != null)
                            Style s = cells.GetCellStyle(startRowsIndex, iResultSet.ColumnNumber);
                            StyleFlag styleFlag = new StyleFlag();
                            styleFlag.All = true;
                            styleFlag.FontColor = true;
                            CurrentWorksheet.Cells[irow, iResultSet.ColumnNumber].SetStyle(s, styleFlag);


This is an urgent requirement for us, plz response ASAP.


Thanks for the code segment and screenshots.

We cannot evaluate your issue as we cannot compile your code segment due to your data/template file and other objects for which we are not sure. Please create a standalone console demo application, zip the project and post us here to reproduce the issue. Also, attach your template file(s). Moreover, please remove any interdependence to external data source or file, so we could execute your code seamlessly. This will help us evaluate your issue precisely and consequently figure it out soon.