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
Christian CequinaChristian Cequina 

Problem on generating an XML from VF page: Line break (
) doesn't work on Header and Footer

Hi everyone,

​Please help me on this problem.
I develop a VF page that generate an XML. My problem is '&#10;' doesn't work on <Header> and <Footer> tag.
The reason is '&' turns to '&amp;'  in XML . Is there any other way to do this.

Here is the my sample code:

<apex:page controller="MyController" sidebar="false" cache="true" contentType="application/vnd.ms-excel#{!fileTitle}.xls">
  <apex:outputText value="{!XmlHeader}"/>
    <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
              xmlns:o="urn:schemas-microsoft-com:office:office"
              xmlns:x="urn:schemas-microsoft-com:office:excel"
              xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
              xmlns:html="http://www.w3.org/TR/REC-html40">
      
<!---------------------------------- Documentation --------------------------------->
      <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
        <Author>     Salesforce Administrator </Author>
        <Created>    {!TODAY()} </Created>
        <Version>    1          </Version>
      </DocumentProperties>
 
<!----------------------------------------------- Worksheet --------------------------------------------->
    <Worksheet ss:Name="sheet">
        <Table>
            <Column/>
            <Column/>
            <Row>
                <Cell><Data ss:Type="String" >Title</Data></Cell>
                <Cell><Data ss:Type="String" >Description</Data></Cell>
            </Row>
        </Table>
        <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
          <PageSetup>
            <Layout x:Orientation="Landscape"/>
            <Header x:Margin="0.5" x:Data="{!'First line header&#10;second line header'}"/>
            <Footer x:Margin="0.5" x:Data="{!'First line footer&#10;second line footer'}"/>
            <PageMargins x:Bottom="0.5" x:Left="0.5" x:Right="0.5" x:Top="0.5"/>
          </PageSetUp>
          <Print>
            <ValidPrinterInfo/>
            <PaperSizeIndex>9</PaperSizeIndex>
            <Scale>58</Scale>
            <HorizontalResolution>600</HorizontalResolution>
            <VerticalResolution>600</VerticalResolution>
          </Print>
          <Zoom>100</Zoom>
          <DoNotDisplayGridlines/>
        </WorksheetOptions>            
      </Worksheet>
    </Workbook>
  <apex:outputText value="{!WorkbookEnd}"/>
</apex:page>
AbdelhakimAbdelhakim
Hi,
I Had the same problem
Try to change the Content-type to "application/textplain", and generate your XML in the controler, then display it as outputtext in VF page