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: ¿and how it solves the get? :)
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: ¿and how it solves the get? :)