function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Generated msword doc through visualforce is not displaying formatted html and image



I have developed functionality where I am generating a msword document through visual force code using contenttype attribute of <apex:page> tag. 


The word document is generated properly, however the formating of html and images are not shown properly, only the text is displayed.


Please let me know how can i make generated document to display correct html formatting and images.





Hi Amit,


If you were to remove the renderas from your <apex:page>, do the styles appear as they should?


For the styling, I've seen where only inline styles are rendered.  Have you tried that?  You can add something simple like <apex:outputText style="font-weight:700" value="Is this bold?" /> to see if it makes a difference or not.


For the images, what sort of tag are you using?  <image /> <img /> or <apex:image />?






Thanks for the reply. 


Actually image is saved in account's field (which is of Rich text area type). So I am just gettting the value of the field (which returns a url) and putting that in <apex:outputtext>, which renders in <img> tag of html.


I have tried with <img> html tag as well, but no luck.