+ Start a Discussion
Vaib ParaVaib Para 

Visualforce to XML workbook declaration error.. Pls help

Hi all, I am getting an error when i use xmlns="urn:schemas-microsoft-com:office:excel" in two worksheetoptions, like it works for only sheet3 and not for sheet1 and sheet2.

It says cannot load content when i add xmlns tag in other two sheets...Pls Help

<apex:page controller="ExportToExcelMultipleSheets" contentType="application/vnd.ms-excel#Candidate.xls" cache="true">
 <apex:outputText value="{!xlsHeader}"/>
  <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x="urn:schemas-microsoft-com:office:excel">
<Styles>
      <Style ss:ID="Default" ss:Name="Normal">
         <Alignment ss:Vertical="Bottom" />
         <Borders />
         <Font />
         <Interior />
         <NumberFormat />
         <Protection />
      </Style>
   </Styles>
   <Worksheet ss:Name="Sheet1">
      <Table ss:ExpandedColumnCount="100">
         <Row>
            <Cell>
               <Data ss:Type="String">cell a1</Data>
            </Cell>
            <Cell>
               <Data ss:Type="String">cell b2</Data>
            </Cell>
         </Row>
         <Row>
            <Cell>
               <Data ss:Type="String">cell a2</Data>
            </Cell>
            <Cell>
               <Data ss:Type="String">cell b3</Data>
            </Cell>
         </Row>
      </Table>
      <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
   <PageSetup>
    <Layout x:Orientation="Landscape"/>
    <Header x:Data="&amp;A"/>
    <Footer x:Data="Page &amp;P of &amp;N"/>
   </PageSetup>
   <FitToPage/>
   <Print>
    <FitHeight>50</FitHeight>
    <ValidPrinterInfo/>
    <PaperSizeIndex>9</PaperSizeIndex>
    <Scale>35</Scale>
    <HorizontalResolution>600</HorizontalResolution>
    <VerticalResolution>600</VerticalResolution>
   </Print>
   <ShowPageBreakZoom/>
   <PageBreakZoom>100</PageBreakZoom>
   <FreezePanes/>
   <FrozenNoSplit/>
   <SplitHorizontal>1</SplitHorizontal>
   <TopRowBottomPane>1</TopRowBottomPane>
   <SplitVertical>2</SplitVertical>
   <LeftColumnRightPane>2</LeftColumnRightPane>
   <ActivePane>0</ActivePane>
   <Panes>
    <Pane>
     <Number>3</Number>
    </Pane>
    <Pane>
     <Number>1</Number>
    </Pane>
    <Pane>
     <Number>2</Number>
    </Pane>
    <Pane>
     <Number>0</Number>
    </Pane>
   </Panes>
   <ProtectObjects>False</ProtectObjects>
   <ProtectScenarios>False</ProtectScenarios>
  </WorksheetOptions>
   </Worksheet>
   <Worksheet ss:Name="Sheet2">
      <Table ss:ExpandedColumnCount="100">
         <Row>
            <Cell>
               <Data ss:Type="String">cell a1</Data>
            </Cell>
            <Cell>
               <Data ss:Type="String">cell b2</Data>
            </Cell>
         </Row>
         <Row>
            <Cell>
               <Data ss:Type="String">cell a2</Data>
            </Cell>
            <Cell>
               <Data ss:Type="String">cell b3</Data>
            </Cell>
         </Row>
      </Table>
      <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
   
  </WorksheetOptions>
   </Worksheet>
<Worksheet ss:Name="Sheet3">
      <Table ss:ExpandedColumnCount="100">
<Row>
            <Cell>
               <Data ss:Type="String"></Data>
            </Cell>
            <Cell>
               <Data ss:Type="String">cell b2</Data>
            </Cell>
         </Row>
         
         <Row>
            <Cell>
               <Data ss:Type="String">cell a2</Data>
            </Cell>
            <Cell>
               <Data ss:Type="String">cell b3</Data>
            </Cell>
         </Row>
      </Table>
      <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
   
  </WorksheetOptions>
   </Worksheet>
</Workbook>
</apex:page>