Exporting Reports from Navision to Microsoft Word
Comments
-
I did it using selection word automation, and InsertFile function!0
-
Christian Buehl wrote:Try it this way. I hope that solves most of your all problems.
Variables used Name DataType Subtype wrdApp Automation Automation Server.Application wrdDoc Automation Automation Server.Document wrdRange Automation Automation Server.Range wdGotoBookmark Integer what Integer which Integer count Integer TemplateName Text 200 Automation Server is {00020905-0000-0000-C000-000000000046} 8.1 or the "Microsoft Word 10.0 Object Library" (depending on Version of Word used, I prefer using older versions due to compatibilty)
TemplateName := '\\Servername\Name_of_share\folder\wordTemplate.dot'; CREATE(wrdApp); wrdApp.Visible := TRUE; IF NOT EXISTS(TemplateName) THEN ERROR (ErrMsgFileNotFound, TemplateName); wrdDoc := wrdApp.Documents.Add(TemplateName); wrdApp.ActiveDocument.Fields.Update; // With Fields in Word wrdRange := wrdApp.ActiveDocument.Fields.Item(1).Result; wrdRange.Text := YourText; // Alternatively print at a Bookmark position wdGotoBookmark := -1; what := wdGotoBookmark; tab[1] := 9; // which := 1; // Standard for WdGotoFirst // count := 1; // Standardvalue wrdRange := wrdDoc.GoTo(what,which,count,textmarke); wrdRange.InsertAfter('your Text'); wrdRange.InsertAfter(tab); wrdRange.InsertAfter('Another Text'); wrdRange.InsertParagraphAfter; // wrdDoc.PrintOut // Print Document to Std. printer // wrdDoc.PrintPreview; // Show Print preview wrdApp.Activate; clear(wrdApp);
I am attempting to use the code where text is inserted at a bookmark, but i am getting an Error:
"This message is for C/AL Programmers.
This Data type is not supported by C/SIDE. You can access data from any of the following data types.
VT_VOID,VT_I2,VT_I4,VT_R4,VT_R8,VT_CY,VT_DATE,VT_BSTR,VT_BOOL"
Watching debugger, the process is stopped at the wrdRange := wrdDoc.GoTo(what,which,count,textmarke); bit of code.
I have 'what' set to -1, 'which' set to 1, 'count' set to 1 (as per your example), and the 'textmarke' is entered as the name of the bookmark in my document (CLE). What may I be doing wrong?
EDIT: solved my own problem! thanks!kind of fell into this...0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions