From f748220f0f6ecf9e881966b987aa241cd34118f1 Mon Sep 17 00:00:00 2001 From: skodak Date: Fri, 22 Dec 2006 10:37:02 +0000 Subject: [PATCH] MDL-7996 Add ods export support - row height implemented --- lib/odslib.class.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/lib/odslib.class.php b/lib/odslib.class.php index e6c87e2c65..2e2dc6d13d 100644 --- a/lib/odslib.class.php +++ b/lib/odslib.class.php @@ -249,7 +249,8 @@ class MoodleODSWorksheet { * @param integer $level The optional outline level (0-7) */ function set_row($row, $height, $format = 0, $hidden = false, $level = 0) { - //not defined yet + $this->rows[$row] = new object(); + $this->rows[$row]->height = $height; } /* Sets the width (and other settings) of one column @@ -427,6 +428,7 @@ function get_ods_content(&$worksheets) { // find out the size of worksheets and used formats $formats = array(); $formatstyles = ''; + $rowstyles = ''; $colstyles = ''; foreach($worksheets as $wsnum=>$ws) { @@ -443,6 +445,19 @@ function get_ods_content(&$worksheets) { } } + foreach($ws->rows as $rnum=>$row) { + if ($rnum > $ws->maxr) { + $ws->maxr = $rnum; + } + //define all column styles + if (!empty($ws->rows[$rnum])) { + $rowstyles .= ' + + + '; + } + } + foreach($ws->columns as $cnum=>$col) { if ($cnum > $ws->maxc) { $ws->maxc = $cnum; @@ -468,6 +483,7 @@ function get_ods_content(&$worksheets) { '; $buffer .= $formatstyles; +$buffer .= $rowstyles; $buffer .= $colstyles; $buffer .= ' @@ -492,7 +508,11 @@ $buffer .= $colstyles; // print all rows for($r=0; $r<=$ws->maxr; $r++) { - $buffer .= ''."\n"; + if (!empty($ws->rows[$r])) { + $buffer .= ''."\n"; + } else { + $buffer .= ''."\n"; + } for($c=0; $c<=$ws->maxc; $c++) { if (isset($ws->data[$r][$c])) { if ($ws->data[$r][$c]->type == 'date') { -- 2.39.5