cgomes has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I needed some help finding out which cells are merged in an excel file. I need to know this because I want find a way to extract the row & col indexes to determine the border of the the merged cells.

The article Using Win32::OLE and Excel - Tips and Tricks doesn't mention anything about finding out which cells are merged and how to extract the row & col indexes of the cell.

Therefore can some one provide me with some sort of syntax to work with as I can't find any documentation on this topic.

Thanks!
  • Comment on Win32:: OLE Finding Merged Cells in Excel

Replies are listed 'Best First'.
Re: Win32:: OLE Finding Merged Cells in Excel
by Ratazong (Monsignor) on Nov 24, 2009 at 16:56 UTC
    Hi

    If you have a sheet (e.g. by getting it with the following code)

    my $sheet = $Excel->Workbooks->Open($ARGV[0])->Sheets->item("words");
    you can check a cell by addressing its row/column to get its address:
    $sheet->Range("$col$row")->{'MergeArea'}->{'Address'}
    If the cell is merged, the address will be a range - and contain a colon (:) ... so you only need to check for that :-)


    HTH, Rata
Re: Win32:: OLE Finding Merged Cells in Excel
by Anonymous Monk on Nov 24, 2009 at 16:01 UTC