how to view word file in navision.

kgsinhakgsinha Member Posts: 67
Dear All,
I have used Blob datatype field to save word file in navision.
File is being saved. It is ok

Now i want to view the word file (which is saved in navision).

So is it possible to direcly view the word file from navision???

Pls help

Comments

  • ErictPErictP Member Posts: 164
    Look into table 5062 Attachment. This contains a function OpenAttachment which also runs Word if the blob-field contains a Word-file.
  • Steeve_globetrotterSteeve_globetrotter Member Posts: 46
    I am not sure how and where you are trying to do this, but something like this should work :

    ==============================
    CREATE(WordApp);
    WordApp.Visible(TRUE);
    FileName := 'Path to the file';
    WordDoc := WordApp.Documents.Open(FileName);
    WordDoc := WordApp.ActiveDocument;
    WordApp.PrintOut(); // If you want to print it directly after
    ===============================

    Good luck :wink:

    Steeve Le Provost
    http://www.steeve-leprovost.fr.cx
  • Ravi_ThakkarRavi_Thakkar Member Posts: 392
    Hi all,

    I have the same problem.
    I want to create one command button 'Open File'.
    When I click on that it should display the attachment directly without exporting it to hdd.

    Can i do the same? if yes then how? I dont have the file path. i have only File name, file size, file data, content type. It can have any type of file.

    Please help me out.
    Ravi_Thakkar
    Ahmedabad, Gujarat, India
    E Mail : ravi.thakkar@hotmail.com
  • garakgarak Member Posts: 3,263
    sorry, this works only with exporting.

    So on export of the blob you can store the BLOB in environ('Temp') + '\' + YourFilename + '.' + FilenameExtension.
    To know the File Extension you can save this extension in a separate field when you import the file.

    For example:
    FileDialog.DialogTitle := 'FilePath...';
    FileDialog.Filter := '';
    FileDialog.InitDir('C:\');
    
    FileDialog.Filter('All (*.*)|*.*');
    FileDialog.ShowOpen();
    FileDialog.CancelError(FALSE);
    IF (FileDialog.FileName <> '') THEN BEGIN
      "Document Template".IMPORT(FileDialog.FileName,FALSE);
    
      i := STRLEN(FileDialog.FileName);
      WHILE FileDialog.FileName[i] <> '.' DO
        i -= 1;
    
      "File Extension" := COPYSTR(FileDialog.FileName,i,STRLEN(FileDialog.FileName)-i+1);
      
    y := i;
    
      WHILE FileDialog.FileName[i] <> '\' DO
        i -= 1;
    
      Description := COPYSTR(FileDialog.FileName,i+1,y-i-1);
      CurrForm.SAVERECORD;
    END;
    

    Regards
    Do you make it right, it works too!
  • Ravi_ThakkarRavi_Thakkar Member Posts: 392
    Hi all,

    Thanks for your replies.
    Recentaly I found one forum

    viewtopic.php?f=23&t=3344

    which solved my problem and the exact requirement.

    Thanks to all.
    Ravi_Thakkar
    Ahmedabad, Gujarat, India
    E Mail : ravi.thakkar@hotmail.com
Sign In or Register to comment.