Is it possible to generate a single Word document with content from multiple list items via a workflow?
-
03-10-2020 - |
Pregunta
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)
- Column 2 value (from list item 1)
- Column 3 value (from list item 1)
Column 1 value (from list item 2)
- Column 2 value (from list item 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#?
Solución
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:
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.