how to get content from Doc file in php
i use PHPOffice/PHPWord in Yii2.
this Code Dont work: (my Doc File is UTF8)
$phpWord = \PhpOffice\PhpWord\IOFactory::load($filename, 'MsDoc');
$sections = $phpWord->getSections();
foreach ($sections as $key => $value) {
$sectionElement = $value->getElements();
foreach ($sectionElement as $elementKey => $elementValue) {
if ($elementValue instanceof \PhpOffice\PhpWord\Element\TextRun) {
$secondSectionElement = $elementValue->getElements();
foreach ($secondSectionElement as $secondSectionElementKey => $secondSectionElementValue) {
if ($secondSectionElementValue instanceof \PhpOffice\PhpWord\Element\Text) {
echo $secondSectionElementValue->getText() . '<br/>';
}
}
}
}
}
i need get content from Doc File (Title,...)