2

I have a scenario where users will be adding list items to a custom list. Once a week, a single word document needs to be generated that includes content from all of the list items added that week.

I have seen how, using a workflow, you can insert column data from a list item into a document template, but it seems as though this will generate one word document per list item, and I need to combine data from multiple list items into the same doc, formatted roughly as follows:

Column 1 value (from list item 1)

  1. Column 2 value (from list item 1)
  2. Column 3 value (from list item 1)

Column 1 value (from list item 2)

  1. Column 2 value (from list item 2)
  2. Column 3 value (from list item 2)

etc...

Is there a way to set up a repeating templated section in a Word doc and have a workflow generate a new section per list item? This could be a 2010 workflow or a 2013 workflow.

Or is this something I'm going to have to accomplish with C#?

  • Hi, where you able to get this working? I'm interested in doing something similar for monthly reports, taking office A and office B update for the month from a list and generating a word document with that. – Yugo Dec 8 '16 at 21:01
  • 1
    @Yugo I was able to get it working, but not as a workflow. I had to write some pretty extensive C# in a custom webpart and used the OpenXML library to interact with the Word document. I did not use a timer job as suggested in the answer because I wanted the users to have the option of creating the document at whatever time they needed to, so, I made a webpart with a button that kicked off all the server-side processing. – Dylan Cristy Dec 8 '16 at 21:47
0

Its not possible also workflow is not a best solution for this scenario. You need to create a custom SharePoint timer job and have it run on a weekly basis.

In the timer job solution, You can use C# and Open XML or office dll's to generate the custom word document based on the list fields.

you can refer the below links for better understanding:

Open XML

Custom SP timer job creation

Also, This

Apart from this, if you want to have an on-demand feature then you can even create a custom feature action based on list scope in which you can invoke an layouts page for generating the word documents.

Refer this

  • It does need to be on-demand and not a timer job. I am going down the route of a custom ribbon action opening an application page which has the code to generate the document. I'd just like to point out though that since we have to go to C# / code behind, it would also be possible to create a custom workflow activity that contains all the necessary code, and then use that custom activity in a workflow to generate the document. – Dylan Cristy May 20 '15 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.