[0000290] Can't upload files
[fa-stable.git] / reporting / includes / excel_report.inc
index 15b63c472db807f74fa2c12ac25a1b37d4336d11..7356da84c3188944cd321901d7a9f496ca59512c 100644 (file)
@@ -53,6 +53,7 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook
        var $formatHeaderRight;
        var $formatFooter;
        var $formatAmount = array();
+       var $headerFunc;
        
        var $sheet;
 
@@ -166,9 +167,16 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook
                $this->formatFooter =& $this->addFormat();
                $this->formatFooter->setTop(2);
                $this->formatFooter->setTopColor('gray');
+               $this->SetHeaderType("header");
        }
        
 
+       /*
+               Set header handler
+       */
+       function SetHeaderType($name) {
+               $this->headerFunc = $name;
+       }
        // Check a given name to see if it's a valid Excel worksheet name,
        // and fix if necessary
        function worksheetNameGenerator($name)
@@ -523,6 +531,7 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook
 
        function TextCol($c, $n, $txt, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=0)
        {
+               $txt = html_entity_decode($txt);        
                if ($this->aligns[$c] == 'right')
                        $this->sheet->writeString($this->y, $c, $txt, $this->formatRight);
                else    
@@ -556,6 +565,7 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook
 
        function TextCol2($c, $n, $txt, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=0)
        {
+               $txt = html_entity_decode($txt);        
                $this->sheet->writeString($this->y, $c, $txt, $this->formatLeft);
                if ($n - $c > 1)
                        $this->sheet->mergeCells($this->y, $c, $this->y, $n - 1);
@@ -632,7 +642,8 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook
        
        function NewPage()
        {
-               return;
+               if (method_exists($this, $this->headerFunc))    // draw predefined page layout if any
+                       $this->{$this->headerFunc}();
        }
        
        function ymd2Date($year, $mon, $day) // XLS internal date representation is a number between 1900-01-01 and 2078-12-31
@@ -677,6 +688,7 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook
 
        function End($email=0, $subject=null, $myrow=null, $doctype = 0)
        {
+               ++$this->y;
                for ($i = 0; $i < $this->numcols; $i++)
                        $this->sheet->writeBlank($this->y, $i, $this->formatFooter);
                $this->sheet->mergeCells($this->y, 0, $this->y, $this->numcols - 1);