1: <?php
2:
3: namespace SimpleExcel\Writer;
4:
5: /**
6: * SimpleExcel class for writing HTML table
7: *
8: * @author Faisalman
9: * @package SimpleExcel
10: */
11: class HTMLWriter extends BaseWriter implements IWriter
12: {
13: /**
14: * Defines content-type for HTTP header
15: *
16: * @access protected
17: * @var string
18: */
19: protected $content_type = 'text/html';
20:
21: /**
22: * Defines file extension to be used when saving file
23: *
24: * @access protected
25: * @var string
26: */
27: protected $file_extension = 'html';
28:
29: /**
30: * Get document content as string
31: *
32: * @param array $options Options
33: * @return string Content of document
34: */
35: public function toString ($options = NULL) {
36: $content = '<table>';
37: foreach ($this->workbook->getWorksheets() as $worksheet) {
38: foreach ($worksheet->getRecords() as $record) {
39: $content .= '
40: <tr>';
41: foreach ($record as $cell) {
42: $content .= '
43: <td>' . $cell->value . '</td>';
44: }
45: $content .= '
46: </tr>';
47: }
48: }
49: return $content.'
50: </table>';
51: }
52: }