You are here

class Sheetnode_PHPExcel_HTML2RichText in Sheetnode 5

Same name and namespace in other branches
  1. 6 modules/sheetnode_phpexcel/html2richtext.inc \Sheetnode_PHPExcel_HTML2RichText
  2. 7.2 modules/sheetnode_phpexcel/html2richtext.inc \Sheetnode_PHPExcel_HTML2RichText
  3. 7 modules/sheetnode_phpexcel/html2richtext.inc \Sheetnode_PHPExcel_HTML2RichText

Hierarchy

Expanded class hierarchy of Sheetnode_PHPExcel_HTML2RichText

File

modules/sheetnode_phpexcel/sheetnode_phpexcel.export.inc, line 389

View source
class Sheetnode_PHPExcel_HTML2RichText extends TCPDF {
  var $html;
  public function Sheetnode_PHPExcel_HTML2RichText($html) {
    $this->html = $html;
    $this
      ->setPageUnit('px');
  }
  public function convert($cell, $style) {
    $dom = $this
      ->getHtmlDomArray($this->html);
    if (empty($dom)) {
      return FALSE;
    }
    $rtf = new PHPExcel_RichText();
    $run = $rtf
      ->createTextRun();
    foreach ($dom as $entry) {
      if ($entry['tag']) {

        // HTML tag
        if (!$entry['opening']) {
          continue;
        }

        // Defer the work to third-party implementations.
        module_invoke_all('sheetnode_phpexcel_html2richtext', $run, $cell, $style, $entry, $this);
      }
      else {

        // text
        if (empty($entry['value'])) {
          continue;
        }
        $run
          ->setText($entry['value']);
        $run = $rtf
          ->createTextRun();
      }

      //drupal_alter('sheetnode_phpexcel_html2richtext', $run, $cell, $style, $entry, $this);
    }
    return $rtf;
  }

}

Members