Wie man den Dokumentengenerator benutzt

Wie man den Dokumentengenerator benutzt

Mit dem Dokumentengenerator kannst du Microsoft Word-Dokumente aus SharePoint-Listenelementen erstellen.

Die Dokumente können individuell konfiguriert und gestaltet werden.
Dafür benötigst du zunächst ein fertiges Microsoft Word-Dokument, das als Vorlage für die Dokumentgenerator-Aktion dient.

Dieses Microsoft Word-Dokument muss die Spalten enthalten, deren Informationen später automatisch als Platzhalter in das Dokument eingefügt werden sollen.
Sobald dies erledigt ist, kannst du das Microsoft Word-Dokument über die benutzerdefinierte Aktion des Dokumentgenerators hochladen.

Wie man seine Vorlage erstellt

  1. Erstelle ein neues Microsoft Word-Dokument.
  2. Gestalte das Dokument so, dass es dem Erscheinungsbild und dem Gefühl der Organisation entspricht.
  3. Beziehe dich auf die Felder auf deinem SharePoint-Listenformular mit eckigen Klammern um den Feldnamen, z. B. [[Titel]].
    (Denke daran, den programmatischen Namen - Internal Name - und nicht den Anzeigenamen zu verwenden.
    Diese findet man unter "Dinge im Hintergrund" und dann "Spalten".)
  4. Speichere dein Microsoft Word-Dokument.



Wie man die Dokumentgenerator-Aktion erstellt

Es wird empfohlen, den Dokumentengenerator für ein gespeichertes Listenelement zu verwenden. Wenn du also ein Neues Formular verwendest, um neue Artikel zu erstellen, müsste die erste Aktion 'Formular speichern' sein.
Wenn du das Bearbeiten- oder Anzeigenformular verwendest, musst du die  Aktion "Speichern des Formulars" vor der Aktion "Dokument generieren" nicht verwenden.

Dokumentgenerator-Aktion erstellen

  1. Wähle in der Befehlsleiste "Aktionen" und klicke dann auf "Befehlsleiste", um oben in deinem Formular eine neue Aktionstaste hinzuzufügen.
  2. Klicke auf das "+"-Symbol im Seitenbereich der Aktionen der Kommandoleiste.
  3. Gib einen Anzeigenamen an.
  4. Setze ein Symbol für deine benutzerdefinierte Befehlsleiste-Taste.
  5. Klicke auf "Aktionen konfigurieren".






  1. Wähle aus der Liste den Aktionstyp "Dokument generieren".
  2. Lade dein gespeichertes Microsoft Word-Dokument als Vorlage hoch.
  3. Wähle unter "Datenquelle" "Für ein einzelnes Element".
  4. Wähle deine SharePoint-Liste aus (nur die Hauptliste, nicht die Unterliste).
  5. Stelle das Item-ID-Feld auf [[ID]] ein.
  6. Belasse den Standard "Ziel" auf "Im Browser öffnen".
  7. Setze das Dateinamen-Muster für deine Berichte. z. B. "Candidate-Summary-[[Title]]".
  8. Klicke auf "Speichern".


 

Du kannst jetzt deine Aktion der Befehlsleiste testen, indem du ein Element in deiner Liste öffnest oder bearbeitest.

 

Dokumentgenerator Microsoft Word-Dokumentsyntax 

Template expressionsAny kind of string Template Expression[[Title]] [[Firstname]] 
Assignment ExpressionsStart with "[[=" and any kind of string Expression[[= [[Title]] + ", " + [[Firstname]] ]]
Function Code ExpressionsStart with "[[{" in the Tag property. Write your complex expression as content in the placeholder[[{ var arr = [[@Web.GetValuesForQuery('OtherList', '<View></View>', 'Total')]]; var sum = 0; arr.forEach(n=>sum +=n); return sum; }]]
Lookup Values

Use the [[Lookup.FieldInternalName]] notation to get any value from the target list of a lookup

*doesn't work in Scheduled & Triggered actions

Examples:
[[Department.Code]]*
[[Department.Author]]*
[[Department.Key]] -> to get the item ID of the department
If ConditionsStart with [[if …]] and any kind of boolean Expression (Condition).
Ends with [[end if]] 
Everything between the starting and the ending tag will be visible if the condition is true. This can be text, an image etc.
[[if [[Budget]] > [[Outgoings]] ]]
[[Title]]
[[end if]]

[[if {return ([[Budget]] > [[Outgoings]]);} ]]
[[Title]]
[[end if]]

[[if [[Status]]!="Completed" ]]
[[Title]]
[[end if]]
Loops

Start with [[loop]] for looping over multiple items of the selected list.
If a CAML Query is configured for this action link, looping will be filtered according to it.
Start looping over the sublist items filtered by lookup to the parent list using one of the following methods:

1.SublistTitle. For example, [[loop SublistTitle]]
2.List ID. In this case you need to follow these steps:
- Create Variable in Action Builder with List ID as its values. During Package & Publish, this List ID will be automatically replaced with the ID of the list on the deployment site.
- In the document template use Variable placeholder.
For example, [[loop [[@Variables.SubItemListID]] ]]
Note: [[@Variables.SubItemListID]] placeholder should have space before double brackets.

Use filterlookupfield('field_internal_name') param to specify which lookup field to use for sublist in a case when several lookups on the same list exist. It’s optional where there is just one lookup field. Also RowLimit is hardcoded for 200 items for query, but the required number can be specified with the optional rowlimit(number) param.
If list that is not a sublist is selected (doesn’t have lookup to the list selected in action link configuration), no filtering will be applied.
Iteration ends with [[end loop]]

[[loop]]
[[Title]]
[[end loop]]

[[loop SubListTitle filterlookupfield('field_internal_name') rowlimit(number)]]
[[Title]]
[[Firstname]]
[[end loop]]
Filtered LoopsWhere SomeView is a view .aspx page title, such as AllItems.
The order and filter of the view are applied. If CAML query is added (optional), it is united with the view query using an ‘and’ operator.
[[loop SublistTitle view('SomeView') query('<Where><BeginsWith><FieldRef Name="Title" /><Value Type="Text">[[{return [[Title]];}]]</Value></BeginsWith></Where>')]]
[[Title]]
[[end loop]]
Loops over documents in sublibrariesUse the Scope="Recursive" property on the query to get documents in a folder, when used as sublibrary of a form. Combine recursive scope and filter in CAML query to filter the listed document’s metadata.[[loop SublibraryName query('<View Scope="Recursive"></View>')]]
[[FileLeafRef]]
[[Title]]
[[OtherField]]
[[end loop]]

[[loop SublibraryName query('<View Scope="Recursive"><Query><Where><Eq><FieldRef Name="IsActive" /><Value Type="Boolean">1</Value></Eq></Where><OrderBy></OrderBy></Query></View>')]]
[[FileLeafRef]]
[[Title]]
[[OtherField]]
[[end loop]]
Nested Loops

Looping over a sublist inside of the loop over multiple items of the parent list is supported.
Looping over several sublists, or a sublist of a sublist are supported as well.

In case [[@Loop.Parent.FirstName]] placeholder is used it allows retrieving parent loop data inside nested loop. Possible formats:
[[@Loop.Parent.Field1]]
[[@Loop.Parent.LookupField1.Field2]]
[[@Loop.Parent.Parent.Field3]]
[[@Loop.CurentIndex]]
[[@Loop.Count]]
 

[[loop]]
     [[Title]]
          [[loop SubList1]]
               [[Title]]
               [[Firstname]]
          [[end loop]] 
          [[loop SubList2]] 
               [[Title]] 
               [[Firstname]] 
          [[end loop]] 
[[end loop]]

 

[[loop]]
     [[Title]]
          [[loop SubListTitle]]
               [[Title]]
               [[Firstname]]
                    [[loop SubListTitleOfSublist]] 
                         [[Title]] 
                         [[Firstname]] 
                    [[end loop]]
          [[end loop]] 
[[end loop]]

Loops over table rowsIt is possible to loop over table rows by adding the loop inside the table. In the case of nested loops, if the loop on the parent list is placed into the external table, this will render a separate table for each parent item[[loop
SubListTitle]]
[[Title]] [[Firstname]] [[Lastname]]
[[end loop]] 

[[loop]] [[Title]]
[[Title]] [[Firstname]] [[Lastname]]
[[end loop]] 
[[end loop]]
Image

Show an image inside the document.
You can optionally specify the static width and height of the image and also a max/min width and height.
Width/height parameters are not mandatory; they can be '' (empty string) or null. 

Note: [[image...]] placeholder works only with images on current Site for Scheduled & Triggered actions

[[image ([[Picture]], width, height, maxwidth, maxheight, minwidth, minheight)]] 

Without width and height: [[image ([[Picture]])]] 

Static width and height: [[image ([[Picture]], 50, 50)]]   

Static width: [[image ([[Picture]], 20)]] 

Static height: [[image ([[Picture]],,150)]] [[image ([[Picture]], '', '', 100, 300)]]

[[image ([[Picture]], maxwidth=100, maxheight=300)]]

[[image (url=[[Picture]], maxwidth=100, maxheight=300)]]
LinkCreate a link in the document

[[link ([[Hyperlink]])]]

[[link ([[Hyperlink.Url]], [[Hyperlink.Description]])]]

 

[[link (url=[[Hyperlink.Url]], text='linktext')]]

HTML

Allow to insert HTML content inside the document. Supported [[html placeholder]] and placeholder of Multiple lines of text fields with options: Rich text and Enhanced rich text.

Supported tags: <b>, <i>, <u>, <ul>, <ol>, <li>, <span>, <div>, <p>, <h1-h6>, <br>, <a>, <table>, <img>.

Allow to insert inline into html placeholder.
Note: Bulleted and numbered lists, table are not supported when use inline option

[[html ([[@Variable.CustomHTML]])]]

[[RichTextField]],

[[EnhancedRichTextField]]

 

[[html ([[Column]], inline=true)]],

[[html ([[Column]], true)]]

 

 

 

 



    • Related Articles

    • Einführung in den Dokument Generator

      Was ist der Dokument Generator? Mit dem "Document Generator" können Sie Dokumente auf der Grundlage einer Standard-Microsoft-Word-Datei generieren, die mit SharePoint-Listendaten gefüllt ist. Dies kann in Aktionen ausgelöst werden, die in ...
    • Wie kann man eine Lösung (solution) teilen?

      Jede Lösung wird von einer Person erstellt, die wir als "Solution Owner" bezeichnen. Diese Lösung ist nur für diesen Benutzer auf dem Solution Studio Dashboard sichtbar, bis sie für einen anderen Solution Studio Benutzer freigegeben wird. Um eine ...
    • Aktion: Word Dokument generieren

      Mit der Aktion Word-Dokument generieren können Sie Dokumente basierend auf einer standardmäßigen Microsoft Word-Datei generieren, die mit SharePoint-Listendaten gefüllt ist. Beispiel für die Konfiguration der Aktion "Word-Dokument generieren" für ein ...
    • Wie man Abfragefunktionen (query functions) verwendet

      Kontext-Platzhalter-Funktionen ermöglichen die Abfrage von Listen, so dass Werte aus beliebigen Listen in Ausdrücken verwendet werden können. Zum Beispiel: [[@Web.GetFirstValueForQuery('ListName, list Id or Relative URL', 'Caml query', 'FieldName')]] ...
    • Umgang mit dem Schwellenwert für Nachschlagenspalten in einer Dokument Generator Vorlage für ein einzelnes Element

      Wenn Ihre Dokument Generator Vorlage mehr als 12 Nachschlagen-Spalten enthält, was den Schwellenwert für SharePoint-Nachschlagen überschreitet, kann es vorkommen, dass das generierte Dokument nicht alle Nachschlagewerte enthält. Um dieses Problem zu ...