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
DJP1SDJP1S 

Write out data in like a word document rather than table?

Hi, I was wondering if any of you have some kind of code sample that writes out data from a query like this:

 

My_Object.Field_A

My_Object.Field_B

My_Object.Field_C

My_Object.Field_A

My_Object.Field_B

My_Object.Field_C

 

And then I can just add dividers between each record that is written out this way. I basically want to simulate a basic report or word-style document, rather than using the usual pageBlockTable element.

Best Answer chosen by Admin (Salesforce Developers) 
Prady01Prady01

Hello there, You can specify the columns if you just want all the fileds in one column.

<apex:page standardController="Objectname" showHeader="false" sidebar="false">
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons />
<center><apex:commandButton action="{!save}" value="Save" />
<apex:commandButton action="{!CANCEL}" value="Cancel" /></center>

<b><center><font color="Red"><apex:messages /></font></center></b>




<apex:pageBlockSection title="First Section" columns="2" collapsible="True">
<apex:inputField value="{!Objectname.FieldName}"/>
<apex:inputField value="{!Objectname.FieldName}"/>
<apex:inputField value="{!Objectname.FieldName}"/>

<apex:inputField value="{!Objectname.FieldName}"/>
<apex:inputField value="{!Objectname.FieldName}"/>
<apex:inputField value="{!Objectname.FieldName}"/>
<apex:inputField value="{!Objectname.FieldName}"/>
</apex:pageBlockSection>  



<apex:pageBlockSection title="Second Section" columns="2" collapsible="True">
<apex:inputField value="{!Objectname.FieldName}"/>
<apex:inputField value="{!Objectname.FieldName}"/>
<apex:inputField value="{!Objectname.FieldName}"/>

<apex:inputField value="{!Objectname.FieldName}"/>
<apex:inputField value="{!Objectname.FieldName}"/>
<apex:inputField value="{!Objectname.FieldName}"/>
<apex:inputField value="{!Objectname.FieldName}"/>
</apex:pageBlockSection>        

</apex:form>
</apex:page>

 Hope this helps!!