How to use Microsoft word from C/SIDE

xrivoxrivo Member Posts: 56
edited 2005-01-18 in Navision Attain
I want to work with Microsoft Word from navision...in fact I want to write a letter for some customers ... I have found an example in "Application Designer Guide" but is not working very good. Can you give me an example which realy works? Thx

Comments

  • afarrafarr Member Posts: 287
    Quick reply: look at Relationship Management, the Create Interaction function from the Contact card opens a Word document for some of the interaction types.

    One tip: in Codeunit 5054 (WordManagement) change all CREATE(obj) to CREATE(obj,TRUE). This tells Navision to open a new instance of Word, even if there is already an instance open, otherwise you could get problems with older versions of Word.

    Alastair
    Alastair Farrugia
  • Christian_BuehlChristian_Buehl Member Posts: 145
    You can operate with formular fields, which need to be defined in the used template:
    CREATE(wrdApp);
    TemplateName := '\\server1\templateshare\Navision\Customerletter.dot';
    wrdApp.Visible := TRUE;
    IF NOT EXISTS(TemplateName) THEN ERROR (ErrMsgFileNotFound, TemplateName);
    wrdDoc := wrdApp.Documents.Add(TemplateName);
    wrdApp.ActiveDocument.Fields.Update;
    wrdRange := wrdApp.ActiveDocument.Fields.Item(1).Result;
    wrdRange.Text := kopfzeile;
    wrdRange := wrdApp.ActiveDocument.Fields.Item(2).Result;
    wrdRange.Text := Adr1;
    


    You can alternatively use a book mark in your document (I hope M$ is using this translation for markers in the text, in German it's called "Textmarke":
    ....
    marker := 'marker1';
    wdGotoBookmark := -1;
    what := wdGotoBookmark;
    // which := 1;  // Standard = WdGotoFirst
    // count := 1;  // Standard value
    wrdRange := wrdDoc.GoTo(what,which,count,marker);    // set position
    wrdRange.InsertAfter(Customerno);   // Insert data
    wrdRange.InsertParagraphAfter;         // Insert paragraph
    


    Have you ever tried to do OLE with OpenOffice ? \:D/
Sign In or Register to comment.