本文整理汇总了PHP中CreateDocx::DOCX2TXT方法的典型用法代码示例。如果您正苦于以下问题:PHP CreateDocx::DOCX2TXT方法的具体用法?PHP CreateDocx::DOCX2TXT怎么用?PHP CreateDocx::DOCX2TXT使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CreateDocx
的用法示例。
在下文中一共展示了CreateDocx::DOCX2TXT方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
<?php
require_once '../../../classes/CreateDocx.inc';
$options = array('paragraph' => true, 'list' => true, 'table' => true, 'footnote' => true, 'endnote' => true, 'chart' => 0);
CreateDocx::DOCX2TXT('../../files/Text.docx', 'document_1.txt', $options);
示例2: extract_text
//.........这里部分代码省略.........
// ignore all empty cells
foreach ($cell as &$content) {
$result .= "" . $content . " ";
// collect content of all cells
}
}
}
}
}
} else {
$result = 'ERROR';
}
// for ODT documents enter here
} else {
if ($source_type == 'odt') {
require_once "" . $converter_dir . "/odt_reader.php";
$x = new odt_reader();
// Unzip the document
$u = $x->odt_unzip($filename, false);
// read the document
$result = $x->odt_read($u[0], 2);
// create some blanks around the <div> tags
$result = str_replace("<", " <", $result);
$result = str_replace(">", "> ", $result);
//echo "\r\n\r\n<br /> odt result: $result<br />\r\n";
// for DOCX files enter here
} else {
if ($source_type == 'docx') {
// converter class supplied by http://www.phpdocx.com
$options = array('paragraph' => false, 'list' => false, 'table' => false, 'footnote' => false, 'endnote' => false, 'chart' => 0);
$docx_file = "docx.txt";
$result = '';
require_once "" . $converter_dir . "/docx/CreateDocx.inc";
CreateDocx::DOCX2TXT($filename, $tmp_dir . "/" . $docx_file, $options);
if ($file = @file_get_contents($tmp_dir . "/" . $docx_file)) {
$result = "{$file} ";
}
if ($index_xmeta) {
require_once "" . $converter_dir . "/xmeta_converter.php";
$docxmeta = new x_metadata();
$docxmeta->setDocument($filename);
/*
echo "Title : " . $docxmeta->getTitle() . "<br>";
echo "Subject : " . $docxmeta->getSubject() . "<br>";
echo "Creator : " . $docxmeta->getCreator() . "<br>";
echo "Keywords : " . $docxmeta->getKeywords() . "<br>";
echo "Description : " . $docxmeta->getDescription() . "<br>";
echo "Last Modified By : " . $docxmeta->getLastModifiedBy() . "<br>";
echo "Revision : " . $docxmeta->getRevision() . "<br>";
echo "Date Created : " . $docxmeta->getDateCreated() . "<br>";
echo "Date Modified : " . $docxmeta->getDateModified() . "<br>";
*/
$result .= $docxmeta->getTitle() . $docxmeta->getSubject() . $docxmeta->getCreator() . $docxmeta->getKeywords() . $docxmeta->getDescription() . $docxmeta->getLastModifiedBy() . $docxmeta->getRevision() . $docxmeta->getDateCreated() . $docxmeta->getDateModified();
}
@unlink($tmp_dir . "/" . $docx_file);
/*
if($result && $chrSet != "UTF-8") {
$result = @mb_convert_encoding($result, "UTF-8", $chrSet);
}
*/
// for XLSX spreadsheets enter here
} else {
if ($source_type == 'xlsx') {
$result = '';
$i = 1;
$name = '';