Forum


Replies: 1   Views: 3681
Creating a list with tabs
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 clio  · 03-05-2015 - 07:42

Hello, I'm trying to create a list with tabs as following: =============== 1. Tabbed text: .........................item 1 2. Item 2 3. Item 3 =============== By the following code: =============== $style = array( 'tabPositions' =>array( array('type' => 'right', 'leader' => 'dot', 'position' => 4000), ) ); $docx->createParagraphStyle('myStyle', $style); $text = array(); $text[] = array('text' => 'Tabbed text: '); $text[] = array('text' => 'item 1', 'tab' => true); $item = new WordFragment($docx); $item->addText($text, array('pStyle' => 'myStyle')); $docx->addList(array( $item, 'Item 2', 'Item 3' ), 'myListStyleDefinedBefore'); =============== However I got the following result: =============== 1. Tabbed text: item 1 2. Item 2 3. Item 3 =============== Is there any way to achieve this? Best regards, Henry

Posted by admin  · 04-05-2015 - 13:58

Hello, You need to create a custom style (with Word or phpdocx) and then import it to be used in the document. Please check these methods: http://www.phpdocx.com/api-documentation/layout-and-general/create-Word-custom-list-style-with-PHP http://www.phpdocx.com/api-documentation/layout-and-general/import-styles-from-a-Word-document-with-PHP Regards.