php生成文档类
2007-07-27 16:17
190 查看
<?php
/**
* educe class for word&excel&txt
* this class is used in all scripts
* do NOT fiddle unless you know what you are doing
*
* Copyright(c) 2007 by qiqi. All rights reserved
*
* To contact the author write to {@link qqi_77@sina.com}
*
* @author qqi77
*
*/
class Educe
{
/**
* description : document educe
*
* @param string $fileName
* @param array $titleName
* @param array $dataName
* @param string $fileMark 0:excel 1:txt 2:word
*/
function documentEduce($fileMark,$fileName,$titleName,$dataName)
{
header("Content-Type: application/vnd.ms-excel");
switch ($fileMark)
{
case 0:
echo header("Content-Disposition: attachment; filename=$fileName.xls");
break;
case 1:
echo header("Content-Disposition: attachment; filename=$fileName.txt");
break;
case 2:
echo header("Content-Disposition: attachment; filename=$fileName.doc");
break;
}
header("Pragma: no-cache");
header("Expires: 0");
$num=count($titleName);
for ($i=0;$i<$num;$i++)
{
echo "".$titleName[$i].""."/t";
}
if ($i==$num)
{
echo "".$titleName[$i].""."/t/n";
}
for ($y=0;$y<$num;$y++)
{
echo "".$dataName[$y].""."/t";
}
if ($y==$num)
{
echo "".$dataName[$y].""."/t/n";
}
}
}
?>
/**
* educe class for word&excel&txt
* this class is used in all scripts
* do NOT fiddle unless you know what you are doing
*
* Copyright(c) 2007 by qiqi. All rights reserved
*
* To contact the author write to {@link qqi_77@sina.com}
*
* @author qqi77
*
*/
class Educe
{
/**
* description : document educe
*
* @param string $fileName
* @param array $titleName
* @param array $dataName
* @param string $fileMark 0:excel 1:txt 2:word
*/
function documentEduce($fileMark,$fileName,$titleName,$dataName)
{
header("Content-Type: application/vnd.ms-excel");
switch ($fileMark)
{
case 0:
echo header("Content-Disposition: attachment; filename=$fileName.xls");
break;
case 1:
echo header("Content-Disposition: attachment; filename=$fileName.txt");
break;
case 2:
echo header("Content-Disposition: attachment; filename=$fileName.doc");
break;
}
header("Pragma: no-cache");
header("Expires: 0");
$num=count($titleName);
for ($i=0;$i<$num;$i++)
{
echo "".$titleName[$i].""."/t";
}
if ($i==$num)
{
echo "".$titleName[$i].""."/t/n";
}
for ($y=0;$y<$num;$y++)
{
echo "".$dataName[$y].""."/t";
}
if ($y==$num)
{
echo "".$dataName[$y].""."/t/n";
}
}
}
?>
相关文章推荐
- PHP生成word文档的三种实现方式
- 利用doxygen生成说明文档(支持C、C++、Java、Objective-C和IDL语言,部分支持PHP、C#)
- PHP 自动生成帮助文档工具1.0Beta版【代码维护神器】
- PHP中使用TCPDF生成PDF文档实例
- php中如何把html中的内容生成到word文档
- PHP 原生代码生成 RSS 文档
- 如何使用phpdoc生成PHP文档
- 使用PHP生成PDF文档
- 用 PHP 代码生成 Flash 文档
- 使用PHP生成PDF文档
- 利用PHP生成静态HTML文档的原理
- php将数据库中所有内容生成静态html文档的代码
- PHPDoc/PHPDocumentor生成API文档
- php 生成word文档并下载代码
- 使用PHP生成PDF文档
- (实用篇)使用PHP生成PDF文档
- PHP生成word文档,表格实例
- TP框架开发的站点使用phpdoctor生成文档注意事项
- PHP文档中怎样自动生成版本信息
- PHPWord利用模板替换字符串生成精确的word文档