<div> <button onclick="ExportGridClient('plain')">Export from client to HTML Table</button> <button onclick="ExportGridClient('owc')" id="owc">Export from client to OWC spreadsheet</button> <button onclick="ExportGridServer('xl')">Export from server to Excel</button> <button onclick="ExportGridServer('csv')">Export from server to CSV</button> </div> <?php $numcol = 15; $grid = new SimpleGrid(); $grid->AddHeadingRow(true); for ($c = 1; $c <= $numcol; $c++) { $grid->AddCell("Column {$c}"); } for ($r = 1; $r <= 100; $r++) { $grid->AddDataRow(); $grid->AddCell($r); for ($c = 2; $c <= $numcol; $c++) { $grid->AddCell("Cell {$r}:{$c}"); } } $fmt = isset($_GET["fmt"]) ? $_GET["fmt"] : ""; switch (strtolower($fmt)) { case "xl": $grid->RenderExcel("rico.xls"); break; case "csv": $grid->RenderDelimited("rico.csv", ",", ""); break; default: $grid->Render("ex1", 1);
function DisplayForm() { $grid = new SimpleGrid(); // define heading $grid->AddHeadingRow(true); $grid->AddCell("A"); $grid->AddCell("B"); $grid->AddCell("A + B"); $grid->AddCell("A x B"); // define data for ($r = 3; $r <= 9; $r += 2) { $a = $r; $b = $r - 2; $grid->AddDataRow(); $grid->AddCell($a); $grid->AddCell($b); $grid->AddCell("<input type='text' size='3' name='p_" . $a . "_" . $b . "'>"); $grid->AddCell("<input type='text' size='3' name='t_" . $a . "_" . $b . "'>"); } echo "<div id='explanation'>This example shows how to use a SimpleGrid within a form.</div>"; echo "<p><strong>Try this simple math quiz:</strong>"; echo "<p><form method='post'>"; echo "<input type='hidden' name='action' value='calc_result'>"; echo "<input type='submit' value='Submit Answers'><p>"; $grid->Render("ex1", 2); echo "</form>"; }