Open
Description
Describe the Bug
Hi there. When i try to generate .docx from html, that contains table, the table in result .docx documents is horizontally "mirrored". For example, if i have two columns, first column shown as last, and last - as first.
Steps to Reproduce
Please provide a code sample that reproduces the issue.
<?php
require "vendor/autoload.php";
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$phpWord->setDefaultFontName('Arial');
$phpWord->setDefaultFontSize(12);
$properties = $phpWord->getDocInfo();
$properties->setCreator('My doc');
$properties->setCompany('My doc');
$properties->setTitle('My doc');
$properties->setDescription('My doc');
$properties->setCategory('My doc');
$properties->setLastModifiedBy('My doc');
$properties->setCreated(time());
$properties->setModified(time());
$properties->setSubject('My doc');
$properties->setKeywords('My, Doc, Yeah');
$sectionStyle = array(
'orientation' => 'portrait',
'marginTop' => \PhpOffice\PhpWord\Shared\Converter::pixelToTwip(40),
'marginLeft' => \PhpOffice\PhpWord\Shared\Converter::pixelToTwip(40),
'marginRight' => \PhpOffice\PhpWord\Shared\Converter::pixelToTwip(40),
'colsNum' => 1,
'pageNumberingStart' => 1,
'borderBottomSize'=>100,
'borderBottomColor'=>'ffffff'
);
$section = $phpWord->addSection($sectionStyle);
$html2 = '<table>';
$html2 .= '<tr>';
$html2 .= '<td>Something 1</td>';
$html2 .= '<td>Something 2</td>';
$html2 .= '</tr>';
$html2 .= '<tr>';
$html2 .= '<td>Another 1</td>';
$html2 .= '<td>Another 2</td>';
$html2 .= '</tr>';
$html2 .= '</table>';
\PhpOffice\PhpWord\Shared\Html::addHtml($section, $html2);
header("Content-Description: File Transfer");
header('Content-Disposition: attachment; filename="first.docx"');
header('Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document');
header('Content-Transfer-Encoding: binary');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Expires: 0');
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$xmlWriter->save("php://output");
Expected Behavior
I want to see in generated document something like:
Something 1 | Something 2
Another 1 | Another 2
Current Behavior
But i see:
Something 2 | Something 1
Another 2 | Another 1
Context
Please fill in your environment information:
- PHP Version: 7.3
- PHPWord Version: 0.18.3