Exporting php to excel, text-aligment not working
<p>Hi guys i have been experiencing a rare alignment while exporting php table to excel.
I have set text-alignment:left but still not working. 
I have also searched for cell alignment but haven't found the solution.</p>

<p>Here is an image of my table without exporting it to vnd-ms-excel:
<a href="https://i.stack.imgur.com/9fd5w.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9fd5w.png" alt="enter image description here"></a></p>

<p>And while exporting this happens:</p>

<p><a href="https://i.stack.imgur.com/mOfNU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mOfNU.png" alt="enter image description here"></a></p>

<p>I don't know why the excel file has this alignment, i will add my code but is not pretty clean so i will show the header:</p>

<pre><code>// The function header by sending raw excel
    header("Content-type: application/vnd-ms-excel");

// Defines the name of the export file "codelution-export.xls"
    header("Content-Disposition: attachment; filename=horarios-$fecha.xls");
</code></pre>

<p>And this is the part of my code where I add style to my table:</p>

<pre><code>echo '&lt;style&gt;table {width:595px;text-align:left;}
table{border-collapse: collapse;}table,th,td{border:1px solid #000;}&lt;/style&gt;';
</code></pre>

<p>As you can see in the second image some text is aligned left, other right and other centered.</p>