rameshnaidupolarapu / php-excel-reader

Automatically exported from code.google.com/p/php-excel-reader
0 stars 0 forks source link

with the dump function, the width of your excel columns are not set as they should in resulting html code #34

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
 When you choose to not display col letters...
__________________________
$data = new Spreadsheet_Excel_Reader($fileurl);
echo $data->dump(false,false);
__________________________

the width of your excel columns are not kept

Solution :
587:    function dump($row_numbers=false,$col_letters=false,
$sheet=0,$table_class='excel') {
586:            $out = "<table class=\"$table_class\" cellspacing=0>";
++              if ($row_numbers) {
++                              $out .= "\n\t\t<col></col>";
++                      }
++              for($i=1;$i<=$this->colcount($sheet);$i++) {
++                              $style = "width:" .
($this->colwidth($i,$sheet)*1) . "px;";
++                              if ($this->colhidden($i,$sheet)) {
++                                      $style .= "display:none;";
++                              }
++                              $out .= "\n\t\t<col style=\"$style\"> </ col>";
++                      }
589:            if ($col_letters) {
590:                    $out .= "<thead>\n\t<tr>";
591:                    if ($row_numbers) {
592:                            $out .= "\n\t\t<th>&nbsp</th>";
593:                    }
594:                    for($i=1;$i<=$this->colcount($sheet);$i++) {
595:                            $style = "width:" .
($this->colwidth($i,$sheet)*1) . "px;";
596:                            if ($this->colhidden($i,$sheet)) {
597:                                    $style .= "display:none;";
598:                            }
599:                            $out .= "\n\t\t<th style=\"$style\">" .
strtoupper($this-
>colindexes[$i]) . "</th>";

600:                    }
601:                    $out .= "</tr></thead>\n";
602:            }

remark : here we take advantage of the <col> tag for setting column
widths. 

Original issue reported on code.google.com by wilfrid....@gmail.com on 8 Jul 2009 at 10:38

GoogleCodeExporter commented 8 years ago
I seem to be having issues as well.

Original comment by TheRedO...@gmail.com on 8 Dec 2009 at 4:42