Forum


Replies: 5   Views: 3514
Titles are not working
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by ankietka  · 21-04-2012 - 11:33

Hi, I'm using PRO version.

After updating phpdocx titles does not working correctly. The problem is that instead of the default styles there are styles signed as Heading 1 PHPDOCX. What would not be a problem if although they were correctly assigned to the titles. Therefore, the titles that do not work does not work well as a list of contents. Enclosed is an example php code

[code]require_once '../../classes/CreateDocx.inc';

$docx = new CreateDocx();
$docx->setLanguage('pl-PL');
$docx->addTableContents('Arial');
$paramsTitle = array(
'val' => 1,
'u' => 'single',
'font' => 'Blackadder ITC',
'sz' => 22
);

$docx->addTitle('Lorem ipsum dolor sit amet.', $paramsTitle);
$paramsTitle = array(
'val' => 1,
'u' => 'single',
'font' => 'Blackadder ITC',
'sz' => 22
);

$docx->addTitle('Lorem ipsum dolor sit amet.', $paramsTitle);
$paramsTitle = array(
'val' => 1,
'u' => 'single',
'font' => 'Blackadder ITC',
'sz' => 22
);

$docx->addTitle('Lorem ipsum dolor sit amet.', $paramsTitle);
$docx->createDocx('../docx/example_tablecontents');[/code]

Did You had the same problem?

Regards

Posted by admin  · 11-04-2013 - 12:13

Titles are not naturally assigned in Word to the TOC. We know that sounds weird but it is the way Word handles them by default.
If you want to generate a Heading you should use the styles for that that you may get from parse styles method and that you have already correctly identified as Heading 1 PHPDOCX, Heading 2 PHPDOCX, etcetera...

Posted by dln  · 11-04-2013 - 12:13

I also have the same problem ,when I update my TOC (press F9), it says that no “words” can be found, this why?

Posted by dpalermo  · 11-04-2013 - 12:13

Hi

I resolve it in this way:

instead of to use addTitle(), i used:

[code]addText("Title", array('pStyle' => 'Heading1PHPDOCX'));[/code]


Please, insert this in api documentation online.

DP

Posted by admin  · 11-04-2013 - 12:13

Hello,

This post is 1 year old, the new versions of PHPDocX have more options to create titles.

Regards.