Print a linked word document

larschlarsch Member Posts: 19
Hi,
I would appreciate very much if anybody could help whith this one.
In the end of a report, my customer wants to print out certain word documents, wich is linked to the actual Items used in the report. We dont want to open the documents, just to print it. If it must be opened, it should be done in the background and after printing, the word instans should be closed again. I have the path to the wordfile and have succesfully opened the word documents using SHELL. After that it should be printed and word should be closed. But there I am stocked.
I have also tried to use the automation functionality for word. But I cant find any guidelines exept in the Developers guide, where the example shows how to create a new word document, but not how to open/print/close an existing.
If you could show me where to find guidelines for this, it would be fine - or perhaps you have a solution "out of the pocket" :D
Thank you in advance.
LARSCH

Comments

  • matttraxmatttrax Member Posts: 2,309
    Did you search the forum for this? I know it has been discussed. Off hand I don't remember if a solution was ever found.
  • larschlarsch Member Posts: 19
    Yes, I have searched mibuso, Navision guidelines, the internet in general, Microsoft partnersource etc. but none of the topics I found, solve exactly this problem. If I could find some developer guidelines for the Automation functionality for word, I guess I would be able to find a solution, because there is a print() command and a close command, so I guess there may be a way to open a specific word document too. But this is just a guess.
    LARSCH
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    An alternative could be to use command line tool ClassExec, and then use NAV SHELL command with the following syntax:

    classExec %1 --command "[FileOpen(\"%1\")][FilePrint 0][FileExit 2]"

    All found here here after 3 min of googling around :mrgreen:

    Slawek
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • larschlarsch Member Posts: 19
    Hi Slawek,
    There you got me! :)
    You see, I am a simple NAV C/AL-programmer. Therefore I am searching for a solution I can use in C/AL, and have found none until now. (ClassExec-commands can’t be used in C/AL).
    So if I understand you correctly, you suggest that I get a small executable programmed with the exec commands and then call this with a C/AL-SHELL command in my report. Right?
    It should, though, be possible to pass the path to the document!
    LARSCH
  • larschlarsch Member Posts: 19
    Hi Slawek,
    I tried classexec and it works fine :D
    I can sent the parameters with my SHELL command, so everything's OK.
    Thank you very much for your help. \:D/
    LARSCH
  • kennichangkennichang Member Posts: 2
    Dear Larsch,

    Can you please post your code? Thanks.
    I tried. but I still have no idea how do it.
Sign In or Register to comment.