• stai
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies

I have an ExportContacts.page defined like this:

 

 

<apex:page standardController="Contact" contenttype="application/vnd.ms-excel#ExportContacts.xls" 
recordSetVar="contacts" extensions="ExportContactsExtension" >
   <apex:pageBlock title="Contacts">
      <apex:pageBlockTable value="{!contacts}" var="contact">
         <apex:column value="{!contact.LastName}"/>
         <apex:column value="{!contact.FirstName}"/>
         <apex:column value="{!contact.Name}"/>
         <apex:column value="{!contact.MailingCity}"/>
         <apex:column value="{!contact.Phone}"/>
         <apex:column value="{!contact.Fax}"/>
         <apex:column value="{!contact.MobilePhone}"/>
      </apex:pageBlockTable>
   </apex:pageBlock>
</apex:page>

 

 

I have a custom button on my page and can export the contacts to Excel.  The issue is that some entries with multi-line addresses like:

 

 

123 Main Street
Suite 100

 get put into two rows in the same column - the main entry will be two rows high as the cells are merged, but the address is not in a merged cell but instead in two separate rows.  For example, the name will be in Cell C31/32 (merged cell), but the address will be in Cells J31 and J32 as separate cells, not merged.

 

 

The issue is the merged cells prevent sorting, but even if the cells are unmerged, the address will be on separate rows so it won't remain with the original entry when sorting.  How can I export this data to Excel without these merged cells?

  • September 15, 2010
  • Like
  • 0

Is it possible to export a custom contact view to Excel?  I have a button that goes to the ExportContacts.page that is defined like:

 

 

<apex:page standardController="Contact" contenttype="application/vnd.ms-excel#ExportContacts.xls" 
recordSetVar="contacts" extensions="ExportContactsExtension" >
<apex:pageBlock title="Contacts">
<apex:pageBlockTable value="{!contacts}" var="contact">
<apex:column value="{!contact.LastName}"/>
<apex:column value="{!contact.FirstName}"/>
<apex:column value="{!contact.Name}"/>
<apex:column value="{!contact.MailingCity}"/>
<apex:column value="{!contact.Phone}"/>
<apex:column value="{!contact.Fax}"/>
<apex:column value="{!contact.MobilePhone}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

 

 

The ExportContactsExtension.cls is defined like:

 

public class ExportContactsExtension {

    public ExportContactsExtension(ApexPages.StandardSetController controller) {
    	//set the page size so all records will be exported
    	controller.setPageSize(controller.getResultSize());
    }
    
}

 

The question is can I export the specific fields specified in the contacts view?  On the ExportContacts.page, I have to define the fields to export, like last name, first name, etc.  Now if I create a new contacts view and add say the email address, I'll see it on the page, but if I click the export button, it doesn't include the email address.  Can I make that export dynamic to include all of the values from the current view?

 

  • July 30, 2010
  • Like
  • 0

Is it possible to export a custom contact view to Excel?  I have a button that goes to the ExportContacts.page that is defined like:

 

 

<apex:page standardController="Contact" contenttype="application/vnd.ms-excel#ExportContacts.xls" 
recordSetVar="contacts" extensions="ExportContactsExtension" >
<apex:pageBlock title="Contacts">
<apex:pageBlockTable value="{!contacts}" var="contact">
<apex:column value="{!contact.LastName}"/>
<apex:column value="{!contact.FirstName}"/>
<apex:column value="{!contact.Name}"/>
<apex:column value="{!contact.MailingCity}"/>
<apex:column value="{!contact.Phone}"/>
<apex:column value="{!contact.Fax}"/>
<apex:column value="{!contact.MobilePhone}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

 

 

The ExportContactsExtension.cls is defined like:

 

public class ExportContactsExtension {

    public ExportContactsExtension(ApexPages.StandardSetController controller) {
    	//set the page size so all records will be exported
    	controller.setPageSize(controller.getResultSize());
    }
    
}

 

The question is can I export the specific fields specified in the contacts view?  On the ExportContacts.page, I have to define the fields to export, like last name, first name, etc.  Now if I create a new contacts view and add say the email address, I'll see it on the page, but if I click the export button, it doesn't include the email address.  Can I make that export dynamic to include all of the values from the current view?

 

  • July 30, 2010
  • Like
  • 0