hey guys, anyone here know how to format word doc using PHP?, i already got how to create one, but the formatting is my problem, like setting bold letters, btw i tried html markup it works but the problem though is how to set the page width? it's taking up the whole page, this problem doesn't happen when word doc is created by default not in html

Edited by vaultdweller123: change article title

6 Years
Discussion Span
Last Post by joonaroshi

New Word documents use Office Open XML, which from what I can gather is a zipped XML document. So, have a look at this page - I don't know it will help:


It contains link to downloadable manuals of schemas etc. You may need to be able to access xsd files as well as pdfs though.

Opening a word document with an archiving program like 7-zip really lets you get under its skin. VERY informative.

For example a word file containing this:

Peace peace


<?xml version="1.0" encoding="UTF-8" standalone="true"?>
-<w:document mc:Ignorable="w14 wp14" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape"
    xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk"
    xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" 
    xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w10="urn:schemas-microsoft-com:office:word" 
    xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:v="urn:schemas-microsoft-com:vml" 
    xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" 
    xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        -<w:p w:rsidRDefault="00AC700E" w:rsidR="009C1713">
            <w:bookmarkStart w:name="_GoBack" w:id="0"/>
            -<w:r w:rsidRPr="00AC700E">
            <w:bookmarkEnd w:id="0"/>
                    <w:t xml:space="preserve"> peace</w:t>
         -<w:sectPr w:rsidR="009C1713">
             <w:pgSz w:w="11906" w:h="16838"/>
             <w:pgMar w:gutter="0" w:footer="708" w:header="708" w:left="1440" w:bottom="1440" w:right="1440" w:top="1440"/>
             <w:cols w:space="708"/>
             <w:docGrid w:linePitch="360"/>

So from the above, I take it that bold is <w:b/>?

Edited by diafol


I agree. Open html in Word and then you can use a macro to autoformat.


Ever tried the PHPWord library ?
You can download it here

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.