本文整理匯總了PHP中Spreadsheet_Excel_Reader::setDefaultFormat方法的典型用法代碼示例。如果您正苦於以下問題:PHP Spreadsheet_Excel_Reader::setDefaultFormat方法的具體用法?PHP Spreadsheet_Excel_Reader::setDefaultFormat怎麽用?PHP Spreadsheet_Excel_Reader::setDefaultFormat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Spreadsheet_Excel_Reader
的用法示例。
在下文中一共展示了Spreadsheet_Excel_Reader::setDefaultFormat方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: fopen
// "Uploading " . $_FILES['userfile']['name'] . " to here: " . $_FILES['userfile']['tmp_name'] . "<br>";
if (preg_match('/^(.*)\\.xls$/', $_FILES['userfile']['name'], $matches) != 1) {
print "Please upload an Excel file conforming to the Dialogix Structure";
} else {
$uploadDir = '/usr/local/tomcat554/webapps/OMH/WEB-INF/schedules/';
$instrument = $matches[1] . ".txt";
$uploadFile = $uploadDir . $instrument;
/* so that uploaded file is TSV equivalent of Excel file */
// print "Uploading to file $uploadFile<br>";
require_once 'Excel/reader.php';
error_reporting(E_ALL ^ E_NOTICE);
// ExcelFile($filename, $encoding);
$data = new Spreadsheet_Excel_Reader();
// Set output Encoding.
$data->setOutputEncoding('CP1251');
$data->setDefaultFormat('%s');
$data->setColumnFormat(3, '%s');
$data->read($_FILES['userfile']['tmp_name']);
$handle = fopen($uploadFile, "w");
/* replace file of same name */
if (!$handle) {
print "Unable to create file <i>{$uploadFile}</i>";
} else {
/* N.B. When reads in "true" or "false", converts to 1 and 0, even if set default format.
So, if a reserved word, must convert back */
for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++) {
$row = '';
for ($j = 1; $j <= $data->sheets[0]['numCols']; $j++) {
if ($j > 1) {
$row .= "\t";
}