本文整理汇总了PHP中Spreadsheet_Excel_Reader::setColumnFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP Spreadsheet_Excel_Reader::setColumnFormat方法的具体用法?PHP Spreadsheet_Excel_Reader::setColumnFormat怎么用?PHP Spreadsheet_Excel_Reader::setColumnFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spreadsheet_Excel_Reader
的用法示例。
在下文中一共展示了Spreadsheet_Excel_Reader::setColumnFormat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fopen
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";
}
if ($j == 3) {