deal with docx

hotfix/远程访问多媒体中心
LMR 7 years ago
parent 6dd4ee072f
commit 354b662059

1
.gitignore vendored

@ -7,3 +7,4 @@
/kcfinder/cache/* /kcfinder/cache/*
*/cache/* */cache/*
/author/document/* /author/document/*
/application/libraries/composer

@ -382,6 +382,7 @@ class Info_amp extends CI_Controller
} }
$md5_name = $md5_file.$ext; $md5_name = $md5_file.$ext;
$path = realpath('../cht-system/views/information/word_source').'/'.basename($md5_name); $path = realpath('../cht-system/views/information/word_source').'/'.basename($md5_name);
$html = realpath(APPPATH.'/libraries/composer/vendor/');
if (move_uploaded_file($file['tmp_name'], $path)) { if (move_uploaded_file($file['tmp_name'], $path)) {
$this->load->library('wordphp'); $this->load->library('wordphp');
$rt = new WordPHP(); $rt = new WordPHP();
@ -389,7 +390,12 @@ class Info_amp extends CI_Controller
$rt->img_prex = $md5_file; $rt->img_prex = $md5_file;
$html = $rt->readDocument($path); $html = $rt->readDocument($path);
$html = str_ireplace($rt->img_dir, '//202.103.68.62:9096/information-view/information/word_img', $html); $html = str_ireplace($rt->img_dir, '//202.103.68.62:9096/information-view/information/word_img', $html);
//file_put_contents($path.'.txt', $html); /*//phpWord转HTML
require_once($html.'/autoload.php');
$phpWord = \PhpOffice\PhpWord\IOFactory::load($path);
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, "HTML");
$xmlWriter->save($path.'.html');
*/
echo(json_encode(array( echo(json_encode(array(
'status' => 'success', 'status' => 'success',
'path' => $path, 'path' => $path,

@ -485,7 +485,7 @@ class WordPHP
// look for new paragraphs // look for new paragraphs
$paragraph = new XMLReader; $paragraph = new XMLReader;
$p = $reader->readOuterXML(); $p = $reader->readOuterXML();
//return $p; return $p;
if ($reader->nodeType == XMLREADER::ELEMENT && $reader->name === 'w:p') { if ($reader->nodeType == XMLREADER::ELEMENT && $reader->name === 'w:p') {
// set up new instance of XMLReader for parsing paragraph independantly // set up new instance of XMLReader for parsing paragraph independantly

Loading…
Cancel
Save