Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GoogleCodeExporter opened this issue Apr 21, 2016 · 1 comment

Comments

@GoogleCodeExporter
Copy link

 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 [email protected] on 8 Jul 2009 at 10:38

@GoogleCodeExporter
Copy link
Author

I seem to be having issues as well.

Original comment by [email protected] on 8 Dec 2009 at 4:42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant