ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
PHPExcel_Writer_Excel2007_Comments Class Reference
+ Inheritance diagram for PHPExcel_Writer_Excel2007_Comments:
+ Collaboration diagram for PHPExcel_Writer_Excel2007_Comments:

Public Member Functions

 writeComments (PHPExcel_Worksheet $pWorksheet=null)
 Write comments to XML format. More...
 
 _writeComment (PHPExcel_Shared_XMLWriter $objWriter=null, $pCellReference='A1', PHPExcel_Comment $pComment=null, $pAuthors=null)
 Write comment to XML format. More...
 
 writeVMLComments (PHPExcel_Worksheet $pWorksheet=null)
 Write VML comments to XML format. More...
 
 _writeVMLComment (PHPExcel_Shared_XMLWriter $objWriter=null, $pCellReference='A1', PHPExcel_Comment $pComment=null)
 Write VML comment to XML format. More...
 
- Public Member Functions inherited from PHPExcel_Writer_Excel2007_WriterPart
 setParentWriter (PHPExcel_Writer_IWriter $pWriter=null)
 Set parent IWriter object. More...
 
 getParentWriter ()
 Get parent IWriter object. More...
 
 __construct (PHPExcel_Writer_IWriter $pWriter=null)
 Set parent IWriter object. More...
 

Detailed Description

Definition at line 36 of file Comments.php.

Member Function Documentation

◆ _writeComment()

PHPExcel_Writer_Excel2007_Comments::_writeComment ( PHPExcel_Shared_XMLWriter  $objWriter = null,
  $pCellReference = 'A1',
PHPExcel_Comment  $pComment = null,
  $pAuthors = null 
)

Write comment to XML format.

Parameters
PHPExcel_Shared_XMLWriter$objWriterXML Writer
string$pCellReferenceCell reference
PHPExcel_Comment$pCommentComment
array$pAuthorsArray of authors
Exceptions
PHPExcel_Writer_Exception

Definition at line 103 of file Comments.php.

104 {
105 // comment
106 $objWriter->startElement('comment');
107 $objWriter->writeAttribute('ref', $pCellReference);
108 $objWriter->writeAttribute('authorId', $pAuthors[$pComment->getAuthor()]);
109
110 // text
111 $objWriter->startElement('text');
112 $this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $pComment->getText());
113 $objWriter->endElement();
114
115 $objWriter->endElement();
116 }
$objWriter
getText()
Get Rich text comment.
Definition: Comment.php:140
getAuthor()
Get Author.
Definition: Comment.php:120
getParentWriter()
Get parent IWriter object.
Definition: WriterPart.php:61

References $objWriter, and PHPExcel_Writer_Excel2007_WriterPart\getParentWriter().

Referenced by writeComments().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _writeVMLComment()

PHPExcel_Writer_Excel2007_Comments::_writeVMLComment ( PHPExcel_Shared_XMLWriter  $objWriter = null,
  $pCellReference = 'A1',
PHPExcel_Comment  $pComment = null 
)

Write VML comment to XML format.

Parameters
PHPExcel_Shared_XMLWriter$objWriterXML Writer
string$pCellReferenceCell reference
PHPExcel_Comment$pCommentComment
Exceptions
PHPExcel_Writer_Exception

Definition at line 198 of file Comments.php.

199 {
200 // Metadata
201 list($column, $row) = PHPExcel_Cell::coordinateFromString($pCellReference);
203 $id = 1024 + $column + $row;
204 $id = substr($id, 0, 4);
205
206 // v:shape
207 $objWriter->startElement('v:shape');
208 $objWriter->writeAttribute('id', '_x0000_s' . $id);
209 $objWriter->writeAttribute('type', '#_x0000_t202');
210 $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'));
211 $objWriter->writeAttribute('fillcolor', '#' . $pComment->getFillColor()->getRGB());
212 $objWriter->writeAttribute('o:insetmode', 'auto');
213
214 // v:fill
215 $objWriter->startElement('v:fill');
216 $objWriter->writeAttribute('color2', '#' . $pComment->getFillColor()->getRGB());
217 $objWriter->endElement();
218
219 // v:shadow
220 $objWriter->startElement('v:shadow');
221 $objWriter->writeAttribute('on', 't');
222 $objWriter->writeAttribute('color', 'black');
223 $objWriter->writeAttribute('obscured', 't');
224 $objWriter->endElement();
225
226 // v:path
227 $objWriter->startElement('v:path');
228 $objWriter->writeAttribute('o:connecttype', 'none');
229 $objWriter->endElement();
230
231 // v:textbox
232 $objWriter->startElement('v:textbox');
233 $objWriter->writeAttribute('style', 'mso-direction-alt:auto');
234
235 // div
236 $objWriter->startElement('div');
237 $objWriter->writeAttribute('style', 'text-align:left');
238 $objWriter->endElement();
239
240 $objWriter->endElement();
241
242 // x:ClientData
243 $objWriter->startElement('x:ClientData');
244 $objWriter->writeAttribute('ObjectType', 'Note');
245
246 // x:MoveWithCells
247 $objWriter->writeElement('x:MoveWithCells', '');
248
249 // x:SizeWithCells
250 $objWriter->writeElement('x:SizeWithCells', '');
251
252 // x:Anchor
253 //$objWriter->writeElement('x:Anchor', $column . ', 15, ' . ($row - 2) . ', 10, ' . ($column + 4) . ', 15, ' . ($row + 5) . ', 18');
254
255 // x:AutoFill
256 $objWriter->writeElement('x:AutoFill', 'False');
257
258 // x:Row
259 $objWriter->writeElement('x:Row', ($row - 1));
260
261 // x:Column
262 $objWriter->writeElement('x:Column', ($column - 1));
263
264 $objWriter->endElement();
265
266 $objWriter->endElement();
267 }
$column
Definition: 39dropdown.php:62
static coordinateFromString($pCoordinateString='A1')
Coordinate from string.
Definition: Cell.php:580
static columnIndexFromString($pString='A')
Column index from string.
Definition: Cell.php:782
getMarginTop()
Get top margin (CSS style, i.e.
Definition: Comment.php:220
getWidth()
Get comment width (CSS style, i.e.
Definition: Comment.php:160
getMarginLeft()
Get left margin (CSS style, i.e.
Definition: Comment.php:200
getFillColor()
Get fill color.
Definition: Comment.php:260
getVisible()
Is the comment visible by default?
Definition: Comment.php:240
getHeight()
Get comment height (CSS style, i.e.
Definition: Comment.php:180

References $column, $objWriter, $row, PHPExcel_Cell\columnIndexFromString(), and PHPExcel_Cell\coordinateFromString().

Referenced by writeVMLComments().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeComments()

PHPExcel_Writer_Excel2007_Comments::writeComments ( PHPExcel_Worksheet  $pWorksheet = null)

Write comments to XML format.

Parameters
PHPExcel_Worksheet$pWorksheet
Returns
string XML Output
Exceptions
PHPExcel_Writer_Exception

Definition at line 45 of file Comments.php.

46 {
47 // Create XML writer
48 $objWriter = null;
49 if ($this->getParentWriter()->getUseDiskCaching()) {
51 } else {
53 }
54
55 // XML header
56 $objWriter->startDocument('1.0','UTF-8','yes');
57
58 // Comments cache
59 $comments = $pWorksheet->getComments();
60
61 // Authors cache
62 $authors = array();
63 $authorId = 0;
64 foreach ($comments as $comment) {
65 if (!isset($authors[$comment->getAuthor()])) {
66 $authors[$comment->getAuthor()] = $authorId++;
67 }
68 }
69
70 // comments
71 $objWriter->startElement('comments');
72 $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
73
74 // Loop through authors
75 $objWriter->startElement('authors');
76 foreach ($authors as $author => $index) {
77 $objWriter->writeElement('author', $author);
78 }
79 $objWriter->endElement();
80
81 // Loop through comments
82 $objWriter->startElement('commentList');
83 foreach ($comments as $key => $value) {
84 $this->_writeComment($objWriter, $key, $value, $authors);
85 }
86 $objWriter->endElement();
87
88 $objWriter->endElement();
89
90 // Return
91 return $objWriter->getData();
92 }
$comment
Definition: buildRTE.php:83
const STORAGE_MEMORY
Temporary storage method.
Definition: XMLWriter.php:46
getComments()
Get comments.
Definition: Worksheet.php:2225
_writeComment(PHPExcel_Shared_XMLWriter $objWriter=null, $pCellReference='A1', PHPExcel_Comment $pComment=null, $pAuthors=null)
Write comment to XML format.
Definition: Comments.php:103

References $comment, $objWriter, _writeComment(), PHPExcel_Writer_Excel2007_WriterPart\getParentWriter(), PHPExcel_Shared_XMLWriter\STORAGE_DISK, and PHPExcel_Shared_XMLWriter\STORAGE_MEMORY.

+ Here is the call graph for this function:

◆ writeVMLComments()

PHPExcel_Writer_Excel2007_Comments::writeVMLComments ( PHPExcel_Worksheet  $pWorksheet = null)

Write VML comments to XML format.

Parameters
PHPExcel_Worksheet$pWorksheet
Returns
string XML Output
Exceptions
PHPExcel_Writer_Exception

Definition at line 125 of file Comments.php.

126 {
127 // Create XML writer
128 $objWriter = null;
129 if ($this->getParentWriter()->getUseDiskCaching()) {
131 } else {
133 }
134
135 // XML header
136 $objWriter->startDocument('1.0','UTF-8','yes');
137
138 // Comments cache
139 $comments = $pWorksheet->getComments();
140
141 // xml
142 $objWriter->startElement('xml');
143 $objWriter->writeAttribute('xmlns:v', 'urn:schemas-microsoft-com:vml');
144 $objWriter->writeAttribute('xmlns:o', 'urn:schemas-microsoft-com:office:office');
145 $objWriter->writeAttribute('xmlns:x', 'urn:schemas-microsoft-com:office:excel');
146
147 // o:shapelayout
148 $objWriter->startElement('o:shapelayout');
149 $objWriter->writeAttribute('v:ext', 'edit');
150
151 // o:idmap
152 $objWriter->startElement('o:idmap');
153 $objWriter->writeAttribute('v:ext', 'edit');
154 $objWriter->writeAttribute('data', '1');
155 $objWriter->endElement();
156
157 $objWriter->endElement();
158
159 // v:shapetype
160 $objWriter->startElement('v:shapetype');
161 $objWriter->writeAttribute('id', '_x0000_t202');
162 $objWriter->writeAttribute('coordsize', '21600,21600');
163 $objWriter->writeAttribute('o:spt', '202');
164 $objWriter->writeAttribute('path', 'm,l,21600r21600,l21600,xe');
165
166 // v:stroke
167 $objWriter->startElement('v:stroke');
168 $objWriter->writeAttribute('joinstyle', 'miter');
169 $objWriter->endElement();
170
171 // v:path
172 $objWriter->startElement('v:path');
173 $objWriter->writeAttribute('gradientshapeok', 't');
174 $objWriter->writeAttribute('o:connecttype', 'rect');
175 $objWriter->endElement();
176
177 $objWriter->endElement();
178
179 // Loop through comments
180 foreach ($comments as $key => $value) {
181 $this->_writeVMLComment($objWriter, $key, $value);
182 }
183
184 $objWriter->endElement();
185
186 // Return
187 return $objWriter->getData();
188 }
_writeVMLComment(PHPExcel_Shared_XMLWriter $objWriter=null, $pCellReference='A1', PHPExcel_Comment $pComment=null)
Write VML comment to XML format.
Definition: Comments.php:198

References $objWriter, _writeVMLComment(), PHPExcel_Writer_Excel2007_WriterPart\getParentWriter(), PHPExcel_Shared_XMLWriter\STORAGE_DISK, and PHPExcel_Shared_XMLWriter\STORAGE_MEMORY.

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: