+ Start a Discussion
DevmenDevmen 

Visualforce page in pdf into word file

Hi,

I want to send and attach visalforce page into attachemnt related list as word file format.I tried so many ways as suggested in discussion board.But still when i opened doc file its showing in html format.How to display pdf file into word format.
<apex:page standardController="Quotation__c" showheader="false" extensions="QuoteClass"  contentType="application/msWord" sidebar="false" standardStylesheets="false"
applyHtmlTag="false" applyBodyTag="false" renderAs="pdf">
<html xmlns:w="urn:schemas-microsoft-com:office:word">
<body>
<head>
  <style type="text/css">
  
  
     @page {
       
       
      
         size: 9in 12in;
         
        @bottom-left {
              content: element(footer);
              }
             
            }
            div.footer {
                    display: block;
                    padding:20px:
                    height:30px;
                    position:running(footer);
                    border-top: solid 1px;
                  }
           .pagenumber:before {
                    content: counter(page);
                  }
           .pagecount:before {
                    content: counter(pages);
                  }
        }
</style>
</head>
<table width="100%" style="font-family:sans-serif;">
     
     <tr>
        <td align="center" style="font-size:16pt;"><b>Quotation1</b></td>
     </tr>     
     <tr>
        <td align="center" style="font-size:16pt;"><b> SAMPLE LTD.</b></td>
     </tr>
     <tr>
        <td align="center" style="font-size:10pt;"></td>
     </tr><br clear="all" style="page-break-before:always" />
     
     <table width="100%" style="font-family:sans-serif;">
     
     <tr>
        <td width="20%" align="left" style="font-size:10pt;"><b><u>Customer Details:</u></b></td>
        <td width="30%" style="font-size:10pt;"></td>
        <td width="15%" align="left" style="font-size:10pt;"><b>Quotation Ref</b></td>
        <td width="35%" style="font-size:10pt;"> :{!qtn.Quotation_Number__c} / 
                                                 <apex:outputText value="{0,date,dd MMMM, yyyy}"><apex:param value="{!qtn.Quotation_Date__c}"/></apex:outputText></td>
     </tr>
     <tr>
        <td align="left" style="font-size:10pt;"><b>Name</b></td>
        <td align="left" style="font-size:10pt;">:{!qtn.Contact__r.Name}</td>
        <td align="left" style="font-size:10pt;"><b>Sales Rep</b></td>
        <td style="font-size:10pt;">:{!currentuser.Name}</td>
     </tr>
     <tr>
        <td align="left" style="font-size:10pt;"><b>City</b></td>
        <td style="font-size:10pt;">:{!qtn.Contact__r.MailingCity}</td>
        <td align="left" style="font-size:10pt;"><b>Branch</b></td>
        <td style="font-size:10pt;">:{!qtn.Branch__r.Name}</td>
     </tr>
     <tr>
        <td align="left" style="font-size:10pt;"><b>Email</b></td>
        <td style="font-size:10pt;">:{!qtn.Contact__r.Email}</td>
        <td align="left" style="font-size:10pt;"><b>Contact No</b></td>        
        <td style="font-size:10pt;">:{!currentuser.Phone}        
        </td>
     </tr>
     <tr>
        <td align="left" style="font-size:10pt;"><b>Mobile</b></td>
        <td style="font-size:10pt;">:{!qtn.Contact__r.MobilePhone}</td>
        <td align="left" style="font-size:10pt;"><b>Email</b></td>
        <td style="font-size:10pt;">:{!currentuser.Email}</td>
     </tr><br clear="all" style="page-break-before:always" />
     
    </table> 
     
</table> 

<apex:variable value="{!0}" var="qtotal1"/>
<apex:variable value="{!1}" var="qno"/>
<table style="font-family:sans-serif;" width="100%" id="table4"  border="1" colspan="0" cellspacing="0">
    <tr style="color:black;font-weight:bold;font-size:10pt;">     
      <td align="center">Sl. No.</td>
      <td align="center">Brand</td>
      <td align="center">Product</td>
      <td align="center">Image</td>
      <td align="center">QTY</td>
      <td width="10%" align="center">Price per Unit</td>
      <td align="center">Total Value</td>
      <td align="center">Delivery Time</td>
      <td align="center">Remarks</td>
      </tr>
    
    <apex:repeat value="{!qlitems}" var="q">
    <tr style="font-size:10pt;">
      <td align="center"><apex:outputText value="{!qno}"/></td>
      <apex:variable var="qno" value="{!qno+ 1}"/>
      <td align="center">{!q.Product__r.Brand__c}</td>
      <td align="center">&nbsp;{!q.Product__r.name}</td>
      <td align="center"><img src='{!q.Product__r.Product_Image_Url__c}' width="135" height="100"/></td>      
      <td align="right">{!q.Quantity__c}</td>
      <td width="10%" align="right">{!q.Price__c}</td>
      <td align="right">{!q.Total_Price__c}</td> <apex:variable value="{!qtotal1+q.Total_Price__c}" var="qtotal1"/>  
      <td align="center">{!q.Delevery_Time__c}</td>
      <td align="center">{!q.Remarks__c}</td>    
    </tr>
    </apex:repeat>
    
    <tr style="color:black;font-weight:bold;font-size:10pt;">      
      <td colspan="6" align="right">TOTAL</td>
      <td align="right">{!qtotal1}</td>
      <td colspan="2"></td>
    </tr><br clear="all" style="page-break-before:always" />  

</table>

<table width="100%" style="font-family:sans-serif;">
    
    <tr>
        <td width="20%" align="left" style="font-size:10pt;font-family:sans-serif;"><b><u>Payment Terms:</u></b></td><br clear="all" style="page-break-before:always" />        
    </tr>
    <tr>
        <td style="font-family:sans-serif;font-size:9pt;">
        <apex:outputText value="{!qtn.Payment_Terms__c}" escape="false"/>
        </td>         
    </tr>
    <tr>
        <td width="20%" align="left" style="font-size:10pt;font-family:sans-serif;"><b><u>Special Instructions:</u></b></td><br clear="all" style="page-break-before:always" />      
    </tr>
    <tr>
        <td style="font-family:sans-serif;font-size:9pt;">
        <apex:outputText value="{!qtn.Special_Instructions__c}" escape="false"/>
        </td>         
    </tr>
    <tr>
        <td width="20%" align="left" style="font-size:10pt;font-family:sans-serif;"><b><u>Terms &amp; Conditions:</u></b></td>                
    </tr>
    <tr>
        <td style="font-family:sans-serif;font-size:9pt;">
        <apex:outputText value="{!qtn.Terms_Conditions__c}" escape="false"/>
        </td>         
    </tr>

</table>

<table width="100%" style="font-family:sans-serif;font-size:10pt;">
    
    <tr style="font-family:sans-serif;font-size:10pt;">
        <td align="left"><b>E&amp;O.E.</b></td><br clear="all" style="page-break-before:always" />
    </tr>
    <tr style="font-family:sans-serif;font-size:10pt;">    
        <td align="left">Thanking You,</td>
    </tr>
    <tr style="font-family:sans-serif;font-size:10pt;">     
        <td align="left">Best Regards</td>
    </tr>
    <tr style="font-family:sans-serif;font-size:10pt;">     
        <td align="left"></td>        
    </tr>
</table>
</body>
  </html>
</apex:page>
Please help me to resolve this.
Thanks
 
Raj VakatiRaj Vakati
I dnt think so you can able to do it direcly .. 

You need to use the some of the appexchange products like Sdocs ect.. 
 
DevmenDevmen
Hi Raj,
Thanks for your reply  .When i send email  as attachment its working .Only problem with some tags in this visualforce page which is not supported in word format.

thanks
deep pal 2deep pal 2
If you want to convert your PDF file to word documents, then you can easily do so with the conversion program located within the  PDF Element. This can help you to easily convert any kind of text, and all the popular file types into PDF documents.it provides free demo version to ensure the users about it function and features. 

User-added image