Comment.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. /**
  8. * PHPExcel_Writer_OpenDocument_Cell_Comment
  9. *
  10. * @category PHPExcel
  11. * @package PHPExcel_Writer_OpenDocument
  12. * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
  13. * @author Alexander Pervakov <frost-nzcr4@jagmort.com>
  14. */
  15. class PHPExcel_Writer_OpenDocument_Cell_Comment
  16. {
  17. public static function write(PHPExcel_Shared_XMLWriter $objWriter, PHPExcel_Cell $cell)
  18. {
  19. $comments = $cell->getWorksheet()->getComments();
  20. if (!isset($comments[$cell->getCoordinate()])) {
  21. return;
  22. }
  23. $comment = $comments[$cell->getCoordinate()];
  24. $objWriter->startElement('office:annotation');
  25. //$objWriter->writeAttribute('draw:style-name', 'gr1');
  26. //$objWriter->writeAttribute('draw:text-style-name', 'P1');
  27. $objWriter->writeAttribute('svg:width', $comment->getWidth());
  28. $objWriter->writeAttribute('svg:height', $comment->getHeight());
  29. $objWriter->writeAttribute('svg:x', $comment->getMarginLeft());
  30. $objWriter->writeAttribute('svg:y', $comment->getMarginTop());
  31. //$objWriter->writeAttribute('draw:caption-point-x', $comment->getMarginLeft());
  32. //$objWriter->writeAttribute('draw:caption-point-y', $comment->getMarginTop());
  33. $objWriter->writeElement('dc:creator', $comment->getAuthor());
  34. // TODO: Not realized in PHPExcel_Comment yet.
  35. //$objWriter->writeElement('dc:date', $comment->getDate());
  36. $objWriter->writeElement('text:p', $comment->getText()->getPlainText());
  37. //$objWriter->writeAttribute('draw:text-style-name', 'P1');
  38. $objWriter->endElement();
  39. }
  40. }