You are here

public function PHPExcel_Writer_Excel2007_Comments::_writeVMLComment in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel2007/Comments.php \PHPExcel_Writer_Excel2007_Comments::_writeVMLComment()

* Write VML comment to XML format * *

Parameters

PHPExcel_Shared_XMLWriter $objWriter XML Writer: * @param string $pCellReference Cell reference * @param PHPExcel_Comment $pComment Comment * @throws PHPExcel_Writer_Exception

1 call to PHPExcel_Writer_Excel2007_Comments::_writeVMLComment()
PHPExcel_Writer_Excel2007_Comments::writeVMLComments in vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel2007/Comments.php
* Write VML comments to XML format * *

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel2007/Comments.php, line 198

Class

PHPExcel_Writer_Excel2007_Comments
PHPExcel_Writer_Excel2007_Comments

Code

public function _writeVMLComment(PHPExcel_Shared_XMLWriter $objWriter = null, $pCellReference = 'A1', PHPExcel_Comment $pComment = null) {

  // Metadata
  list($column, $row) = PHPExcel_Cell::coordinateFromString($pCellReference);
  $column = PHPExcel_Cell::columnIndexFromString($column);
  $id = 1024 + $column + $row;
  $id = substr($id, 0, 4);

  // v:shape
  $objWriter
    ->startElement('v:shape');
  $objWriter
    ->writeAttribute('id', '_x0000_s' . $id);
  $objWriter
    ->writeAttribute('type', '#_x0000_t202');
  $objWriter
    ->writeAttribute('style', 'position:absolute;margin-left:' . $pComment
    ->getMarginLeft() . ';margin-top:' . $pComment
    ->getMarginTop() . ';width:' . $pComment
    ->getWidth() . ';height:' . $pComment
    ->getHeight() . ';z-index:1;visibility:' . ($pComment
    ->getVisible() ? 'visible' : 'hidden'));
  $objWriter
    ->writeAttribute('fillcolor', '#' . $pComment
    ->getFillColor()
    ->getRGB());
  $objWriter
    ->writeAttribute('o:insetmode', 'auto');

  // v:fill
  $objWriter
    ->startElement('v:fill');
  $objWriter
    ->writeAttribute('color2', '#' . $pComment
    ->getFillColor()
    ->getRGB());
  $objWriter
    ->endElement();

  // v:shadow
  $objWriter
    ->startElement('v:shadow');
  $objWriter
    ->writeAttribute('on', 't');
  $objWriter
    ->writeAttribute('color', 'black');
  $objWriter
    ->writeAttribute('obscured', 't');
  $objWriter
    ->endElement();

  // v:path
  $objWriter
    ->startElement('v:path');
  $objWriter
    ->writeAttribute('o:connecttype', 'none');
  $objWriter
    ->endElement();

  // v:textbox
  $objWriter
    ->startElement('v:textbox');
  $objWriter
    ->writeAttribute('style', 'mso-direction-alt:auto');

  // div
  $objWriter
    ->startElement('div');
  $objWriter
    ->writeAttribute('style', 'text-align:left');
  $objWriter
    ->endElement();
  $objWriter
    ->endElement();

  // x:ClientData
  $objWriter
    ->startElement('x:ClientData');
  $objWriter
    ->writeAttribute('ObjectType', 'Note');

  // x:MoveWithCells
  $objWriter
    ->writeElement('x:MoveWithCells', '');

  // x:SizeWithCells
  $objWriter
    ->writeElement('x:SizeWithCells', '');

  // x:Anchor

  //$objWriter->writeElement('x:Anchor', $column . ', 15, ' . ($row - 2) . ', 10, ' . ($column + 4) . ', 15, ' . ($row + 5) . ', 18');

  // x:AutoFill
  $objWriter
    ->writeElement('x:AutoFill', 'False');

  // x:Row
  $objWriter
    ->writeElement('x:Row', $row - 1);

  // x:Column
  $objWriter
    ->writeElement('x:Column', $column - 1);
  $objWriter
    ->endElement();
  $objWriter
    ->endElement();
}