Forum


Replies: 1   Views: 372
Addproperties
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 netengine_at  · 01-03-2023 - 08:19

I'm having problems setting the subject property (using function addProperties). The title is getting set, but all the other properties stay empty. I have the feeling it has to do with the fact that I'm using a german version of word. When I look at the properties in word, subject is for example called Betreff, could that be the Problem?

 

$properties = [
 'title'         => 'Title',
 'subject'       => 'Subject,
 'creator'       => 'a',
 'keywords'      => 'b',
 'description'   => 'c',
 'category'      => 'd',
 'Manager'       => 'e',
 'Company'       => 'g',
 'custom'        => [
  'Betreff' => ['text' => 'Subject']
 ]
];

$docx->addProperties($properties);

 

Posted by admin  · 01-03-2023 - 08:46

Hello,

All DOCX documents use the same internal XML files. It doesn't matter the language/region version of MS Word you are using. We have MS Word versions of many languages and regions: english, german, spanish, french, asian languages, italian... and all of them work correctly with phpdocx.

We recommend you run the samples included in the package: LayoutAndGeneral/addProperties folder and check the output.

Please note that your code has a PHP error:

'subject'       => 'Subject,

This line should be:

'subject'       => 'Subject',

If you send to contact[at]phpdocx.com the DOCX output after running your code (and the DOCX template if you are using any), we'll check it. Maybe you need to set a custom property for the DOCX you are using?

Regards.