Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't insert Title as complex block with Template Processor #2698

Open
2 tasks
yojolo opened this issue Nov 19, 2024 · 0 comments
Open
2 tasks

Can't insert Title as complex block with Template Processor #2698

yojolo opened this issue Nov 19, 2024 · 0 comments

Comments

@yojolo
Copy link

yojolo commented Nov 19, 2024

Describe the bug and add attachments

Here is my code in which I'm trying to add a title using the setComplexBlock function

$templateProcessor = new TemplateProcessor($documentModelPath);
$title = new Title("Title 1", 1);
$title->setPhpWord(new PhpWord());
$templateProcessor->setComplexBlock("title", $title);
$templateProcessor->saveAs($outputFile);

With my word templace containing a simple page
image

Result is the text is replaced but as Normal text not title.
image

Also I needed to add the line $title->setPhpWord(new PhpWord()) to avoir the following error :
Call to a member function addBookmark() on null

If I missused the library or if there is any workaroung please let me know.
Thank you !

Expected behavior

I would expect the title to match the required depth and style and to be a real Word title that could be used is summary table, etc.

Steps to reproduce

$templateProcessor = new TemplateProcessor($documentModelPath);
$title = new Title("Title 1", 1);
$title->setPhpWord(new PhpWord());
$templateProcessor->setComplexBlock("title", $title);
$templateProcessor->saveAs($outputFile);

PHPWord version(s) where the bug happened

1.3.0

PHP version(s) where the bug happened

8.2

Priority

  • I want to crowdfund the bug fix (with @algora-io) and fund a community developer.
  • I want to pay the bug fix and fund a maintainer for that. (Contact @Progi1984)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant