Hello community!
I should fill a word template with information from a database. To fill the fields with the information, the fields have the docproperty set (e.g. "CreatedBy"). How can i write the docproperties?
On the following pages, I am going to fill tables with information. Is there a setting that the column headers are repeated on each page? How can i find out if a table row is split on two pages?
Thank you for the information.
Hi grubarec,
I'm not sure what you mean by docproperties but if you need some help creating a table using our Word library then I recommend that you take a look at the following documentation:http://help.infragistics.com/doc/WPF/2015.1/CLR4.0/?page=Word_Add_Table_to_Word_Document.html
For column headers, all you should need to do is specify which row in the table is the header row using the IsHeaderRow property. This property determines whether the associated row is repeated at the top of each page on which it appears. I don't believe there is a way to find out if a table row is split on two pages though. You can allow this though by setting the AllowPageBreak property. This property indicates whether the associated row can span across multiple pages.
Hello Rob!
Thank you for the information about the table and the IsHeaderRow property. Can you tell me how I can jump to a certain bookmark and insert my table there?
DocProperty: https://support.office.com/en-au/article/Field-codes-DocProperty-field-bf00526e-18cd-4515-8c8e-39d59094395a?ui=en-US&rs=en-AU&ad=AU
The Infragistics Word Library does not currently support bookmarks so jumping to one is not possible. I recommend that you submit this as a new product idea for the Word Library here: http://ideas.infragistics.com. If you submit this idea please be sure to include a link back to this forum thread so our product management staff will be able to look back at it if necessary.
As for DocProperty, you can set the document properties by going through the WordDocumentWriter.DocumentProperties:http://help.infragistics.com/doc/WPF/2015.1/CLR4.0/?page=InfragisticsWPF4.Documents.IO.v15.1~Infragistics.Documents.Word.WordDocumentProperties_members.html
Maybe you know an other way to solve my problem without the bookmarks.
- [unsolved] After I have filled the document properties, I have to jump to a certain location- [solved by the examples] insert there a table and fill it with information. I have to do this repeadetly on different locations. - [unsolved] After the tables have been filled, the "table of content" must be updated. - [solved by the examples] Save the document and show it to the user.
Thank you for the support
May I ask why you need to jump around to different locations in the word document? You are building the document from scratch correct? If that's the case then you just need to make sure you create the tables and add them to the document in the correct order relative to all the other content. There is no need to jump around.
The document is not built from scratch. I am using a template (.dotx) and I have to insert single values (created by, released by, ... defindied in the document properties) and tables at certain locations. As the tables (e.g. referenced documents, abbreviations, ...) are placed in different chapters I have to jump around in the document.
The template is filled with other paragrahps e.g. "General warnings and advice" which divide the template into the different chapters. After I have written the changes to the template, the template is saved as document (.docx) and shown to the user.
I hope you understand my use case now.
Let me know if you have any further questions on this matter.
I understand your requirement now. Unfortunately the Infragistics Word Library can only create documents, it cannot load documents and then edit them so using the word library would not help.
You can load a docx file into the XamRichTextEditor, but this does not support template documents (.dotx). So you will most likely need to load a normal document as a "template" and then programmatically move the XamRichTextEditor cursor to predefined positions so you can insert values into the document. Once everything has been inserted you can export the document.http://help.infragistics.com/doc/WPF/2015.1/CLR4.0/?page=xamRichTextEditor_Managing_Import_Export_DOCX.html
For document properties in the XamRichTextEditor, they can be accessed through XamRichTextEditor.Document.RootNode.DocumentProperties.