how to print a doc file

nt
nt Member Posts: 160
hi, anyone knows how i can add or print a doc file from a report?

thanks.

Comments

  • kine
    kine Member Posts: 12,562
    Sorry, if you want to create DOC file from the Report, you can use Save as HTML and open it in word and save it as DOC, I do not know automatic way (but can exist)...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Tim81
    Tim81 Member Posts: 68
    You could use the Automation Data Type.

    Create the following vars:
    Name          DataType       Subtype
    Word          Automation     'Microsoft Word x.0 Object Library'.Application
    Selection     Automation     'Microsoft Word x.0 Object Library'.Selection
    

    Then you have to code something like the following:
    CREATE(Word);
    Word.Documents.Add();
    //if you want to use a template; Template has to be a text var
    //Template := 'C:\template.doc';
    //Word.Documents.Add(Template);
    
    Selection := Word.Selection;
    Selection.TypeText('Test');
    
    Word.Visible := TRUE;
    
    //to print the document on preset printer
    Word.PrintOut;
    

    Of course you can use a template, so you just have to fill in the needed information.
  • nt
    nt Member Posts: 160
    thanks tim.

    the "word.selection" what value will have?
  • Tim81
    Tim81 Member Posts: 68
    The "Selection" is just an alias for "Word.Selection". But the Selection var has to know which selection it should control. So you have to assign the Word.Selection to the Selection var.

    You could also control everything with the Word var.
    Selection := Word.Selection;
    Selection.TypeText('Test');
    
    is the same as
    Word.Selection.TypeText('Test');
    
  • nt
    nt Member Posts: 160
    ok thanks