Forum


Replies: 3   Views: 3605
Different headers and footers on each section
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 AndrewCooper  · 09-06-2016 - 07:28

Hi,

I need to create several headers and then determine on a case by case basis which header goes on each section of my word document. There was a previous topic about this where the suggestion was to use the Merge feature from the Corporate or Enterprise edition of phpdocx. I can't do this for a couple of reasons.

First, while my company intends to purchase the Corporate or Enterprise version, we aren't doing so until I've been able to prove that phpdocx will do what we need. 

Second, I want to avoid creating several different documents and then merging them all together. File system operations are expensive in terms of performance and are not an option in this case.

So, can phpdocx set a different header on each section without the merge feature?  I haven't been able to get it to do so yet and I haven't found any documentation to help me do this. Can someone point me in the right direction?

Thanks,

Andrew

Posted by admin  · 09-06-2016 - 08:30

Hello,

The only approach to use different headers and footers on each section is merging the DOCX. Phpdocx doesn't support any other solution to accomplish it.

About perfomance, just comment that the MultiMerge class is really fast.

Regards.

Posted by AndrewCooper  · 09-06-2016 - 10:05

Okay... Let me see if I have this correct.

I have 10 sections in my document.

  1. Has the Introduction Header and is not numbered.
  2. Has the standard Header and is not numbered.
  3. Has the standard Header and is numbered.
  4. Has the standard Header and is numbered.
  5. Has the standard Header and is numbered.
  6. Has the standard Header and is numbered.
  7. Has the standard Header and is numbered.
  8. Has the standard Header and is not numbered.
  9. Has the standard Header and is not numbered.
  10. Has no header at all.

Are you saying the only way to do this is to:

  1. Write 4 different files to the drive.  
  2. Then read each file off of the drive.  
  3. Then merge the the files together.  
  4. Then output that to the drive.

And... on top of that I can't even test that it is going to meet my needs in terms of performance and output without spending $500 - $1000?  That seems pretty harsh for functionality that doesn't seem to be that much of an edge case.

Posted by admin  · 09-06-2016 - 10:31

Hello,

As explained previously, that's the only way to do it using the current version of phpdocx. If instead of creating sections dynamically, they were fixed then you could use a template.

About pricing, there's a test license with up to 50% off. You can read about it in the banner available on http://www.phpdocx.com/updates

Of course,  we'll consider adding that feature without need to use the merging class. It's not a common request and until now the users that have needed to accomplish it are working perfectly and without issues using the merging class.

Regards.