jasonrogena / jasonrogena/php-excel-reader
Code to dump only part of sheet or all the sheet
- Dominant language
- PHP
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
```
I added 4 more prams to optionally cut out only part of a sheet in a dump.
it adds nice functionality to simply display only part of a sheet.
---snip---
// DUMP AN HTML TABLE OF THE ENTIRE OR PART OF XLS DATA
// =========================================
function
dump($row_numbers=false,$col_letters=false,$sheet=0,$table_class='excel',$startr
ow=1,$endrow=0,$startcol=1,$endcol=0)
{
$out = "";
if ($endcol == 0 ){
$endcol = $this->colcount($sheet);
}
if($endrow ==0){
$endrow = $this->rowcount($sheet);
}
if ($col_letters) {
$out .= "\n\t";
if ($row_numbers) {
$out .= "\n\t\t";
}
for($i=$startcol;$i<=$endcol;$i++) {
$style = "width:" . ($this->colwidth($i,$sheet)*1) . "px;";
if ($this->colhidden($i,$sheet)) {
$style .= "display:none;";
}
$out .= "\n\t\t";
}
$out .= "\n";
}
$out .= "\n";
for($row=$startrow;$row<=$endrow;$row++) {
$rowheight = $this->rowheight($row,$sheet);
$style = "height:" . ($rowheight*(4/3)) . "px;";
if ($this->rowhidden($row,$sheet)) {
$style .= "display:none;";
}
$out .= "\n\t";
if ($row_numbers) {
$out .= "\n\t\t";
}
for($col=$startcol;$col<=$endcol;$col++) {
// Account for Rowspans/Colspans
$rowspan = $this->rowspan($row,$col,$sheet);
$colspan = $this->colspan($row,$col,$sheet);
for($i=0;$i<$rowspan;$i++) {
for($j=0;$j<$colspan;$j++) {
if ($i>0 || $j>0) {
$this->sheets[$sheet]['cellsInfo'][$row+$i][$col+$j]['dontprint']=1;
}
}
}
if(!$this->sheets[$sheet]['cellsInfo'][$row][$col]['dontprint']) {
$style = $this->style($row,$col,$sheet);
if ($this->colhidden($col,$sheet)) {
$style .= "display:none;";
}
$out .= "\n\t\t";
}
}
$out .= "\n";
}
$out .= " " .
strtoupper($this->colindexes[$i]) . "$row 1?"
colspan=$colspan":"") . ($rowspan > 1?" rowspan=$rowspan":"") . ">";
$val = $this->val($row,$col,$sheet);
if ($val=='') { $val=" "; }
else {
$val = htmlentities($val);
$link = $this->hyperlink($row,$col,$sheet);
if ($link!='') {
$val = "$val";
}
}
$out .= "".nl2br($val)."";
$out .= "";
return $out;
}
---snip---
```
Original issue reported on code.google.com by `christop...@zionsbancorp.com` on 30 Mar 2009 at 9:06
Contributor guide
No contributing guide indexed for this repository
Research direction
Locate the dump function shown in the issue and compare its current parameters and sheet iteration with the requested row and column bounds. Verify that supplying start and end rows or columns limits the generated HTML table, while the default values still dump the entire sheet.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100