![]() |
#1 |
Участник
|
</p> Mit der Microsoft.Office.Interop.Word Bibliothek stehen Ihnen fast unendlich viele Möglichkeiten offen mit Microsoft Dynamics NAV und Office zu interagieren.</p> Heute möchte ich Ihnen ein kurzes Beispiel zeigen, wie Sie z.B. eine bestehende Word Datei in ein neues erstelltes Dokument am Ende einfügen können.</p> Als ein Szenario kann man sich hier vorstellen, dass es sich hier z.B. um die „Allgemeinen Geschäftsbedingungen“ handelt, die Sie zentral speichern wollen, aber nicht jedem Dokument welches Sie aus NAV erstellen beinhaltet von Grund auf angehängt sein soll.</p> <table cellspacing="0" cellpadding="2" width="800" border="0"><tbody> <tr> <td valign="top" width="100">Name</td> <td valign="top" width="100">DataType </td> <td valign="top" width="200">Subtype </td> </td></tr> <tr> <td valign="top" width="100">objWord </td> <td valign="top" width="100">DotNet</td> <td valign="top" width="200">Microsoft.Office.Interop.Word.ApplicationClass.'Microsoft.Office.Interop.Word, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' </td> </tr> <tr> <td valign="top" width="100">objDoc</td> <td valign="top" width="100">DotNet</td> <td valign="top" width="200">Microsoft.Office.Interop.Word.Document.'Microsoft.Office.Interop.Word, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' </td> </tr> <tr> <td valign="top" width="100">objSelection </td> <td valign="top" width="100">DotNet</td> <td valign="top" width="200">Microsoft.Office.Interop.Word.Selection.'Microsoft.Office.Interop.Word, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' </td> </tr> <tr> <td valign="top" width="100">WordHelper </td> <td valign="top" width="100">DotNet</td> <td valign="top" width="200">Microsoft.Dynamics.Nav.Integration.Office.Word.WordHelper.'Microsoft.Dynamics.Nav.Integration.Office, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'</td> </tr> <tr> <td valign="top" width="100">RangeParam </td> <td valign="top" width="100">Text</td> <td valign="top" width="200"> </td> </tr> <tr> <td valign="top" width="100">BoolParam </td> <td valign="top" width="100">Boolean</td> <td valign="top" width="200"> </td> </tr> <tr> <td valign="top" width="100">wdMovement </td> <td valign="top" width="100">Integer</td> <td valign="top" width="200"> </td> </tr> <tr> <td valign="top" width="100">wdUnit </td> <td valign="top" width="100">Integer</td> <td valign="top" width="200"> </td> </tr> <tr> <td valign="top" width="100">wdBreak </td> <td valign="top" width="100">Integer</td> <td valign="top" width="200"> </td> </tr> </tbody></table> </p> OnRun() BoolParam := FALSE; objWord := objWord.ApplicationClass; objWord.Visible := TRUE; objDoc := WordHelper.AddDocument(objWord); objSelection := objWord.Selection; objSelection.TypeText('Titel'); objSelection.TypeParagraph(); wdUnit := 6; //6 = wdStory wdMovement := 0; //0 = wdMove objSelection.EndKey(wdUnit, wdMovement); wdBreak := 2; //2 = wdSectionBreakNextPage objSelection.InsertBreak(wdBreak); objSelection.InsertFile('C:tempAGBS.docx', RangeParam, BoolParam, BoolParam, BoolParam);</p> </p> Das Ergebnis sieht dann wie folgt aus:</p> ![]() </p> These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use.</p> Mit freundlichen Grüßen</p> Sebastian Röttel</p> Microsoft Dynamics Germany</p><div style="clear:both;"></div>
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|