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
ArunaAruna 

I am trying to create excel sheet with multiple tabs using visulaforce page

I am trying to create excel sheet with multiple tabs using visulaforce page .
I am facing some issues in formating number for example below cell is having number formate with comma separated but when I look @ out put excel sheet the number is not with comma 
<Cell ss:StyleID="s23"><Data ss:Type="Number">1,76,213</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="Number">680</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="Number">465</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="Number">4,756</Data></Cell>
                
                <Cell ss:StyleID="s23"><Data ss:Type="Number">4,566</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="Number">4,35,353</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="Number">567</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="Number">4,564</Data></Cell>
                
                <Cell ss:StyleID="s23"><Data ss:Type="Number">26,752</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="Number">23,015</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="Number">6</Data></Cell>
                <Cell ss:StyleID="s23"><Data ss:Type="Number">4,56,6</Data></Cell>

Out put, if you look @ below screen i need to put some % and $ and different symbols in the cells .
when I ma trying to put those symbols excel sheet is not considering and it is not opening getting file is corrupted and when see the more details is saying one of the cell is having invalid data.

NumberFormateIssue

any please suggest how to formate a number using apex visualforce.
Example will be help full
 
Best Answer chosen by Aruna
ArunaAruna
Thank you for your replay I appreciate your help. Sure next time will do post in EXcel XML structure 

Below is the solution for my question.

<Style ss:ID="s13">
        <Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="12" ss:Color="#000000"  ss:Arial="1" bgcolor="#FFFF33"/>
        <Interior ss:Color="#FFFF33" ss:Pattern="Solid"/>
        <NumberFormat ss:Format="Currency"/>
    </Style>
    
    <Style ss:ID="s131">
        <Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="12" ss:Color="#000000"  ss:Arial="1" bgcolor="#FFFF33"/>
        <Interior ss:Color="#FFFF33" ss:Pattern="Solid"/>
        <NumberFormat ss:Format="Percent"/>
    </Style>

All Answers

pconpcon
To have this formatted you need to setup number formatting [1] [2].  If you add these to your Visualforce page correctly they should do what you are looking for.  I would suggest that if you have any issues like this in the future that do not pertain directly to Visualforce but instead to how to use the Excel XML structure that you post them to an Excel specific forum since you will most likely get a faster response.

[1] http://wiert.me/2011/08/25/excel-xml-spreadsheet-styles-and-formatting/
[2] http://stackoverflow.com/questions/17110155/adding-formatting-to-excel-cell
ArunaAruna
Thank you for your replay I appreciate your help. Sure next time will do post in EXcel XML structure 

Below is the solution for my question.

<Style ss:ID="s13">
        <Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="12" ss:Color="#000000"  ss:Arial="1" bgcolor="#FFFF33"/>
        <Interior ss:Color="#FFFF33" ss:Pattern="Solid"/>
        <NumberFormat ss:Format="Currency"/>
    </Style>
    
    <Style ss:ID="s131">
        <Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="12" ss:Color="#000000"  ss:Arial="1" bgcolor="#FFFF33"/>
        <Interior ss:Color="#FFFF33" ss:Pattern="Solid"/>
        <NumberFormat ss:Format="Percent"/>
    </Style>
This was selected as the best answer