-1

Preface

When I want to see the source code of a webpage I could go in most browsers to Tools > Web developer > View source, or alternatively to, View > View source). I could also click "CTRL+Z" to view the source code in most browsers.

My question

Is there a similar easy and fast way to see the source code of a specific MS word document I work on? I ask this since I know (and I might be wrong) that MS word documents are also built, like webpages, in HTML --- Is there a way to see their HTML as well?

Thanks,

3

Word pages (Word 2007+) are not in HTML, they are XML files inside a Zip file, similar to OOXML (Open Office XML).

Open a DOCX as if it was a zip file (using 7-Zip or alike), and then pull the XML file(s) you want to view.

The main contents of the Word document are stored in the XML file named "document.xml", inside the "word" folder inside the zip/docx file.

1

More like XML but not just one document, many. One for styles, one for the document, one for the theme and so on.

Word documents are compressed and saved and I don't think there's a way to view the source from Word itself since it's made up of many XML docs. So, you have to first decompress the word file. To do so, change the .docx or .doc extension to .zip (hello.doc -> hello.doc.zip for example). Now, open the zip with Windows Explorer and there you go.

If you check out word/document.xml from the extracted stuff, you can see the contents of the document along with the XML markup. Here's a snippet from a document with just "hello, world!" inside it.

<w:body>
        <w:p w:rsidR="00EA62CA" w:rsidRDefault="004F37CE">
            <w:r>
                <w:t>Hello, world!</w:t>
            </w:r>
            <w:bookmarkStart w:id="0" w:name="_GoBack" />
            <w:bookmarkEnd w:id="0" /></w:p>
        <w:sectPr w:rsidR="00EA62CA">
            <w:pgSz w:w="12240" w:h="15840" />
            <w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0" />
            <w:cols w:space="720" />
            <w:docGrid w:linePitch="360" /></w:sectPr>
    </w:body>

Check out this article for a more detailed overview of the uncompressed files and directories.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.