Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Ability to use field AUTHOR - Word #2810

Open
@dregini

Description

Describe the problem

I think it would be useful to add something like

$header->addPreserveText("{AUTHOR}");
or
$header->addField('AUTHOR')

this way the field will auto adapt if the user change the author of the word file

Describe the expected behavior

i tried to edit the PhpWord/Writer/Word2007/Element/Field.php:

 private function writeAuthor(ElementField $element): void
 {
 $xmlWriter = $this->getXmlWriter();
 $xmlWriter->startElement('w:fldSimple');
 $xmlWriter->writeAttribute('w:instr', 'AUTHOR');
 $xmlWriter->endElement(); // w:fldSimple 
}

and in PhpWord/element/Field.php:

protected $fieldsArray = [
 'AUTHOR' => [ ],
 ...
];

Priority

  • I want to crowdfund the feature (with @algora-io) and fund a community developer.
  • I want to pay the feature and fund a maintainer for that. (Contact @Progi1984)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /