Support

Expand all | Collapse all

Velocity Report exporting to Word formatting

  • 1.  Velocity Report exporting to Word formatting

    Posted 22 days ago
    I recently created a Velocity Report that correctly exports to HTML. I am now trying to modify the Report to export to Word instead. I am trying to specify the size and orientation of the page, but it is not changing anything. Here are some snippets of code that I think are relevant.
    <html xmlns:v=3D"urn:schemas-microsoft-com:vml"
    xmlns:o=3D"urn:schemas-microsoft-com:office:office"
    xmlns:w=3D"urn:schemas-microsoft-com:office:word"
    xmlns:x=3D"urn:schemas-microsoft-com:office:excel"
    xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml"
    xmlns=3D"http://www.w3.org/TR/REC-html40">
    
    	<meta name=3DProgId content=3DWord.Document>
    	<meta name=3DGenerator content=3D"Microsoft Word 15">
    	<meta name=3DOriginator content=3D"Microsoft Word 15">
    	
    	<head>
    		<title>Traceability Matrix</title>
    		<style>
    			body { 
    				font-family: sans-serif;
    			}
          
    			h1 { 
    				font-size: 1.5em;
    			}
          
    			table, th, td { 
    				border: 1px solid black;  
    				border-collapse: collapse;
    			}
    			
    			@page WordSection1 {
    				size:16.5in 11.7in;
    				mso-page-orientation:landscape;
    				margin:0.25in 0.25in 0.25in 0.25in;
    				mso-header-margin:.5in;
    				mso-footer-margin:.5in;
    				mso-paper-source:0;
    			}
    				
    			div.WordSection1 {
    				page:WordSection1;
    			}
    		</style>
    <div class=3DWordSection1>
    <h1>REQUIREMENT TRACEABILITY</h1>
    <table width="100%">
        ...​

    Also, I want the table rows to not break across pages. How could I specify this?

    Thanks,



    ------------------------------
    Jack
    ------------------------------


  • 2.  RE: Velocity Report exporting to Word formatting

    Posted 22 days ago
    Hi Jack:

    I would first make a Word doc, to have the exact formatting specifications you need and then use that as your template to add the Velocity functionality to the HTML version. You have already done more than half the work. See this video: Velocity Reporting: Creating a basic template. This seems to be the general best practice I hear when dealing with formatting with Velocity.

    Best,

    ------------------------------
    Chloe Elliott
    Jama Software
    Portland OR
    ------------------------------



  • 3.  RE: Velocity Report exporting to Word formatting

    Posted 22 days ago
    Hi Chloe,

    Using your suggestion, I realised that I had placed the meta tags outside of the head instead of inside it. However, I am still getting the default A4 portrait document when exporting. Interesting enough, the template I created does not contain the 'mso-page-orientation:landscape' line anywhere, yet it still outputs as landscape. Otherwise, I'm not sure what else is missing from my report.

    ------------------------------
    Jack
    ------------------------------