From the course: PHP: Exporting Data to Files
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Extracting the main content file from a Word document - PHP Tutorial
From the course: PHP: Exporting Data to Files
Extracting the main content file from a Word document
The docx file, that we've just created, is basically a wrapper for a collection of XML and other files bundled together using Zip compression. To create a download file incorporating the database results, we need to extract the main XML file and convert it into an XSLT stylesheet. As in the previous chapter, we'll use a PHP script to do this. But first, let's take a look inside the docx file to see how its structure differs from that of an open document text file. So here's flowers_wordTemplate.docx. If you want to follow along make sure the file is no longer open in Microsoft Word, navigate to the output folder in Windows Explorer or Mac Finder. Unlike the ODT file in previous chapter, changing the file name extension of a docx file to zip and back again doesn't seem to corrupt it on a Mac. So let's change this from docx to zip. We're warned that it might become unusable. That's no problem, and then, we need to unzip it. So, right click, I'm going to use Win Zip. You can use any…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
(Locked)
Creating a .docx file to use as a template3m 37s
-
(Locked)
Extracting the main content file from a Word document5m 28s
-
(Locked)
Formatting the main content file3m 38s
-
(Locked)
Converting the main content file to XSLT6m 18s
-
(Locked)
Outputting the database result as a .docx file6m 4s
-
(Locked)
Offering a choice of download formats3m 55s
-
(Locked)
-