1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PhpSpreadsheet\Writer\OpenDocument\Cell; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* PhpSpreadsheet |
7
|
|
|
* |
8
|
|
|
* Copyright (c) 2006 - 2015 PhpSpreadsheet |
9
|
|
|
* |
10
|
|
|
* This library is free software; you can redistribute it and/or |
11
|
|
|
* modify it under the terms of the GNU Lesser General Public |
12
|
|
|
* License as published by the Free Software Foundation; either |
13
|
|
|
* version 2.1 of the License, or (at your option) any later version. |
14
|
|
|
* |
15
|
|
|
* This library is distributed in the hope that it will be useful, |
16
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
17
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
18
|
|
|
* Lesser General Public License for more details. |
19
|
|
|
* |
20
|
|
|
* You should have received a copy of the GNU Lesser General Public |
21
|
|
|
* License along with this library; if not, write to the Free Software |
22
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
23
|
|
|
* |
24
|
|
|
* @category PhpSpreadsheet |
25
|
|
|
* @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) |
26
|
|
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
27
|
|
|
* @version ##VERSION##, ##DATE## |
28
|
|
|
*/ |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @category PhpSpreadsheet |
32
|
|
|
* @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) |
33
|
|
|
* @author Alexander Pervakov <[email protected]> |
34
|
|
|
*/ |
35
|
|
|
class Comment |
36
|
|
|
{ |
37
|
|
|
public static function write(\PhpSpreadsheet\Shared\XMLWriter $objWriter, \PhpSpreadsheet\Cell $cell) |
38
|
|
|
{ |
39
|
|
|
$comments = $cell->getWorksheet()->getComments(); |
40
|
|
|
if (!isset($comments[$cell->getCoordinate()])) { |
41
|
|
|
return; |
42
|
|
|
} |
43
|
|
|
$comment = $comments[$cell->getCoordinate()]; |
44
|
|
|
|
45
|
|
|
$objWriter->startElement('office:annotation'); |
46
|
|
|
$objWriter->writeAttribute('svg:width', $comment->getWidth()); |
47
|
|
|
$objWriter->writeAttribute('svg:height', $comment->getHeight()); |
48
|
|
|
$objWriter->writeAttribute('svg:x', $comment->getMarginLeft()); |
49
|
|
|
$objWriter->writeAttribute('svg:y', $comment->getMarginTop()); |
50
|
|
|
$objWriter->writeElement('dc:creator', $comment->getAuthor()); |
51
|
|
|
$objWriter->writeElement('text:p', $comment->getText()->getPlainText()); |
52
|
|
|
$objWriter->endElement(); |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|