Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Have you thought about saving your Word documents as XML? IIRC you need Office Professional version to do this.

This would allow you to display the document over the web with out changing it (IE will figure out and display the file properly using XSL). As well you can lock the file down by using web server controls. This would result in users being able to modify the client side doc but not being able to save it back to the server unless they do it your way.

When a user downloads then saves a document back the server you can then check that the file contains the proper header (both text and images can be supported), if it does not then you can delete the old header and put a new one in it's place. Update

The body of the Word doc is contained within the <w:body> tags. This also contains the header and footer information in it as well. The header/footer info is stored under the <w:sectPr> node.

Here is a bare body that only contains the word "BODY".

<w:body> <wx:sect> <w:p> <w:r> <w:t>BODY</w:t> </w:r> </w:p> <w:p/> <w:p/> <w:p/> </wx:sect> </w:body>
Here is document body with the header and footer.
<w:body> <wx:sect> <w:p> <w:r> <w:t>BODY</w:t> </w:r> </w:p> <w:p/> <w:p/> <w:p/> <w:sectPr> <w:hdr w:type="odd"> <w:p> <w:pPr> <w:pStyle w:val="Header"/> </w:pPr> <w:r> <w:t>Header1</w:t> </w:r> <w:r> <w:tab wx:wTab="3525" wx:tlc="none" wx:cTlc="58"/> </w:r> <w:r> <w:tab wx:wTab="4320" wx:tlc="none" wx:cTlc="71"/> </w:r> </w:p> </w:hdr> <w:ftr w:type="odd"> <w:p> <w:pPr> <w:pStyle w:val="Footer"/> </w:pPr> <w:r> <w:t>Footer1</w:t> </w:r> </w:p> </w:ftr> <w:pgSz w:w="12240" w:h="15840"/> <w:pgMar w:top="1440" w:right="1800" w:bottom="1440" w:left="1800" w:h +eader="720" w:footer="720" w:gutter="0"/> <w:cols w:space="720"/> <w:docGrid w:line-pitch="360"/> </w:sectPr> </wx:sect> </w:body>
Hope this helps.

In reply to Re: Manipulating MSWord files in a linux box? by terra incognita
in thread Manipulating MSWord files in a linux box? by DaWolf

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-03-19 04:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found