0 Replies Latest reply: Dec 6, 2010 6:49 AM by el_sim RSS

    Word File formatting

    el_sim Community Member

      I run into a formatting problem while creating a Word         file in ColdFusion as shown below.

      The Print Layout of the created .doc file uses the margin set to         the sum of the Word default margins and margins described in the         <stlyle> tag.
      I am looking for the way to be able to set any margins for the         created Word file including the Top and the Bottom margin values         that are less than the Word defaults.

      While I can use the negative <style> margin values to set         the Right and the Left margins to be less then 1 inch, the same         approach does not work for the Top and the Bottom margins.
      The Top and the Bottom margins do not get set to less than 1         inch (Word default) number regardless of the value of the         margins set in the <stlyle> tag.
      Please see the code I use below:

      <cfsavecontent         variable="WordFile">
      <html>
      <head>
           <title>Untitled</title>
           <CFOUTPUT>
               <style type="text/css">
               body {
                   margin: 0.5in 0.5in 0.5in 0.5in;  <!--- margin:         -0.5in -0.5in -0.5in -0.5in; --->
                   }
               </style>
           </CFOUTPUT>
        </head>
      <body>
      <CFLOOP from="1" to="100" index="Idx">
           Hello World!  
      </CFLOOP>
      </body>
      </html>
      </cfsavecontent>

      <CFFILE ACTION="Write" FILE="HelloWorld.doc"         OUTPUT="#WordFile#">

      I would appreciate any suggestions you might have.