Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 39 and 311]

   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   * @author     Alexander Pervakov <frost-nzcr4@jagmort.com>
  10   */
  11  class Comment
  12  {
  13      public static function write(XMLWriter $objWriter, Cell $cell): void
  14      {
  15          $comments = $cell->getWorksheet()->getComments();
  16          if (!isset($comments[$cell->getCoordinate()])) {
  17              return;
  18          }
  19          $comment = $comments[$cell->getCoordinate()];
  20  
  21          $objWriter->startElement('office:annotation');
  22          $objWriter->writeAttribute('svg:width', $comment->getWidth());
  23          $objWriter->writeAttribute('svg:height', $comment->getHeight());
  24          $objWriter->writeAttribute('svg:x', $comment->getMarginLeft());
  25          $objWriter->writeAttribute('svg:y', $comment->getMarginTop());
  26          $objWriter->writeElement('dc:creator', $comment->getAuthor());
  27          $objWriter->writeElement('text:p', $comment->getText()->getPlainText());
  28          $objWriter->endElement();
  29      }
  30  }