Forum


Replies: 1   Views: 3057
Addproperties() - lastmodifiedby
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 FGI  · 13-10-2017 - 08:56

Hello,

When working with templates, it could be useful to change the "Last modified by" property (core.xml, dc:LastModifiedBy). This field contains the name of the "real" author in the company, which should be kept hidden for automatically generated documents spent all over the world.

I made a quick fix to implement this:

In CreateProperties.inc creator:

  • append 'lastModifiedBy' in $generalProperties array
  • append 'lastModifiedBy'=>'dc' in $nameSpaces array
 public function CreateProperties()
    {
        $generalProperties = array('lastModifiedBy','title', 'subject', 'creator', 'keywords', 'description', 'category', 'contentStatus', 'created', 'modified');
        $nameSpaces = array('lastModifiedBy'=>'dc','title' => 'dc', 'subject' => 'dc', 'creator' => 'dc', 'keywords' => 'cp', 'description' => 'dc', 'category' => 'cp', 'contentStatus' => 'cp', 'created' => 'dcterms', 'modified' => 'dcterms');
        ...

 

In CreateDocx.inc, function addProperties(), also add the lastModifiedBy field in self::$propsCore:

if (!empty($values['lastModifiedBy']) || !empty($values['title']) || !empty($values['subject']) || !empty($values['creator']) || !empty($values['keywords']) || !empty($values['description']) || !empty($values['category']) || !empty($values['contentStatus']) || !empty($values['created']) || !empty($values['modified'])) {
    self::$propsCore = $prop->createProperties($values, self::$propsCore);
}

 

Best regards,