Add Word document to another Word document with PHP -
How do I add a word document to a word document with PHP (fwrite)?
$ filename = "./1.doc"; $ Handle = fopen ($ filename, "r"); $ Content = fred ($ handle, files ($ filename)); $ Filename2 = "./2.doc"; $ Handle 2 = FOPN ($ filename 2, "R"); $ Contents2 = fread ($ handle2, files ($ filename2)); $ Content 3 = $ content 2. $ content; $ Fp = fopen (". / 3.doc", 'w +'); Filitt ($ fp, $ content);
Only 1.doc in 3.doc
First of all, you actually only filing ()
to $ Content
variable, no $ contents3
.
The real problem though is that the internal structure of the Word document is more complex. A Word document includes a special preface and wrapping. If you add only two word documents, you will leave probably *
with a garbage file. You will need a library that can parse the word files, only remove the original text content, add text together and save it as a new word file.
*)
It's just for its joke, really two consolidated. Can not do anything with a file made with doc files.
Comments
Post a Comment