Page border on cover page visualforce as word document

Hello folks,

In this blog I am going to give example to how to apply border on cover page of visualforce page word document.

To load visualforce page as word document you need to add attribute ContentType="application/msword#name_of_Document.doc". you can replace name_of_document with file name you want to add.

lets jump on code snippet to add page border.Below style sheet will add page border on cover page.



          @page Section1 {
                size: 8.5in 11in;
                margin: 0in 1in 0.5in 1in;
                mso-header-margin: 0.5in;
                mso-header: h1;
                mso-footer: f1;
                mso-footer-margin: 0.5in;
                mso-paper-source: 0;
                mso-page-border-display: first-page;
                font-family: Calibri; 
                mso-border-alt: solid black 2pt;
                mso-page-border-offset-from: edge;
                padding: 20px 20px;
         }



      mso-border-alt: solid black 2pt;
      mso-page-border-offset-from: edge;


Above line will add border to page and adding padding to section will add padding to page border.

Hope this will help, Please comment your question or suggestions.




No comments:

Post a Comment