You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to read 2 docx files or more from database and write all of it in new docx and may add text after
but it only read one file and don't even read the text below the loop
i'm new to php and phpword
using netbean IDE 8.0.2
windows 7
this is a code sample that reproduces the issue.
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$phpWord->getSettings()->setThemeFontLang($languageEnGb);
try {
include ('DbConnection.php');
$GenratedFileID = "1";
$GenFileName = '';
$sql = "SELECT S.FileID as fileID, G.GenratedFileName as GenFile, L.FileName as Fname , L.FilePath as FilePth,"
. "G.GenratedFileName as GName "
. "FROM sections S,genratedfiles G, fileslibrary L "
. " where G.GenratedFileID = S.GenratedFileID "
. "and S.FileID = L.FileID and G.GenratedFileID =" . $GenratedFileID;
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) { //Read Library File$GenFileName = $row['GName'];
$name = str_replace('/', '\\', $row['FilePth']);
$source = __DIR__ . "\\{$name}";
$phpWord = \PhpOffice\PhpWord\IOFactory::load($source);
}//end of while loop// $section->addOLEObject($row['FilePth']);$section = $phpWord->addSection();
$section->addTitle('Welcome to first database Genrated File', 1);
$section->addText('created by me');
$section->addTextBreak(2);
//save docx file $objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save('Generated Files/' . $GenFileName . '.docx');
} //end of main if statment //If the exception is thrown, this text will not be shownecho'If you see this, the number is 1 or below';
} // end of trycatch (PDOException$e) {
echo "Error: " . $e->getMessage();
}
mysqli_close($conn);
### Context
* PHP version: 5
* PHPWord version: 0.14
The text was updated successfully, but these errors were encountered:
I'm trying to read 2 docx files or more from database and write all of it in new docx and may add text after
but it only read one file and don't even read the text below the loop
i'm new to php and phpword
using netbean IDE 8.0.2
windows 7
this is a code sample that reproduces the issue.
The text was updated successfully, but these errors were encountered: