#23 : Implement Word97 aka MsDoc Reader
This commit is contained in:
parent
df8de962a9
commit
ca69de3962
|
|
@ -5,15 +5,15 @@ include_once 'Sample_Header.php';
|
|||
$name = basename(__FILE__, '.php');
|
||||
$source = "resources/{$name}.doc";
|
||||
echo date('H:i:s'), " Reading contents from `{$source}`", EOL;
|
||||
$phpWord = \PhpOffice\PhpWord\IOFactory::load($source, 'Word97');
|
||||
$phpWord = \PhpOffice\PhpWord\IOFactory::load($source, 'MsDoc');
|
||||
|
||||
// (Re)write contents
|
||||
/*$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
foreach ($writers as $writer => $extension) {
|
||||
echo date('H:i:s'), " Write to {$writer} format", EOL;
|
||||
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
|
||||
$xmlWriter->save("{$name}.{$extension}");
|
||||
rename("{$name}.{$extension}", "results/{$name}.{$extension}");
|
||||
}*/
|
||||
}
|
||||
|
||||
include_once 'Sample_Footer.php';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
date_default_timezone_set('Europe/Paris');
|
||||
|
||||
/**
|
||||
* Header file
|
||||
*/
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -118,6 +118,76 @@ class Drawing
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert centimeters width to twips
|
||||
*
|
||||
* @param integer $pValue
|
||||
*/
|
||||
public static function centimetersToTwips($pValue = 0)
|
||||
{
|
||||
if ($pValue != 0) {
|
||||
return $pValue * 566.928;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert twips width to centimeters
|
||||
*
|
||||
* @param integer $pValue
|
||||
*/
|
||||
public static function twipsToCentimeters($pValue = 0)
|
||||
{
|
||||
if ($pValue != 0) {
|
||||
return $pValue / 566.928;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert inches width to twips
|
||||
*
|
||||
* @param integer $pValue
|
||||
*/
|
||||
public static function inchesToTwips($pValue = 0)
|
||||
{
|
||||
if ($pValue != 0) {
|
||||
return $pValue * 1440;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert twips width to inches
|
||||
*
|
||||
* @param integer $pValue
|
||||
*/
|
||||
public static function twipsToInches($pValue = 0)
|
||||
{
|
||||
if ($pValue != 0) {
|
||||
return $pValue / 1440;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert twips width to pixels
|
||||
*
|
||||
* @param integer $pValue
|
||||
*/
|
||||
public static function twipsToPixels($pValue = 0)
|
||||
{
|
||||
if ($pValue != 0) {
|
||||
return round($pValue / 15.873984);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert HTML hexadecimal to RGB
|
||||
*
|
||||
|
|
|
|||
|
|
@ -225,7 +225,6 @@ class Font extends AbstractStyle
|
|||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get font size
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue