PDF, formulas and cell-properties (formatting)

Topics: Developer Forum, Project Management Forum, User Forum
Apr 17, 2009 at 8:29 AM
Edited Apr 17, 2009 at 8:46 AM
Hi. I created PDF and Excel7 files.
And it seems there are some problems with cell-properties in PDF.

The first problem:
cells C7:C10 and E7:E10 are calculated with the code like this:
elseif ($dbField == 't_share')
{
    $t_share = $grouppedArray_val_val['t_share'];
    if ($t_share != "")
    {
        $decimals = ($t_share>=1) ? "0" : "00";
        $objPHPExcel->getActiveSheet()->setCellValue($columnLetter.($ind+$prevRowsCount), "=B".($ind+$prevRowsCount)."/B". ($grouppedArrayLen+6+$prevRowsCount));
        $objPHPExcel->getActiveSheet()->duplicateStyleArray(
                array('alignment'     => array('horizontal' =>     PHPExcel_Style_Alignment::HORIZONTAL_CENTER),
                      'numberformat' => array('code'       =>   "0.$decimals%")         ),
                $columnLetter.($ind+$prevRowsCount)
        );
    }
}

In excel cell-property it shows as a percent format. But in PDF it doesn't multiplied by 100

The second problem is that formatting like in excel in cells B7:B10, D7:D10, F8:F10 isn't similar to formatting in PDF. You can view it on screenshots below.
B-column (D-column is almost the same):
$objPHPExcel->getActiveSheet()->duplicateStyleArray(
        array('alignment'     => array('indent'  => 1,  'horizontal'  =>     PHPExcel_Style_Alignment::HORIZONTAL_RIGHT),
              'numberformat' => array('code'    => '#,##0.000')         ),
        $columnLetter.($ind+$prevRowsCount)
);

F-column
$objPHPExcel->getActiveSheet()->duplicateStyleArray(
        array('alignment'     => array('horizontal' =>     PHPExcel_Style_Alignment::HORIZONTAL_CENTER),
              'numberformat' => array('code'       => '$ #,##0.00')         ),
        $columnLetter.($ind+$prevRowsCount)
);


And the third problem is that cell-properties like borders are not set in PDF although it sets in Excel.
May be setShowGridLines(false); in some ways affect borders not showing in PDF?

Screenshots that illustrate the problems 1-2:
PDF     http://img17.imageshack.us/img17/2899/pdfg.jpg
Excel7  http://img144.imageshack.us/img144/4885/excel7.jpg

Screenshots that illustrate the problems 3:
PDF     http://img21.imageshack.us/img21/923/pdfv2.jpg
Excel7  http://img15.imageshack.us/img15/381/excel7v2.jpg
Developer
Apr 18, 2009 at 7:59 AM
Work item created for problem 1:
http://phpexcel.codeplex.com/WorkItem/View.aspx?WorkItemId=9793

Work item created  for problem 2:
http://phpexcel.codeplex.com/WorkItem/View.aspx?WorkItemId=9794

As for problem 3, waiting for TCPDF to support CSS border-style property.
https://sourceforge.net/tracker/index.php?func=detail&aid=2747689&group_id=128076&atid=710535

Apr 20, 2009 at 6:21 AM
you're scaring me :)
I got "work item created" almost on every my post :))
Sep 24, 2009 at 5:50 AM

Is there any update news for Problem 3 (PDF cell border) ?  
Or Is there any work around to show cell border in pdf ?

Developer
Sep 24, 2009 at 2:29 PM
zawmn83 wrote:

Is there any update news for Problem 3 (PDF cell border) ?  
Or Is there any work around to show cell border in pdf ?

There is still no way to have borders in PDF export. Unfortunately. Still waiting for external library TCPDF to implement this.

Feb 2, 2010 at 1:30 PM

and still waiting for borders-support in tcpdf...

Feb 3, 2010 at 11:58 AM

I got a problem. It's illustrated above (in screenshots of 'problem 1-2' from the first post).

PDF     http://img17.imageshack.us/img17/2899/pdfg.jpg
Excel7  http://img144.imageshack.us/img144/4885/excel7.jpg

I have indent=1 in cells B7:B10, D7:D10. Indents are appear in Excel, but there are no indents in PDF.

Is it a known problem?

Developer
Feb 20, 2010 at 11:52 PM
azriman wrote:

I got a problem. It's illustrated above (in screenshots of 'problem 1-2' from the first post).

PDF     http://img17.imageshack.us/img17/2899/pdfg.jpg
Excel7  http://img144.imageshack.us/img144/4885/excel7.jpg

I have indent=1 in cells B7:B10, D7:D10. Indents are appear in Excel, but there are no indents in PDF.

Is it a known problem?

I see what you mean. I just checked that TCPDF does not support padding. I was hoping that it did. Guess it has to be implemented using spaces   in HTML.