Quantcast
Channel: EPPlus Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 2262

Commented Unassigned: Not possible to unmerge in 4.0.1 [15134]

$
0
0
Dears,
It is no longer possible use Merge property to unmerge a range:

In version 4.0.1 (In ExcelRangeBase.cs):

> ExcelRange.Merge = false

has same effect as

> ExcelRange.Merge = true

Should there be other way how to unmerge? Or it is planned to be added? Or it is a bug?

Thank you

Meanwhile I have updated the setter of Merge property in my project to code below:

```
set
{
IsRangeValid("merging");
//SetMerge(value, FirstAddress);
if (!value)
{
if (_worksheet.MergedCells.Contains(FirstAddress))
{
_worksheet.MergedCells.Remove(FirstAddress);
}
else
{
throw (new ArgumentException("Range is not merged"));
}
if (Addresses != null)
{
foreach (var address in Addresses)
{
if (_worksheet.MergedCells.Contains(address.Address))
{
_worksheet.MergedCells.Remove(address.Address);
}
else
{
throw (new ArgumentException("Range is not merged"));
}
}
}
}
else
{
_worksheet.MergedCells.Add(new ExcelAddressBase(FirstAddress), true);
if (Addresses != null)
{
foreach (var address in Addresses)
{
_worksheet.MergedCells.Add(address, true);
//SetMerge(value, address._address);
}
}
}
}
```
Comments: You are right the get is not solved :) Actually I have not tried to find the final solution as I belive it should be written somewhere else (probably in MergedCells new Remove which would do similar check as Add). For me the most important was to point on the problem. Not sure why Clear should be called (the data from the first cell should be visible in the merged cells). If there are data in other cells they should be cleaned before calling the merge.

Viewing all articles
Browse latest Browse all 2262

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>