opened
mnts26
username_0
## Read and complete the full issue template

**Do you want to request a *feature* or report a *bug*?**
- [ x] feature

If you are logging a possible bug or feature request, please test with [the latest development build](https://ci.appveyor.com/project/ClosedXML/ClosedXML/branch/develop/artifacts) first.

**Version of ClosedXML**

e.g. 0.87.1

**What is the current behavior?**
I have following excel files and i want get to know those cells is range. 
![image](https://user-images.githubusercontent.com/331587/39926571-8bde8f3e-556a-11e8-8b7f-d22a13ce39fd.png)


**What is the expected behavior or new feature?**
for example:
CELL: HEADER IS (A1:G4)
          : BODY IS (A5:G15) 
          : FOOTER IS (A16:G21)  


**Did this work in previous versions of our tool?  Which versions?**

No

## Reproducibility
**This is an important section. Read it carefully. Failure to do so will cause a 'RTFM' comment.**


**Code to reproduce problem:**
```c#
public List<List<IXLCell>> TemplateFileLoaderExcel(string path, int sheet_number)
        {
            try
            {
                temp_wb = new XLWorkbook(path);
                temp_wsh = temp_wb.Worksheet(sheet_number);
                IXLRange work_sheet_range = temp_wsh.RangeUsed(true);
                max_row = work_sheet_range.RangeAddress.LastAddress.RowNumber;
                max_col = work_sheet_range.RangeAddress.LastAddress.ColumnNumber;
                for (int row = 1; row <= max_row ; row++)
                {
                    list_of_kjs_cell = new List<IXLCell>();
                    for (int col = 1; col <= max_col ; col++)
                    {
                        IXLCell cell = temp_wsh.Cell(row, col); 
                         // In here how to get that cell is range?
                        
                    }
                }
                temp_wb.Dispose();
            }
            catch (System.IO.IOException e)
            {
                Console.WriteLine(e.Message);
            }
        }
```
- [ ] I attached a sample spreadsheet.  (You can drag files on to this issue)
To get merged cell's range.
issue
created
Pankraty
username_1
On the latest version you can to do this:
`temp_wsh.MergedRanges.GetIntersectedRanges(cell.Address).FirstOrDefault();`

On previous version there should be 
`temp_wsh.MergedRanges.Where(r => r.Contains(cell)).FirstOrDefault();`

It is less efficient but works too.
comment
created
igitur
username_2
I think we should add some helper methods to make this easier.
comment
created
igitur
username_2
Oh, I see there is already a `cell.MergedRange()`. @username_0 I think that's exactly what you're looking for. Just upgrade to latest version.
comment
created
igitur
username_2
@username_1 `XLCell.MergedRange()` 's implementation should probably be updated to use `GetIntersectedRanges`, right?
comment
created
Pankraty
username_1
You are right. After I implemented this method I searched all the occurences of `Intersects`, but should also check `Contains` method.
comment
created
mnts26
username_0
@username_1 @username_2  Thank you guys that exactly what i looked for. Sorry guys i've one more question how to inserting picture into merged cells. (about size )
comment
created
mnts26
username_0
I mean how to insert a picture to BODY IS (A5:G15). Image is resized.
comment
created
mnts26
username_0
**Code to reproduce problem:**
```c#
 for (int row = 1; row <= max_row; row++)
            {
                for (int col = 1; col <= max_col; col++)
                {
                    IXLCell cell = temp_wsh.Cell(row, col);
                    if (cell.IsMerged() && !string.IsNullOrEmpty(cell.GetString()) && cell.GetString().Contains("%"))
                    {
                        int row_id = temp_wsh.MergedRanges.Where(r => r.Contains(cell)).FirstOrDefault().FirstRowUsed().RowNumber();
                        int col_id = temp_wsh.MergedRanges.Where(r => r.Contains(cell)).FirstOrDefault().LastColumn().ColumnNumber();
                        var imagePath = @"C:\temp\cando.png";
                        using (FileStream strm = new FileStream(imagePath, FileMode.Open))
                        {
                            XLPicture pic = new XLPicture { ImageStream = strm, Name = "test image" };
                            pic.NoResize=false;
                            pic.NoChangeAspect=false;
                            pic.NoMove=false;
                              pic.AddMarker(new XLMarker 
                            { 
                              // START POINT.
                                ColumnId = temp_wsh.MergedRanges.Where(r => r.Contains(cell)).FirstOrDefault().FirstColumnUsed().ColumnNumber(),
                                RowId = temp_wsh.MergedRanges.Where(r => r.Contains(cell)).FirstOrDefault().FirstRowUsed().RowNumber()
                             // i want End Point too.
                             ....................

                            });
                            var markers = pic.GetMarkers();
                            Console.WriteLine("markers : " + markers.ToString());
                            temp_wsh.AddPicture(pic);
                        }
                     }
                  }
            }
            temp_wb.Dispose();
        }
```
Here is my result
![pic](https://user-images.githubusercontent.com/331587/39966647-6178146e-56ea-11e8-881c-55c7e4dafcad.png)

But actually i want

![pic1](https://user-images.githubusercontent.com/331587/39966654-82a3f61c-56ea-11e8-9968-5eb9f13438a4.png)
comment
created
igitur
username_2
Please create separate issues for separate problems.
comment
created
mnts26
username_0
@username_2 #847 created.
comment
created
mnts26
username_0
This is issue is resolved.
comment
closed
igitur
username_2
issue