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)


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

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

And if you want to go beyond the microsoft eco-system, I have created a python script that translates a CSV into a PDF specification with an open source license if it helps you or the people stumbling upon your thread: https://github.com/JLoDoesIt/specification-latex (knowing that CSV creation from Sharepoint list is beyond simplicity)

  • While I appreciate the contribution and don't mean to diminish your achievement with your script, CSV format (i.e. Excel-sheet-like table columns and rows) does not really meet the formatting goals of the original question. – Dylan Cristy Mar 11 at 17:04

Since there has been some new activity on this question, I thought I'd take a moment to provide an updated answer for 2020/2021.

While the accepted answer stands, since C# code-behind and the OpenXML SDK was how I solved my problem back in 2015, I have recently done similar solutions entirely client-side in Javascript, by retrieving data from SharePoint lists through the REST API, assembling a Word doc completely in the browser using the docx.js library (GitHub repo here), and then saving the resulting .docx file back to SharePoint again using the REST API.

So this is now all possible in Javascript, without needing any C# server-side code.

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.