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
iceberg4uiceberg4u 

Problems in exporting Excel documents in MAC

I have used the same code as provided for exporting in my application.In Windows the excel gets exported in a proper manner but when I try to export in MAC OS I get the code written inside the script tag from Salesforce's side.Here is the gibberish code that I get

 


if(!window.sfdcPage){window.sfdcPage = new ApexPage();}
UserContext.initialize({'isAccessibleMode':false,'ampm':['AM','PM'],'locale':'en_US','dateTimeFormat':'M/d/yyyy h:mm a','today':'1/28/2009 2:37 AM','dateFormat':'M/d/yyyy','language':'en_US','siteUrlPrefix':'','userPreferences':[{'value':false,'index':119,'name':'HideUserLayoutStdFieldInfo'}
,{'value':false,'index':87,'name':'HideInlineSchedulingSplash'}
,{'value':false,'index':116,'name':'HideRPPWarning'}
,{'value':false,'index':115,'name':'DefaultTaskSendNotification'}
,{'value':false,'index':114,'name':'OverrideTaskSendNotification'}
,{'value':false,'index':112,'name':'HideInlineEditSplash'}
],'startOfWeek':'1'}
);

 

Is this a SalesForce bug or an error from our side.If it is an error do I need to log a bug?? 

Volker_factory42Volker_factory42

I get the same error. But till now I don't have a solution. But I'm still working on it. You said it working in Windows?

I recognized, that this "xls" File is open with writer in OpenOffice instead of calc. Maybe something wrong with the Header?

ColinKenworthy1ColinKenworthy1
I get the same problem with a Cases HTML table in an email. I get all that script in one of my data cells when I open the email in Outlook 2002.
LimesLimes

I have the same issue and although I see others posting the issue I've not seen a solution (maybe because its obvious once you dig a little).  Anyway the issue is that some tags (pageBlock, pageBlockTable ) are not (at least Mac OSX) excel friendly.  So I constructed my excel export page with apex:dataTable without using these tags and it worked appropriately.  Sample below.  Hope this saves someone else the hour or so it took me to figure out.

 

 

apex:page controller="TestController" contentType="application/vnd.ms-excel#GeocodeResults.xls" cache="true" showHeader="false" sidebar="false">
         <apex:dataTable value="{!searchResultList}" var="igeocode" id="resultTable">
                 <apex:column >
                     <apex:facet name="header">Name</apex:facet>
                     <apex:outputText value="{!igeocode.Contact_ID__r.Name}"/>
                 </apex:column>
                 <apex:column >
                     <apex:facet name="header">Street</apex:facet>
                     <apex:outputText value="{!igeocode.Street__c}"/>
                 </apex:column>
                 <apex:column >
                     <apex:facet name="header">City</apex:facet>
                     <apex:outputText value="{!igeocode.City__c}"/>
                 </apex:column>
                 <apex:column >
                     <apex:facet name="header">State</apex:facet>
                     <apex:outputText value="{!igeocode.State_Province__c}"/>
                 </apex:column>
                 <apex:column >
                     <apex:facet name="header">Source</apex:facet>
                     <apex:outputText value="{!igeocode.Source_Object_Type__c}"/>
                 </apex:column>
                 <apex:column >
                     <apex:facet name="header">Source Type</apex:facet>
                     <apex:outputText value="{!igeocode.Source_Object_Addr_Type__c}"/>
                 </apex:column>
                 <apex:column >
                     <apex:facet name="header">Latitude</apex:facet>
                     <apex:outputText value="{!igeocode.Latitude__c}"/>
                 </apex:column>
                 <apex:column >
                     <apex:facet name="header">Longitude</apex:facet>
                     <apex:outputText value="{!igeocode.Longitude__c}"/>
                 </apex:column>
          </apex:dataTable>
</apex:page>

 

 

cloudcodercloudcoder

I suspect your problem is that you are using outputField vs. outputText. Try it with outputText and all should be good.

danwattdanwatt

I had the same problem - was doing outputText for most fields, but was doing outputField for a date field. Switching to 100% outputText removed the Javascript.

KevinBrKevinBr

I also found that apex:sectionHeader also introduced the script garbage at the top of the document..
<apex:sectionHeader title="Report for User" />

I was able to replace this successfully with an apex:outputText instead:
<apex:outputText style="font:bold; font-size:large;" value="Report for User" />