Skip to main content

I have been trying to generate a document publisher report on a Project that creates a related table from the Targets module. Every approach I’ve tried has caused the file to be corrupted with the error

 “Word found unreadable content in test.docx. Do you want to recover the contents of this document? 

Approaches tried

  • Targets via AssociatedItem (the obvious answer)
  • Targets with my own reverse reference
  • Targets via ContributingWorkItems (not sure if this is a real capability)
  • Contributions AssociatedItem
  • TargetHierarchyLink with my own reverse reference

I noticed the doc publisher macro template doesn’t include any reference to Targets or Objectives, so I’m wondering if perhaps it’s just not supported?

I did verify that Slide Publisher can pull the same data out, so definitely just a problem specific to makin word docs.

Interested to hear from anyone who has managed to generate a related table of targets in document publisher, and what sort of comment syntax you’re using :)

Hello ​@KarlRenner ,

You're right, generating a related table of Targets or Contributions in Document Publisher can be challenging. While these objects aren’t explicitly referenced in the default macro templates, we’ve tested and confirmed that it is possible to include associated Targets from a Project without issue—provided the setup is correct.

A few tips that might help:

  • Targets are “Reference to Object” fields in the Project, and there's no native link in AW, so macro syntax must be precise.

  • Incorrect macro formatting can cause Word file corruption errors—even when the data is valid.

  • Start with a simple template (one field, one Target) to confirm the structure works.

Since it works in Slide Publisher, this likely points to a Word-specific issue—possibly an undocumented limitation. If the problem persists, it’s worth reaching out to Planview Support.
 

Curious to hear from others—
Has anyone else successfully pulled Targets or Contributions into a Word report via Document Publisher?
What worked for you?
 


Hi Archana,

Thanks for the reply and for taking the time to test this out! Could you possibly share the syntax you used? I’ve tried a lot of different ways and so far no method has pulled data from Targets or Objectives, if you have the comment text to hand it would help me a lot to see working code as an example!

K


@KarlRenner You can get the associated Targets and Contributions from Project objects via doc publisher. Just use the doc publisher template with ‘associatedItems’ for relation field then call the necessary data in the fields as required. Below is an example

For relation
> !field=Project.Targets
!relationfield=AssociatedItem ]

For Field
{ !field=Targets.name }


Hi ​@KarlRenner 

The following syntax has worked for Targets:

Link Comment:

d !field=Project.Targets !relationfield=AssociatedItem ]

Record Comment:

{ !field=Targets.Name }

 

And similarly for Contributions:

Link Comment:

o !field=Project.Contributions !relationfield=AssociatedItem ]

Record Comment:

{ !field=Contributions.Name }

 

Finding the right relationships to reference can be challenging at first - the more you use Document Publisher the more familiar with the logic you’ll become! I find the AdaptiveWork Metadata Explorer to be quite helpful in figuring this out - check out this link for more information.

I’ve not tested for Objectives but it would follow a similar pattern.Try it out and let us know how you get on!


Thank you so much for the advice. I had a collection of overlapping issues that was causing the problem. I think the original problem was that one of the columns in my Word template had a lot of surplus xml, that caused the document to be corrupt when I ran a macro in it. As I expanded my debugging in different directions I introduced other problems because I misunderstood how to use the metadata reference. 

Anyway, once I started fresh with the suggested code it worked first try and much forehead slapping ensued. After a couple more hours I figured out the Word table was the problem, deleted it made a new one and now it’s all fine. Good learning experience! Thanks again all!


Reply