jquery教程

推荐列表 站点导航

当前位置:首页 > jquery > jquery教程 >

php使用phpword生成word文档

来源:网络整理  作者:  发布时间:2020-12-20 20:28
php使用phpword生成word文档...
date_default_timezone_set("Asia/Shanghai");//设置一个时区

// Define cell style arrays
$c = "前三日雨量报表";
// Add image elements
// Save File
$table->addCell(2300)->addText($arr["STCD"]);
$table->addRow();
}else if($arr["STTP"] == 'ZB'){
}

// Add table style

/**********文本格式的word text.php************/
}else{

$fileName = "word报表".date("YmdHis");
}else if($arr["STTP"] == 'ZZ'){
// Define font style for first row
$section->addText($c, 'rStyle', 'pStyle');

if($arr["STTP"] == 'MM'){

$content="根据市气象局未来24小时降雨预报和市水利局实时降雨数据,市国土资源局进行了地质灾害预报,请有关部门关注

require_once '../libs/PHPWord/PHPWord.php';
}else if($arr["STTP"] == 'ZG'){
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
}else{

mssql_select_db($config['mssql']['dbname'],$conn);

// Add row设置行高

$table->addCell(2300, $styleCell)->addText('站码', $fontStyle);

/******地质灾害*******/
}else if($arr["STTP"] == 'SS'){
$res=mssql_query($sql);

$table->addCell(2300)->addText($arr["STNM"]);
$section = $PHPWord->createSection();
$table->addCell(2300, $styleCell)->addText('水文站监测类型', $fontStyle);

header("Content-type: application/vnd.ms-word");
$PHPWord->addFontStyle('rStyle', array('bold'=>false, 'italic'=>false, 'size'=>16));
require_once '../../config.php';
}else if($arr["STTP"] == 'BB'){
}else if($arr["STTP"] == 'DD'){
$table->addCell(2300)->addText('堰闸水文站');
$section->addTextBreak(2);

$styleTable = array('borderSize'=>6, 'borderColor'=>'006699', 'cellMargin'=>80);
}else if($arr["STTP"] == 'DP'){
$sql = "EXEC HNOW05_GETPPSPACE '','','".$stm."',1,1";
$table->addCell(2300, $styleCell)->addText('站名', $fontStyle);
$table->addCell(2300)->addText('蒸发站');
$table->addCell(2300)->addText('墒情站');
$tm=date('Y-m-d H:i:s');
 

header('Cache-Control: max-age=0');
$fontStyle = array('bold'=>true, 'align'=>'center');
}else if($arr["STTP"] == 'TT'){

}
// New portrait section

$table->addCell(2300)->addText('分洪水位站');
$table->addCell(2300)->addText('雨量站');
$objWriter->save('php://output');
$table->addCell(2300)->addText('泵站');

注意:要将PHPWord\PHPWord\Template.php中的setValue方法下的编码改成$replace = iconv('gbk', 'utf-8',$replace);其他的文件也要改成这种样式的。否则出现中文乱码。

实时预警信息,做好地质灾害防范工作";
//echo $arr["STCD"]."</br>";
$table->addCell(2300)->addText('河道水位水文站');
$table->addRow(500);

$PHPWord->addFontStyle('rStyle', array('bold'=>false, 'italic'=>false, 'size'=>16));
$section->addText($content);
header("Content-Disposition:attachment;filename=".$fileName.".docx");

// Add table
if(in_array('3', $a, TRUE)){
$a = explode(',',$arr);
$section->addText($c, 'rStyle', 'pStyle');

$PHPWord->addParagraphStyle('pStyle', array('align'=>'center', 'spaceAfter'=>100));
$arr = $_REQUEST['arr'];
$PHPWord->addFontStyle('rStyle', array('bold'=>true, 'italic'=>true, 'size'=>16));
$section = $PHPWord->createSection();
// require_once '../common/conn.php';

//设置标题
}else if($arr["STTP"] == 'RR'){
$table->addCell(2300)->addText($arr["P"]);
$styleFirstRow = array('borderBottomSize'=>18, 'borderBottomColor'=>'0000FF', 'bgColor'=>'66BBFF');

$table->addCell(2300)->addText('落潮位站');
$PHPWord->addParagraphStyle('pStyle', array('align'=>'center', 'spaceAfter'=>100));

$styleCell = array('valign'=>'center');
require_once '../libs/PHPWord/PHPWord/IOFactory.php';
}

while($arr = mssql_fetch_array($res)){
}else if($arr["STTP"] == 'PP'){
if(in_array('1', $a, TRUE)){
$table->addCell(2300)->addText('地下水站');
$table->addCell(2300, $styleCell)->addText('雨量', $fontStyle);
?>

//逗号 分割字符串

$conn = mssql_connect($config['mssql']['host'],$config['mssql']['user'],$config['mssql']['password']);
$PHPWord->addTableStyle('myOwnTableStyle', $styleTable, $styleFirstRow);

$stm = date('Y-m-d H:i:s',strtotime('-3 days'));
$table->addCell(2300)->addText('水库水文站');
/**********前多日雨量*********/
$c = "地质灾害";
$PHPWord->addParagraphStyle('pStyle', array('align'=>'center', 'spaceAfter'=>100));
$section->addImage("images/image001.jpg", array('width'=>600, 'height'=>480, 'align'=>'center'));

复制代码 代码如下:

//exit($tm);
$table->addCell(2300)->addText('气象站');
$PHPWord = new PHPWord();

<?php

}

$table = $section->addTable('myOwnTableStyle');

// New Word Document
//echo $arr;

相关热词: php

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!

本文地址: https://v30.fanwenzhu.com/jq/jc/6253.shtml

相关文章
最新文章
PHP识别相片是否是颠倒的 PHP识别相片是否是颠倒的

时间:2020-12-28

python编程有哪些ide python编程有哪些ide

时间:2020-12-28

python开发工程师是做什么 python开发工程师是做什么

时间:2020-12-28

php构造函数的作用 php构造函数的作用

时间:2020-12-28

php怎么跟数据库连接 php怎么跟数据库连接

时间:2020-12-28

php实现顺序线性表 php实现顺序线性表

时间:2020-12-28

Python多重继承中的菱形继 Python多重继承中的菱形继

时间:2020-12-28

php中break的作用 php中break的作用

时间:2020-12-28

Copyright © www.juheyunku.com      关于 | 合作 | 声明 | 联系 | 更新 | 地图 | Tags

php使用phpword生成word文档

2020-12-20 编辑:

date_default_timezone_set("Asia/Shanghai");//设置一个时区

// Define cell style arrays
$c = "前三日雨量报表";
// Add image elements
// Save File
$table->addCell(2300)->addText($arr["STCD"]);
$table->addRow();
}else if($arr["STTP"] == 'ZB'){
}

// Add table style

/**********文本格式的word text.php************/
}else{

$fileName = "word报表".date("YmdHis");
}else if($arr["STTP"] == 'ZZ'){
// Define font style for first row
$section->addText($c, 'rStyle', 'pStyle');

if($arr["STTP"] == 'MM'){

$content="根据市气象局未来24小时降雨预报和市水利局实时降雨数据,市国土资源局进行了地质灾害预报,请有关部门关注

require_once '../libs/PHPWord/PHPWord.php';
}else if($arr["STTP"] == 'ZG'){
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
}else{

mssql_select_db($config['mssql']['dbname'],$conn);

// Add row设置行高

$table->addCell(2300, $styleCell)->addText('站码', $fontStyle);

/******地质灾害*******/
}else if($arr["STTP"] == 'SS'){
$res=mssql_query($sql);

$table->addCell(2300)->addText($arr["STNM"]);
$section = $PHPWord->createSection();
$table->addCell(2300, $styleCell)->addText('水文站监测类型', $fontStyle);

header("Content-type: application/vnd.ms-word");
$PHPWord->addFontStyle('rStyle', array('bold'=>false, 'italic'=>false, 'size'=>16));
require_once '../../config.php';
}else if($arr["STTP"] == 'BB'){
}else if($arr["STTP"] == 'DD'){
$table->addCell(2300)->addText('堰闸水文站');
$section->addTextBreak(2);

$styleTable = array('borderSize'=>6, 'borderColor'=>'006699', 'cellMargin'=>80);
}else if($arr["STTP"] == 'DP'){
$sql = "EXEC HNOW05_GETPPSPACE '','','".$stm."',1,1";
$table->addCell(2300, $styleCell)->addText('站名', $fontStyle);
$table->addCell(2300)->addText('蒸发站');
$table->addCell(2300)->addText('墒情站');
$tm=date('Y-m-d H:i:s');
 

header('Cache-Control: max-age=0');
$fontStyle = array('bold'=>true, 'align'=>'center');
}else if($arr["STTP"] == 'TT'){

}
// New portrait section

$table->addCell(2300)->addText('分洪水位站');
$table->addCell(2300)->addText('雨量站');
$objWriter->save('php://output');
$table->addCell(2300)->addText('泵站');

注意:要将PHPWord\PHPWord\Template.php中的setValue方法下的编码改成$replace = iconv('gbk', 'utf-8',$replace);其他的文件也要改成这种样式的。否则出现中文乱码。

实时预警信息,做好地质灾害防范工作";
//echo $arr["STCD"]."</br>";
$table->addCell(2300)->addText('河道水位水文站');
$table->addRow(500);

$PHPWord->addFontStyle('rStyle', array('bold'=>false, 'italic'=>false, 'size'=>16));
$section->addText($content);
header("Content-Disposition:attachment;filename=".$fileName.".docx");

// Add table
if(in_array('3', $a, TRUE)){
$a = explode(',',$arr);
$section->addText($c, 'rStyle', 'pStyle');

$PHPWord->addParagraphStyle('pStyle', array('align'=>'center', 'spaceAfter'=>100));
$arr = $_REQUEST['arr'];
$PHPWord->addFontStyle('rStyle', array('bold'=>true, 'italic'=>true, 'size'=>16));
$section = $PHPWord->createSection();
// require_once '../common/conn.php';

//设置标题
}else if($arr["STTP"] == 'RR'){
$table->addCell(2300)->addText($arr["P"]);
$styleFirstRow = array('borderBottomSize'=>18, 'borderBottomColor'=>'0000FF', 'bgColor'=>'66BBFF');

$table->addCell(2300)->addText('落潮位站');
$PHPWord->addParagraphStyle('pStyle', array('align'=>'center', 'spaceAfter'=>100));

$styleCell = array('valign'=>'center');
require_once '../libs/PHPWord/PHPWord/IOFactory.php';
}

while($arr = mssql_fetch_array($res)){
}else if($arr["STTP"] == 'PP'){
if(in_array('1', $a, TRUE)){
$table->addCell(2300)->addText('地下水站');
$table->addCell(2300, $styleCell)->addText('雨量', $fontStyle);
?>

//逗号 分割字符串

$conn = mssql_connect($config['mssql']['host'],$config['mssql']['user'],$config['mssql']['password']);
$PHPWord->addTableStyle('myOwnTableStyle', $styleTable, $styleFirstRow);

$stm = date('Y-m-d H:i:s',strtotime('-3 days'));
$table->addCell(2300)->addText('水库水文站');
/**********前多日雨量*********/
$c = "地质灾害";
$PHPWord->addParagraphStyle('pStyle', array('align'=>'center', 'spaceAfter'=>100));
$section->addImage("images/image001.jpg", array('width'=>600, 'height'=>480, 'align'=>'center'));

复制代码 代码如下:

//exit($tm);
$table->addCell(2300)->addText('气象站');
$PHPWord = new PHPWord();

<?php

}

$table = $section->addTable('myOwnTableStyle');

// New Word Document
//echo $arr;

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供学习参考!
本文地址为 https://v30.fanwenzhu.com/jq/jc/6253.shtml

相关文章

风云图片

推荐阅读

返回jquery教程频道首页