Hi,
I'm trying to clone a cellstyle using CloneStyleFrom however, it doesn't appear to be working as expected.
When I modify the 'cloned' style, the original cell style is also modified.
FYI - I'm using Version 2.1.3.0
Other than that - excellent work and thanks!
Code snippet...
```
private void Test()
{
IWorkbook workbook = new XSSFWorkbook();
sheet = workbook.CreateSheet("Sheet A1");
ICell cell = sheet.CreateRow(0).CreateCell(0);
cell.SetCellValue(1.00);
ICellStyle cellStyle = workbook.CreateCellStyle();
IDataFormat fmt = workbook.CreateDataFormat();
short xx = fmt.GetFormat("0.00");
cellStyle.DataFormat = xx;
cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thick;
cellStyle.BottomBorderColor = 8;
cell.CellStyle = cellStyle;
ICellStyle cellStyle2 = workbook.CreateCellStyle();
cellStyle2.CloneStyleFrom(cellStyle);
//Below change also affects cellStyle...
cellStyle2.BorderBottom = NPOI.SS.UserModel.BorderStyle.None;
FileStream sw = File.Create("cellStyler.xlsx");
workbook.Write(sw);
sw.Close();
}
```
Comments: ** Comment from web user: tonyqus **
I'm trying to clone a cellstyle using CloneStyleFrom however, it doesn't appear to be working as expected.
When I modify the 'cloned' style, the original cell style is also modified.
FYI - I'm using Version 2.1.3.0
Other than that - excellent work and thanks!
Code snippet...
```
private void Test()
{
IWorkbook workbook = new XSSFWorkbook();
sheet = workbook.CreateSheet("Sheet A1");
ICell cell = sheet.CreateRow(0).CreateCell(0);
cell.SetCellValue(1.00);
ICellStyle cellStyle = workbook.CreateCellStyle();
IDataFormat fmt = workbook.CreateDataFormat();
short xx = fmt.GetFormat("0.00");
cellStyle.DataFormat = xx;
cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thick;
cellStyle.BottomBorderColor = 8;
cell.CellStyle = cellStyle;
ICellStyle cellStyle2 = workbook.CreateCellStyle();
cellStyle2.CloneStyleFrom(cellStyle);
//Below change also affects cellStyle...
cellStyle2.BorderBottom = NPOI.SS.UserModel.BorderStyle.None;
FileStream sw = File.Create("cellStyler.xlsx");
workbook.Write(sw);
sw.Close();
}
```
Comments: ** Comment from web user: tonyqus **
maybe something wrong with the instance object. A new object should be created. I'll check.