echo "<th>" . $row . "</th>"; for ($col = 0; $col < $max_cols; $col++) { $cellId = chr(0x41 + $col) . $row; echo "<td width=100 class='cell'>"; echo "<form id='form_{$cellId}' action='" . Root::i()->getVar('wroot') . "?Act=saveCell&sheet={$sheet}&cell_id={$cellId}' method='POST' onSubmit='return false;' style='margin:0; padding:0;'>"; $input_source = preg_replace("/\"/", """, MyExcel::getCellSource($sheet, $cellId)); //echo "<input name='content' class='cellinput' title='$cellId' type='text' value=\"".$input_source."\" id='$cellId' onkeypress='inputKeyPress(this, event)'>"; echo "<textarea rows='10' cols='40' name='content' class='cellinput' title='{$cellId}' type='text' id='{$cellId}' onkeypress='inputKeyPress(this, event)'>" . $input_source . "</textarea>"; echo "</form>"; echo "<div onclick='onCellClick(\"{$cellId}\")' id='{$cellId}_value' style='min-height:20px;white-space: nowrap;'>" . MyExcel::getCellValue($sheet, $cellId) . "</div>"; echo "</td>"; } echo "</tr>"; } echo "</table>"; } function saveCell() { $sheet = get_current_sheet(); $cell_id = $this->_get("cell_id"); $new_content = $this->_post("content"); $new_content = stripslashes($new_content); //$new_content = iconv('utf-8','windows-1251',$new_content); $new_content = trim($new_content); MyExcel::setCellSource($sheet, $cell_id, $new_content); echo MyExcel::getCellValue($sheet, $cell_id); } } $c = new CCC(); $c->_bind();