Exemplo n.º 1
0
function getData($sheet)
{
    $users[$sheet['numCols'] - 1][3] = array();
    $user_task_counts[$sheet['numCols'] - 1][$sheet['numRows'] - 3] = array();
    $x = 1;
    while ($x <= $sheet['numRows']) {
        $y = 1;
        while ($y <= $sheet['numCols']) {
            if ($x == 1) {
                if ($y <= 3) {
                    $titles[] = $sheet['cells'][$x][$y];
                } else {
                    $tasks[] = $sheet['cells'][$x][$y];
                }
            } else {
                if ($y <= 3) {
                    $users[$x - 2][$y - 1] = $sheet['cells'][$x][$y];
                } else {
                    $user_task_counts[$x - 2][$y - 4] = $sheet['cells'][$x][$y];
                }
            }
            $y++;
        }
        $x++;
    }
    sheetData($sheet, $titles, $tasks, $users, $user_task_counts);
}
Exemplo n.º 2
0
            $re .= " <td>{$cell}</td>\n";
            $y++;
        }
        $re .= "</tr>\n";
        $x++;
    }
    return $re . '</table>';
    // ends and returns the html table
}
$nr_sheets = count($excel->sheets);
// gets the number of sheets
$excel_data = '';
// to store the the html tables with data of each sheet
// traverses the number of sheets and sets html table with each sheet data in $excel_data
for ($i = 0; $i < $nr_sheets; $i++) {
    $excel_data .= '<h4>Sheet ' . ($i + 1) . ' (<em>' . $excel->boundsheets[$i]['name'] . '</em>)</h4>' . sheetData($excel->sheets[$i]) . '<br/>';
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Example PHP Excel Reader</title>
<style type="text/css">
table {
 border-collapse: collapse;
}        
td {
 border: 1px solid black;
 padding: 0 0.5em;
}        
Exemplo n.º 3
0
            $re .= " <td>{$cell}</td>\n";
            $y++;
        }
        $re .= "</tr>\n";
        $x++;
    }
    return $re . '</table>';
    // ends and returns the html table
}
$nr_sheets = count($excel->sheets);
// gets the number of sheets
$excel_data = '';
// to store the the html tables with data of each sheet
// traverses the number of sheets and sets html table with each sheet data in $excel_data
//for($i=0; $i<$nr_sheets; $i++) {
$excel_data .= sheetData($excel->sheets[0]);
//}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Example PHP Excel Reader</title>
<style type="text/css">
table {
 border-collapse: collapse;
}        
td {
 border: 1px solid black;
 padding: 0 0.5em;
}