|
|
|
|
@ -37,10 +37,13 @@ class WordPHP
|
|
|
|
|
private $file;
|
|
|
|
|
private $rels_xml;
|
|
|
|
|
private $doc_xml;
|
|
|
|
|
private $doc_media = [];
|
|
|
|
|
private $doc_media = array();
|
|
|
|
|
private $last = 'none';
|
|
|
|
|
private $encoding = 'ISO-8859-1';
|
|
|
|
|
private $tmpDir = 'tmp';
|
|
|
|
|
//图片目录和前缀
|
|
|
|
|
public $img_dir = '';
|
|
|
|
|
public $img_prex = '';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* CONSTRUCTOR
|
|
|
|
|
@ -167,7 +170,8 @@ class WordPHP
|
|
|
|
|
if($reader->name == "w:shd" && $reader->getAttribute("w:val") != "clear" && $reader->getAttribute("w:fill") != "000000") {
|
|
|
|
|
$f .="background-color: #".$reader->getAttribute("w:fill").",";
|
|
|
|
|
}
|
|
|
|
|
if($reader->name == 'w:drawing' && !empty($reader->readInnerXml())) {
|
|
|
|
|
$temp_rx = $reader->readInnerXml();
|
|
|
|
|
if($reader->name == 'w:drawing' && !empty($temp_rx)) {
|
|
|
|
|
$r = $this->checkImageFormating($reader);
|
|
|
|
|
$img = $r !== null ? "<image src='".$r."' />" : null;
|
|
|
|
|
}
|
|
|
|
|
@ -283,7 +287,13 @@ class WordPHP
|
|
|
|
|
$ext = strtolower($arr[$l-1]);
|
|
|
|
|
|
|
|
|
|
$im = imagecreatefromstring($image);
|
|
|
|
|
$fname = $this->tmpDir.'/tmp/'.$relId.'.'.$ext;
|
|
|
|
|
if (empty($this->img_dir)) {
|
|
|
|
|
$fname = $this->tmpDir.'/tmp/'.$relId.'.'.$ext;
|
|
|
|
|
} else {
|
|
|
|
|
$ext = str_ireplace('jpeg', 'jpg', $ext);
|
|
|
|
|
$fname = $this->img_dir.'/'.$this->img_prex.'_'.mb_strtolower($relId).'.'.$ext;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch ($ext) {
|
|
|
|
|
case 'png':
|
|
|
|
|
@ -404,7 +414,7 @@ class WordPHP
|
|
|
|
|
$tc2 = new SimpleXMLElement($tc->readOuterXML());
|
|
|
|
|
|
|
|
|
|
foreach ($tc2->children('w',true) as $ch) {
|
|
|
|
|
if (in_array($ch->getName(), ['left','top','botom','right']) ) {
|
|
|
|
|
if (in_array($ch->getName(), array('left','top','botom','right'))) {
|
|
|
|
|
$line = $this->convertLine($ch['val']);
|
|
|
|
|
$style .= " border-".$ch->getName().":".$ch['sz']."px $line #".$ch['color'].";";
|
|
|
|
|
}
|
|
|
|
|
@ -418,16 +428,16 @@ class WordPHP
|
|
|
|
|
|
|
|
|
|
private function convertLine($in)
|
|
|
|
|
{
|
|
|
|
|
if (in_array($in, ['dotted']))
|
|
|
|
|
if (in_array($in, array('dotted')))
|
|
|
|
|
return "dashed";
|
|
|
|
|
|
|
|
|
|
if (in_array($in, ['dotDash','dotdotDash','dotted','dashDotStroked','dashed','dashSmallGap']))
|
|
|
|
|
if (in_array($in, array('dotDash','dotdotDash','dotted','dashDotStroked','dashed','dashSmallGap')))
|
|
|
|
|
return "dashed";
|
|
|
|
|
|
|
|
|
|
if (in_array($in, ['double','triple','threeDEmboss','threeDEngrave','thick']))
|
|
|
|
|
if (in_array($in, array('double','triple','threeDEmboss','threeDEngrave','thick')))
|
|
|
|
|
return "double";
|
|
|
|
|
|
|
|
|
|
if (in_array($in, ['nil','none']))
|
|
|
|
|
if (in_array($in, array('nil','none')))
|
|
|
|
|
return "none";
|
|
|
|
|
|
|
|
|
|
return "solid";
|
|
|
|
|
|