HTML export into Excel, mso-data-placement: same-cell loses the line break -


i'm generating html document i'm serving excel spreadsheet. working fine except in first place, excel reading
line breaks new cell. found workaround that, , that's add <style>br { mso-data-placement:same-cell; }</style> sure enough keeps data in same cell, i'm losing line breaks , keeps in same line.

has else had problem?

i can't figure out life of me why happening. here full code:

<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/tr/rec-html40"> <head> <meta http-equiv=content-type content="text/html;charset=windows-1252"> <meta name=progid content=excel.sheet/> <meta name=generator content="microsoft excel 11"> <!--[if gte mso 9]><xml>         <x:excelworkbook><x:excelworksheets><x:excelworksheet>                 <x:name>sheet1</x:name>                 <x:worksheetoptions><x:panes>                 </x:panes></x:worksheetoptions>                 </x:excelworksheet></x:excelworksheets></x:excelworkbook> </xml> <![endif]--> <style> br {mso-data-placement:same-cell;} </style> <body> <table>   <tr>     <td colspan="2" style="font-size:14pt;font-weight:bold;"><?= $user['company_name'] ?> file system listing</th>   </tr>   <tr>     <td>&nbsp;</td>   </tr>   <tr>     <td colspan="2">1. enter or sort</td>   </tr>   <tr>     <td width="45">&nbsp;</td>     <td width="300">to enter</td>   </tr>   <tr>     <td>&nbsp;</td>     <td>to pay</td>   </tr>   <tr>     <td>&nbsp;</td>     <td>to do</td>   </tr>   <tr>     <td>&nbsp;</td>     <td>to file- completed</td>   </tr>   <tr>     <td>&nbsp;</td>     <td><?= $user['business_bank'] ?><br>deposit slips</td>   </tr>   <tr>     <td>&nbsp;</td>     <td>receipt sorting <?= $user['business_bank'] ?><br><?= $user['account1_name'] ?> card x<?= $user['account1_debit'] ?><br><?= $user['account1_name'] ?> x<?= $user['account1_num'] ?></td>   </tr> </table> </body> </html> 

you don't have closing "head" tag. if still doesn't work, try placing style inline. instance:

<br style="mso-data-placement:same-cell;" /> 

as opposed being in style tag. excel should evaluating head styles let's check if there's issue there.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -