<Disclaimer>This is personal notes of what I retained during the session. This can be incomplete, partially right or wrong. It is just part of the notes I took and what retained my attention. Nothing prevents the user to get more information on their favorite web site.</Disclaimer>
Description of a proposal generation system on SharePoint 2010 for a legal department.
Scenarios cover generating documents from database, compose a new document from multiple ones and to split a document into several ones.
From a BCS entity, the goal is to create a job that generates a single document for every people entity stored in a database, containing the data about the person. The generated document is stored in a document library, all of that without any human interaction.
To create a proposal, the client is selected, title is specified, proposal template and layout is selected. Then, sections are built by picking content. Each section can be send for approval. Finally, the document is generated and stored in a document library.
The system allows users to write new Word template and use the new templates, by using controls. The engine takes the template and fill-in the content controls, using the data located in a database.
From the content control, the <Config> tag is used to read the BCS configuration. DatabaseBackedMetadataCatalog object contains the complete list of BCS entities that would also available in the Central Administration. Type of content supported : Text, Rich Text and Images.
In BCS, one ECT per snippets.
Templates are stored in a dedicated document library. To create or modify a template, switch the document into design mode. Thus, you can add the content controls you need. The first one to add is the Config one that tells what ECT is associated with this Word document. The content control’s Title specify the type of data (Text, Image, etc) and Tag specifies the name of the entity’s property to insert. No need to code to create the template.
A Word document is just a zipped file containing other XML documents. The Word content is defined in the document.xml file. The goal of OpenXML is to manipulate Office documents without the client applications. But, the format is quite complicated. One of the reason why we haven’t seen many document generation based solution is the complexity of OpenXML. A really useful tool is Document Builder.
A document is a collection of Paragraphs that can contain Image or Comment. And a Comment can also have an Image inside. A Paragraph containing a Header can also SmartArt and Image => Interrelated Markup.
PowerTools on CodePlex combines PowerShell and OpenXML and can be used to merge comments, accept tracked changes, convert to HTML and helps composing or splitting documents.
The steps do build a composed document is first to create a set of sources and send them to Document Builder. For splitting, the division is done using queries and for each item, use Document Builder to create a new document.
Document Builder comes as a class that has to be added to the Visual Studio project.
Word Automation Services adds the Save As functionality to SharePoint, converting to HTML, XML, PDF or XPS. It runs periodically and can be configured to only convert to some type of documents.
The opinions expressed herein are my own personal opinions and do not represent
my employer's view in any way.