Prev
EELink class
ExcelExplorer Manual Next
Absolute


EELink::Type

(ExcelExplorer 4.0)

Get hyperlink type.

integer Type(  )
Parameters
None
Description

Returns hyperlink type. Possible values are:

Constant Description
EE_LINK_URL Hyperlink contains an URL. E-Mail addresses, HTTP and FTP links uses this type. Always contains absolute URL.
EE_LINK_FILE Hyperlink to a local file. The URL can be absolute or relative to a workbook location.
EE_LINK_WORKBOOK Hyperlink within current workbook or sheet. For instance "Sheet1!A1:B2".
EE_LINK_UNC Hyperlink to a file with UNC. Used for files in the local network. For instance "\\myserver\myshare\myfile.xls".

Worksheet used in the example below:

A B C
1
2 http://www.google.com/
3 C:\AUTOEXEC.BAT
4 ..\..\file.txt
5 mailto:example@example.com?subject=Subject
6 Sheet1!A1
7 file.xls#Sheet1!A1
8 \\server\share\file.txt
9

Print links types from the worksheet above


<?php


$area 
$ee->Worksheet(0)->UsedArea();
if( 
$area !== false ) {

  for( 
$col $area->FirstColumn(); $col <= $area->LastColumn(); $col++ ) {
    for( 
$row $area->FirstRow(); $row <= $area->LastRow(); $row++ ) {

      
$link $ee->Cell(0,$col,$row)->Link();
      if( 
$link !== false ) {

        echo 
'Link in column '.$col.', row '.$row.' have type ';
        switch( 
$link->Type() ) {
          case 
EE_LINK_URL:
            echo 
'EE_LINK_URL';
            break;
          case 
EE_LINK_FILE:
            echo 
'EE_LINK_FILE';
            break;
          case 
EE_LINK_WORKBOOK:
            echo 
'EE_LINK_WORKBOOK';
            break;
          case 
EE_LINK_UNC:
            echo 
'EE_LINK_UNC';
            break;
          default:
            echo 
'Unknown';
            break;
        }
        echo 
"\n";

      }

    }
  }

}

?>

Will output:

Link in column 1, row 1 have type EE_LINK_URL
Link in column 1, row 2 have type EE_LINK_FILE
Link in column 1, row 3 have type EE_LINK_FILE
Link in column 1, row 4 have type EE_LINK_URL
Link in column 1, row 5 have type EE_LINK_WORKBOOK
Link in column 1, row 6 have type EE_LINK_FILE
Link in column 1, row 7 have type EE_LINK_UNC

 
Prev
EELink class
Home
Up
Next
Absolute

 
© 2002-2009 EEPHP.com
All Rights Reserved.