Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]

   1  <?php
   2  
   3  namespace PhpOffice\PhpSpreadsheet\Writer\Ods\Cell;
   4  
   5  use PhpOffice\PhpSpreadsheet\Cell\Cell;
   6  use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
   7  
   8  /**
   9   * @category   PhpSpreadsheet
  10   *
  11   * @copyright  Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
  12   * @author     Alexander Pervakov <frost-nzcr4@jagmort.com>
  13   */
  14  class Comment
  15  {
  16      public static function write(XMLWriter $objWriter, Cell $cell)
  17      {
  18          $comments = $cell->getWorksheet()->getComments();
  19          if (!isset($comments[$cell->getCoordinate()])) {
  20              return;
  21          }
  22          $comment = $comments[$cell->getCoordinate()];
  23  
  24          $objWriter->startElement('office:annotation');
  25          $objWriter->writeAttribute('svg:width', $comment->getWidth());
  26          $objWriter->writeAttribute('svg:height', $comment->getHeight());
  27          $objWriter->writeAttribute('svg:x', $comment->getMarginLeft());
  28          $objWriter->writeAttribute('svg:y', $comment->getMarginTop());
  29          $objWriter->writeElement('dc:creator', $comment->getAuthor());
  30          $objWriter->writeElement('text:p', $comment->getText()->getPlainText());
  31          $objWriter->endElement();
  32      }
  33  }