Hi,
I am trying to add a paragraph with links to header. I am getting a "Document Corrupt" error from MS Word.
If I add the paragraph anywhere else in the document, it works.
Code to add paragraph to document:
<?php
require_once '/phpdocx/classes/CreateDocx.inc';
$docx = new CreateDocx();
$options =array('jc' => 'center', 'font' => 'Calibri', 'lineSpacing' => '0', 'lineSpacing' => 0, 'spacingTop' => 0,
// 'rawWordML' => true
);
$break = array('type' => 'lineBreak');
$companyline3_1 = array('sz'=>'7', 'type' => 'text', 'b' => 'on', 'text' => 'Website: ');
$companyline3_2 = array('type' => 'link', 'URL' => 'http://www.omnitechglobal.com', 'text' => 'http://www.omnitechglobal.com/', 'sz'=>'7');
$companyline4_1 = array('sz'=>'7', 'type' => 'text', 'b' => 'on', 'text' => 'Email: ');
$companyline4_2 = array( 'type' => 'link', 'URL' => 'mailto:gaurav.s@onmitechglobal.com', 'text' => 'gaurav.s@omnitechglobal.com', 'sz'=>'7');
$parameters = array($companyline3_1,$companyline3_2,$break,$companyline4_1,$companyline4_2,$break);
$docx->addParagraph($parameters, $options);
$docx->createDocx('Paragraph_Header_2');
?>
Code to add same paragraph to header:
<?php
require_once '/phpdocx/classes/CreateDocx.inc';
$docx = new CreateDocx();
$options =array('jc' => 'center', 'font' => 'Calibri', 'lineSpacing' => '0', 'lineSpacing' => 0, 'spacingTop' => 0,
'rawWordML' => true
);
$break = array('type' => 'lineBreak');
$companyline3_1 = array('sz'=>'7', 'type' => 'text', 'b' => 'on', 'text' => 'Website: ');
$companyline3_2 = array('type' => 'link', 'URL' => 'http://www.omnitechglobal.com', 'text' => 'http://www.omnitechglobal.com/', 'sz'=>'7');
$companyline4_1 = array('sz'=>'7', 'type' => 'text', 'b' => 'on', 'text' => 'Email: ');
$companyline4_2 = array( 'type' => 'link', 'URL' => 'mailto:gaurav.s@onmitechglobal.com', 'text' => 'gaurav.s@omnitechglobal.com', 'sz'=>'7');
$parameters = array($companyline3_1,$companyline3_2,$break,$companyline4_1,$companyline4_2,$break);
$finalheader=$docx->addParagraph($parameters, $options);
$headerWordML = $docx->createWordMLFragment(array($finalheader));
$docx->addHeader(array('default' => $headerWordML));
$docx->createDocx('Paragraph_Header_2');
?>
Is this a known bug or am I doing something wrong?