Forum


Replies: 5   Views: 948
Issue with addtext(..) in addlist() item
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 dev@ram  · 03-04-2017 - 23:27

Thanks for your example but I am not able to get the importListStyle function to work. I created a new file called customStyles.docx and created a new list style within it called "RAMList1". However, whenever I call $docx->parseStyles I do not see the new style so I'm not able to obtain the id. Do you have an example of how to create a new style template containing custom List styles?

I then tried to use importStyles with the code below but this does not work either.

 

  $docx->importStyles(WORD_TEMPLATE_PATH.'customStyles.docx', 'merge', array('RAMList1'));
                    
  $itemList = array(
                    'Line 1',
                    'Line 2',
                    'Line 3',
                    'Line 4',
                    'Line 5'
    );

   $docx->addList($itemList, 'RAMList1');

Any suggestions?

I understand we can we use createParagraphStyle and then create a WordFragment with a 'pStyle' for every bullet but I'd like to avoid doing this as our arrays of data have already been built and we have a ton of different styles to apply within the document we are building. Creating and importing a document with custom styles would really suit our needs best.

Thanks in advance!