本文整理汇总了PHP中Spreadsheet_Excel_Reader::dump方法的典型用法代码示例。如果您正苦于以下问题:PHP Spreadsheet_Excel_Reader::dump方法的具体用法?PHP Spreadsheet_Excel_Reader::dump怎么用?PHP Spreadsheet_Excel_Reader::dump使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spreadsheet_Excel_Reader
的用法示例。
在下文中一共展示了Spreadsheet_Excel_Reader::dump方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: excelreader
public function excelreader()
{
$this->load->library('Spreadsheet_Excel_Reader.php');
$data = new Spreadsheet_Excel_Reader("./data/example01.xls");
// $data = json_decode('{$data}',true);
echo $data->dump(true, true);
}
示例2: showFormat
public function showFormat()
{
//get the link of the file
$file = new Files($this->formatfile_id);
$path = $file->fileWithPath();
if (preg_match("/xlsx\$/", $file->originalname) != 0) {
Yii::import('application.vendors.simplexlsx.*');
$xlsx = new SimpleXLSX($excelfile);
return $xlsx->dump();
} else {
if (preg_match("/xls\$/", $file->originalname) != 0) {
Yii::import('application.vendors.php-excel-reader.*');
$xls = new Spreadsheet_Excel_Reader($excelfile);
return $xls->dump();
}
}
}
示例3: integrationExcel
public function integrationExcel()
{
$controller = $this->config();
echo "<br />Excel Spreadsheet<br/>";
echo $spreadsheet = $controller->buildExcelTable(1, 1, 1, 1, 1, 1, array(1989, 1992));
$data = new Spreadsheet_Excel_Reader($spreadsheet);
echo $data->dump(true, true);
}
示例4: actionLogin
/**
* Displays the login page
*/
public function actionLogin()
{
$data = new Spreadsheet_Excel_Reader("example.xls");
echo $data->dump(true, true);
$model = new LoginForm();
// if it is ajax validation request
if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
echo CActiveForm::validate($model);
Yii::app()->end();
}
// collect user input data
if (isset($_POST['LoginForm'])) {
$model->attributes = $_POST['LoginForm'];
// validate user input and redirect to the previous page if valid
if ($model->validate() && $model->login()) {
$this->redirect(Yii::app()->user->returnUrl);
}
}
// display the login form
$this->render('login', array('model' => $model));
}
示例5: utf8_decode
// echo "<tr>";
// for($coluna=0; $coluna<=10; $coluna++){ //Navega na coluna
// if($linha == 2){
// echo "<th>".utf8_decode($dataPhp->getActiveSheet()->getCellByColumnAndRow($coluna, $linha)->getValue()); // Atualiza com caracteres especiais;
// echo "</th>";
// }else{
// echo "<td>".utf8_decode($dataPhp->getActiveSheet()->getCellByColumnAndRow($coluna, $linha)->getValue()); // Atualiza com caracteres especiais;
// echo "</td>";
// }
//// $dataPhp->getActiveSheet()->getCellByColumnAndRow($coluna, $linha)->getValue();//Chama as linhas e colunas;
// }
// echo "</tr>";
//}
//echo "</table>";
//LEITURA EXCEL 1
echo utf8_decode($data->dump(true, true));
//LEITURA CSV
//$delimitador = ',';
//$cerca = '"';
//
//// Abrir arquivo para leitura
//$f = fopen('semana421.csv', 'r');
//if ($f) {
//
// // Ler cabecalho do arquivo
// $cabecalho = fgetcsv($f, 0, $delimitador, $cerca);
//
// // Enquanto nao terminar o arquivo
// while (!feof($f)) {
//
// // Ler uma linha do arquivo
示例6: explode
if ($_FILES['file']['error'] == 0) {
$file = explode(".", $_FILES['file']['name']);
$extension = array_pop($file);
/* echo "<script type='text/javascript'> alert('".$extension."'); </script>"; */
if (in_array($extension, $allowed_extensions)) {
$source = $_FILES['file']['tmp_name'];
$t = "Subjective" . time() . "" . date('Ymd') . ".xls";
$target = $upload_path . "/" . $t;
$tempUploadedValue = move_uploaded_file($source, $target);
if ($tempUploadedValue) {
/* echo "<script type='text/javascript'> alert('test1'); </script>"; */
if (($handle = fopen($upload_path . '/' . $t, "r")) !== false) {
$_FILES['file']['name'];
$expiryDate = $_POST['expiryDate'];
$data = new Spreadsheet_Excel_Reader($upload_path . '/' . $t);
$data->dump(true, true);
$data_array = array();
for ($i = 1; $i <= $data->rowcount(); $i++) {
$data_array[$i] = array();
for ($j = 1; $j <= $data->colcount(); $j++) {
$data_array[$i][$j] = $data->val($i, $j);
}
// inner For
}
// outer For
$myFile = $t;
$url = "./excelfiles/" . $t;
$newUploadedQuizURL = $newBaseURL . "/excelfiles/" . str_replace(' ', '%20', $myFile);
$newQuizName = $_POST['questionFileName'];
$newQuizFileName = $myFile;
$duration = $_POST['hours'] * 3600 + $_POST['minutes'] * 60;
示例7: actionImport
public function actionImport()
{
$model = new A();
if (isset($_POST['A'])) {
Yii::import('ext.phpexcelreader.excel_reader2', true);
$model->attributes = $_POST['A'];
$import = CUploadedFile::getInstance($model, 'filee');
if ($import == null) {
Yii::app()->user->setFlash('error', 'File Kosong');
$this->redirect(array(''));
} else {
$import->saveAs('coba/' . $import);
}
if ($import->type == "application/ynd.ms.excel") {
$data = new Spreadsheet_Excel_Reader('/../controller/coba1.xls/');
echo $data->dump(true, true);
$id = array();
$nama = array();
for ($j = 2; $j <= $data->rowcount(); $j++) {
if (empty($data->sheets[0]['cells'][$j][1]) || empty($data->sheets[0]['cells'][$j][2])) {
Yii::app()->user->setFlash('error', 'Data Gagal di Import (File excel harus diisi semua)');
$id[$j] = null;
$nama[$j] = null;
} else {
$id[$j] = $data->sheets[0]['cells'][$j][1];
$nama[$j] = $data->sheets[0]['cells'][$j][2];
}
}
$niki = $data->rowcount(0);
for ($i = 1; $i < $niki; $i++) {
$model = new A();
$model->id = $id[$i];
$model->nama = $nama[$i];
$model2 = A::model()->findByPk($id[$i]);
if ($model2 != null) {
Yii::app()->user->setFlash('error', 'Data Gagal di Import (NIDN sudah ada sebelumnya)');
$this->redirect(array('import'));
} else {
$model->save();
}
}
$this->redirect(array('index'));
} else {
Yii::app()->user->setFlash('error', 'Format file tidak dikenali (format file harus .xls)');
$this->redirect(array('import'));
}
}
$this->render('import', array('model' => $model));
/* $model = new A();
if (isset($_POST['A'])) {
$model->attributes = $_POST['A'];
$itu = CUploadedFile::getInstance($model, 'filee');
$path = 'coba1.xls';
//$itu->saveAs($path);
$data = new Spreadsheet_Excel_Reader('coba1.xls');
}*/
}
示例8:
function parse_xls_file($params)
{
$params = $params[0];
Common::inc_module_factory('ExcelReader', true);
$data = new Spreadsheet_Excel_Reader(PATH_ . $params['xls_file']);
return $data->dump(false, false, 0, $params['class']);
}
示例9:
table.excel tbody td {
vertical-align:bottom;
}
table.excel tbody td {
padding: 0 3px;
border: 1px solid #EEEEEE;
}
</style>
</head>
<body>
<?php
$row = 0;
$col = 0;
echo '<table>';
for ($row = 0; $row < 5; $row++) {
echo '<tr>';
for ($col = 0; $col < 5; $col++) {
echo '<td>';
echo $data->val($row, $col);
echo '</td>';
}
echo '</tr>';
}
echo '</table>';
echo $data->dump(true, true);
echo $data->dump(true, true);
?>
</body>
</html>
示例10: elseif
}
if ($type == 'w') {
return str_replace($conv['utf'], $conv['win'], $str);
} elseif ($type == 'u') {
return str_replace($conv['win'], $conv['utf'], $str);
} else {
return $str;
}
}
if (isset($_POST["act"])) {
require_once 'excel_reader2.php';
$data = new Spreadsheet_Excel_Reader($_FILES['fname']["tmp_name"]);
if ($_POST["clearall"] == 'clearall') {
print "<script>importexcelDialog.clear()</script>";
}
print "<script>importexcelDialog.insert('<p>" . str_replace("\\'", "\\\\'", str_replace("\n", "", Encode($data->dump(false, false, 0, 'price'), 'w'))) . "</p>')</script>";
}
?>
Загрузите файл для вставки в код:
<input type="file" name="fname">
<input type="hidden" name="act" value="send"><br>
<input type="checkbox" name="clearall" checked=checked value="clearall" id="clearall"><label for="clearall">Очистить содержимое перед вставкой</label>
</br>
<div class="mceActionPanel">
<div style="float: left">
<input type="submit" id="insert" name="insert" value="Вставить" onclick="" />
</div>
<div style="float: right">
示例11: array
}), array('db' => '3', 'dt' => 4, 'formatter' => function ($d, $row) {
return substr(html_entity_decode(htmlspecialchars_decode($d, ENT_NOQUOTES)), 0, 15) . "...";
}), array('db' => '4', 'dt' => 5, 'formatter' => function ($d, $row) {
return substr(html_entity_decode(htmlspecialchars_decode($d, ENT_NOQUOTES)), 0, 15) . "...";
}));
$where = "id_kategori = {$id}";
$datatable->get_table($table, $primaryKey, $columns, $where);
break;
case 'view':
ini_set('memory_limit', '-1');
$filesave = $purifier->purify($_POST['filename']);
$data = new Spreadsheet_Excel_Reader($path_upload . $filesave);
echo '<html>
<head>
<title>Sistem Informasi Pelaporan | Ristek Dikti</title>
<link rel="shortcut icon" type="image/png" href="' . $url_rewrite . "static/dist/img/risetdikti.png" . '"/>
<style>
table.excel {border-style:ridge;border-width:1;border-collapse:collapse;font-family:sans-serif;font-size:12px;}
table.excel thead th, table.excel tbody th {background:#CCCCCC;border-style:ridge;border-width:1;text-align: center;vertical-align:bottom;}
table.excel tbody th {text-align:center;width:20px;}
table.excel tbody td {vertical-align:bottom;}
table.excel tbody td {padding: 0 3px;border: 1px solid #EEEEEE;}
</style>
</head>
<body>' . $data->dump(true, true, 1) . '</body>
</html>';
break;
default:
$utility->location_goto(".");
break;
}
示例12: json_encode
<?php
/**
* Argumentos
* $argv[0] Archivo php actual
* $argv[1] Archivo excel
* $argv[2] Hoja
* $argv[3] Patrond e separación para hojas
*/
include "excel_reader2.php";
$data = new Spreadsheet_Excel_Reader($argv[1]);
$sheets = array();
for ($i = 0; $i < count($data->sheets); $i++) {
$sheets[] = $data->boundsheets[$i]['name'];
}
echo json_encode($sheets);
echo $argv[3];
echo $data->dump(true, true, $argv[2]);
示例13: buildExcelHTML
private function buildExcelHTML($spreadsheetFile)
{
$data = new Spreadsheet_Excel_Reader($spreadsheetFile);
return $data->dump(true, true);
}