This project has moved and is read-only. For the latest updates, please go here.

Rangecells.Merge method

Aug 17, 2015 at 1:06 PM
Hi,

I'm new to EPPlus and with help of samples and documentation able to create and merge excel rows. But the problem that I face is while merging rows for a column, it shows up merged and if I copy the data to notepad, I see the values repeated for number of rows that were merged.

Please can someone help me on this. Below is part of code that merges the rows.
                    for (int k = startCount; k <= endCount; k++)
                    {
                        string columnName = GetExcelColumnName(k);
                        ExcelRange rangeCells = workSheet.Cells[columnName + startValue + ":" + columnName + endValue];
                        System.Array cellValue = (System.Array)rangeCells.Value;

                        List<string> listCells = cellValue.OfType<string>().ToList();

                        rangeCells.Clear();
                        //Merge the cells.
                        rangeCells.Merge = true;
                        rangeCells.Style.WrapText = true;
                        // Set the value of the cell range with single value
                        rangeCells.Value = listCells.Distinct().FirstOrDefault();
                    }
Thanks,
Prem
Aug 19, 2015 at 10:00 AM
Hi,

Any updates, please or is this a flaw in EPPlus.

Thanks,
Prem
Sep 24, 2015 at 6:48 AM
Hi,

When I unmerge the cells, I see all the values. Is there any way to get proper usage of merge functionality? Any suggestion is also helpful.

Thanks,
Prem