excel template direction to RTL in libreo office
<p>this template is correct in MS-EXCEL for showing rtl tables and content but i can't edit this to showing correctly in libreo office:</p>

<pre><code>$this-&gt;msxml = "&lt;html dir=rtl xmlns:o='urn:schemas-microsoft-com:office:office'
                xmlns:w='urn:schemas-microsoft-com:office:excel'
                xmlns='http://www.w3.org/TR/REC-html40'&gt;

                &lt;head&gt;
                &lt;meta http-equiv=Content-Type content='text/html; charset=utf-8'&gt;
                &lt;meta name=ProgId content=Excel.Document&gt;
                &lt;meta name=Generator content='Microsoft Excel 11'&gt;
                &lt;meta name=Originator content='Microsoft Excel 11'&gt;
                &lt;!--[if gte mso 9]&gt;&lt;xml&gt;
                &lt;o:DocumentProperties&gt;
                  &lt;o:Author&gt;Prithwiraj Bose EDITED BY pishguy@gmail.com&lt;/o:Author&gt;
                  &lt;o:LastAuthor&gt;Prithwiraj Bose&lt;/o:LastAuthor&gt;
                  &lt;o:Revision&gt;1&lt;/o:Revision&gt;
                  &lt;o:TotalTime&gt;1&lt;/o:TotalTime&gt;
                  &lt;o:Created&gt;Wednesday 15 August 2012&lt;/o:Created&gt;
                  &lt;o:LastSaved&gt;2010-07-09T14:08:00Z&lt;/o:LastSaved&gt;
                  &lt;o:Pages&gt;1&lt;/o:Pages&gt;
                  &lt;o:Words&gt;&lt;/o:Words&gt;
                  &lt;o:Characters&gt;&lt;/o:Characters&gt;
                  &lt;o:Company&gt;&lt;/o:Company&gt;
                  &lt;o:Lines&gt;1&lt;/o:Lines&gt;
                  &lt;o:Paragraphs&gt;1&lt;/o:Paragraphs&gt;
                  &lt;o:CharactersWithSpaces&gt;&lt;/o:CharactersWithSpaces&gt;
                  &lt;o:Version&gt;11.9999&lt;/o:Version&gt;
                &lt;/o:DocumentProperties&gt;
                &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
                &lt;w:ExcelDocument&gt;
                  &lt;w:View&gt;Print&lt;/w:View&gt;
                  &lt;w:Zoom&gt;80&lt;/w:Zoom&gt;
                  &lt;w:SpellingState&gt;Clean&lt;/w:SpellingState&gt;
                  &lt;w:GrammarState&gt;Clean&lt;/w:GrammarState&gt;
                  &lt;w:PunctuationKerning/&gt;
                  &lt;w:ValidateAgainstSchemas/&gt;
                  &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
                  &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
                  &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
                  &lt;w:Compatibility&gt;
                  &lt;w:BreakWrappedTables/&gt;
                  &lt;w:SnapToGridInCell/&gt;
                  &lt;w:WrapTextWithPunct/&gt;
                  &lt;w:UseAsianBreakRules/&gt;
                  &lt;w:DontGrowAutofit/&gt;
                  &lt;/w:Compatibility&gt;
                  &lt;w:BrowserLevel&gt;InternetExplorer-Firefox-Chrome-Konqueror&lt;/w:BrowserLevel&gt;
                &lt;/w:ExcelDocument&gt;
                &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
                &lt;w:LatentStyles DefLockedState='false' LatentStyleCount='156'&gt;
                &lt;/w:LatentStyles&gt;
                &lt;/xml&gt;&lt;![endif]--&gt;
                &lt;style&gt;
                &lt;!--
                /* Style Definitions */
                p.MsoNormal, li.MsoNormal, div.MsoNormal
                    {mso-style-parent:'';
                    margin:0cm;
                    margin-bottom:.0001pt;
                    mso-pagination:widow-orphan;
                    font-size:12.0pt;
                    font-family:'Times New Roman';
                    mso-fareast-font-family:'Times New Roman';}
                @page Section1
                    {size:595.3pt 841.9pt;
                    margin:72.0pt 90.0pt 72.0pt 90.0pt;
                    mso-header-margin:35.4pt;
                    mso-footer-margin:35.4pt;
                    mso-paper-source:0;}
                div.Section1
                    {page:Section1;}
                --&gt;
                &lt;/style&gt;
                &lt;!--[if gte mso 10]&gt;
                &lt;style&gt;
                /* Style Definitions */
                table.MsoNormalTable
                    {mso-style-name:'Table Normal';
                    mso-tstyle-rowband-size:0;
                    mso-tstyle-colband-size:0;
                    mso-style-noshow:yes;
                    mso-style-parent:'';
                    mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
                    mso-para-margin:0cm;
                    mso-para-padding:0cm;
                    mso-para-margin-bottom:.0001pt;
                    mso-pagination:widow-orphan;
                    font-size:10.0pt;
                    font-family:'Tahoma';
                    mso-ansi-language:#0400;
                    mso-fareast-language:#0400;
                    border:3px;
                    mso-bidi-language:#0400;}
                &lt;/style&gt;
                &lt;![endif]--&gt;
                &lt;/head&gt;
                &lt;body lang=FA&gt;";
</code></pre>

<p>PHP code:</p>

<pre><code>private function createXls()
{
    $this-&gt;xlcontent="&lt;table align='right' cellspacing='0' cellpadding='0' border='0' style='border-collapse: collapse;table-layout:fixed'  width='100%'&gt;";
    for($r=1;$r&lt;=$this-&gt;rowmax;$r++)
    {
        $this-&gt;xlcontent .= "&lt;tr&gt;";
        for($c=1;$c&lt;=$this-&gt;colmax;$c++)
        {
            if($this-&gt;cell[$c][$r]!="" || $this-&gt;cell[$c][$r]!=NULL)
            {
                if($this-&gt;prepareCellStyle[$c][$r]!="" || $this-&gt;prepareCellStyle[$c][$r]!=NULL)
                    $this-&gt;xlcontent .= "&lt;td id='text' width='".$strlenght."' style=\"".$this-&gt;prepareCellStyle[$c][$r]."\"&gt;".$this-&gt;cell[$c][$r]."&lt;/td&gt;";
                else
                    $this-&gt;xlcontent .= "&lt;td id='text' style='direction:rtl;text-align:right;font-family:Tahoma;text-decoration: none;vertical-align: middle;white-space: nowrap;'  &gt;".$this-&gt;cell[$c][$r]."&lt;/td&gt;";
            }
            else
            {
                if($this-&gt;prepareCellStyle[$c][$r]!="" || $this-&gt;prepareCellStyle[$c][$r]!=NULL)
                    $this-&gt;xlcontent .= "&lt;td id='text' width='".$strlenght."'  style=\"".$this-&gt;prepareCellStyle[$c][$r]."\"&gt;&amp;nbsp;&lt;/td&gt;";
                else
                    $this-&gt;xlcontent .= "&lt;td id='text' style='direction:rtl;text-align:right;font-family:Tahoma;text-decoration: none;vertical-align: middle;white-space: nowrap;' &gt;&amp;nbsp;&lt;/td&gt;";
            }
        }
        $this-&gt;xlcontent .= "&lt;/tr&gt;";
    }
    $this-&gt;xlcontent .= "&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;";
    $returnstring = $this-&gt;msxml.$this-&gt;xlcontent;
    return $returnstring;
}
</code></pre>
