[SalesForce] How to display content of the Word Document in a Visualforce Page

I am working on a contract module in package. As you all know contract for diffreant companies are diffrent, I mean their logo, their way of data representation etc.

So I am createing a vf page which shows contract details to user.
How can I create a vf page that can change its content.

I am thinking of saving an word file of contract and then reading it in visualforce page.

Visualforce Page

    <apex:page controller="UploadDocumentController" >
    <apex:form >
    <apex:pageBlock >
        <apex:pageBlockSection >
              <apex:pageBlockSectionItem >
                <apex:outputLabel value="Resume" />
                 <apex:outputPanel > 
                  <div class="requiredInput">
                    <div class="requiredBlock"></div>
                      <apex:inputFile value="{!attachment1Blob}" /><br/>  
                      <div class="note"> doc, docx, txt, and pdf. Max 800 KB </div>

                  </div>
                </apex:outputPanel>
           </apex:pageBlockSectionItem> 
        </apex:pageBlockSection>
        <apex:commandButton value="Save" action="{!save}"/>
        <apex:outputText value="{!tempString}"></apex:outputText>
    </apex:pageBlock>
    </apex:form> 
</apex:page>

Controller

public with sharing class UploadDocumentController {
transient public Blob attachment1Blob {get;set;}
public String tempString  {get;set;}
    Public void save(){
         Document resume = new Document();
         tempString= EncodingUtil.base64Encode(attachment1Blob);
         system.debug('##'+tempString);
         resume.body = attachment1Blob;
         resume.name = 'test';
         resume.Folderid = UserInfo.getUserId();
         insert resume;

    }
}

I have tried this but getting a long string as 0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAACAAAAtgAAAAAAAAAAEAAAuAAAAAEAAAD+////AAAAALQAAAC1AAAA//////////////// in output

How can I read the content of visualforce page and display in visualforce page.
Also how can I embed my values from controller to visualforce page.

Please help,
Thanks in advance

Best Answer

So, basically you need ability to read doc file then update the doc file with some content from SFDC. To do this you need some sort of API/COM component to interact with doc file. As of now there is no such API/COM component available on force.com Due to this, it is not feasible to READ/UPDATE doc file on force.com platform. So the only option to you is either use 3rd party solution like
conga composer or develop your own service using .net(or some other programming language) and consume that service from SFDC.

Related Topic