rabanti-github / PicoXLSX

PicoXLSX is a small .NET / C# library to create XLSX files (Microsoft Excel 2007 or newer) in an easy and native way
MIT License
52 stars 13 forks source link

Cells' style are not retain when merging cells #9

Closed DCourtel closed 5 years ago

DCourtel commented 5 years ago

Hi, when merging several cells, for which the first has an applied style, the merged cell doesn't have any style applied. The method «ResolveMergedCells» always replace the style of ALL CELLS by the MergeCellStyle (which is empty).

if (pos != 0)
   {
      cell.DataType = Cell.CellType.EMPTY;
   }
   cell.SetStyle(mergeStyle);

To preserve the style of the first cell, it should be:

if (pos != 0)
   {
      cell.DataType = Cell.CellType.EMPTY;
      cell.SetStyle(mergeStyle);
   }
rabanti-github commented 5 years ago

Hi Thank you for the report and the provided fix. The bug was fixed with commit 75cc06e.

All NuGet Packages (PicoXLSX, NanoXlsx) as well as the Java artifacts (PicoXLSX4j, NanoXLSX4j) will be available in a few minutes.

Please let me know if something is not workig as expected.