Word document attachment Preview in Navision 2016
Sachin_
Member Posts: 67
Hello all,
I am stuck in a requirement wherein when I click the button which I added in my page that’s in ribbon a preview of the attached word document file should open in Navision 2016 itself instead it is Opening outside in a MS word can u plz suggest some solution
Thanks in advance
I am stuck in a requirement wherein when I click the button which I added in my page that’s in ribbon a preview of the attached word document file should open in Navision 2016 itself instead it is Opening outside in a MS word can u plz suggest some solution
Thanks in advance
0
Answers
-
I've never seen word embedded in a classic NAV client nor RTC1
-
Hello @TallyHo But my client requirement is like once you click on the ribbon document preview should be in Navision itself now I am getting the attachment in ms word can anyone suggest a solution to get the attachment in navision
Thanks for the response.0 -
Hi,
You can try to save it as html file and show in WebPageViewer addin.0 -
Webpageviewer Addin is the field of the page, it is embedded in page...
What Nav version does your customer use?0 -
This article is a Little bit old but it Shows how you can use a WinWord Control in .net https://www.codeproject.com/Articles/3582/Word-Control-for-NET
You could create a Control Add-In which provides a Word Control1 -
Hello @PatrickGrabensteiner Sorry to tell this But i came across this link and even worked on it but dint get the desired result however thanks for the response.0
-
Oké, oké... starting to PM me... below sample works on my machine. Should be compatible with NAV2016, tested in BC15. Only thing is, the image is transparant so display it on a white background.
OBJECT Codeunit 50000 WordDocumentExportPng { OBJECT-PROPERTIES { Date=; Time=; Version List=; } PROPERTIES { OnRun=VAR WordHelper@100000000 : DotNet "'Microsoft.Dynamics.Nav.Integration.Office, Version=14.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.Microsoft.Dynamics.Nav.Integration.Office.Word.WordHelper" RUNONCLIENT; WordApplication@100000002 : DotNet "'Microsoft.Office.Interop.Word, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.Microsoft.Office.Interop.Word.ApplicationClass" RUNONCLIENT; WordDocument@100000001 : DotNet "'Microsoft.Office.Interop.Word, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.Microsoft.Office.Interop.Word.Document" RUNONCLIENT; WordWindow@100000004 : DotNet "'Microsoft.Office.Interop.Word, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.Microsoft.Office.Interop.Word.Window" RUNONCLIENT; WordPane@100000005 : DotNet "'Microsoft.Office.Interop.Word, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.Microsoft.Office.Interop.Word.Pane" RUNONCLIENT; WordPage@100000006 : DotNet "'Microsoft.Office.Interop.Word, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.Microsoft.Office.Interop.Word.Page" RUNONCLIENT; DotArray@100000007 : DotNet "'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Array" RUNONCLIENT; MemoryStream@100000008 : DotNet "'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.IO.MemoryStream" RUNONCLIENT; Image@100000009 : DotNet "'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.System.Drawing.Image" RUNONCLIENT; ImageFormat@100000010 : DotNet "'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.System.Drawing.Imaging.ImageFormat" RUNONCLIENT; ErrorMessage@100000003 : Text; BEGIN WordApplication := WordHelper.GetApplication(ErrorMessage); WordDocument := WordHelper.CallOpen(WordApplication,'C:\Temp\Temp.docx',FALSE,TRUE); WordDocument.ShowGrammaticalErrors := FALSE; WordDocument.ShowRevisions := FALSE; WordDocument.ShowSpellingErrors := FALSE; FOREACH WordWindow IN WordApplication.Windows DO BEGIN FOREACH WordPane IN WordWindow.Panes DO BEGIN FOREACH WordPage IN WordPane.Pages DO BEGIN DotArray := WordPage.EnhMetaFileBits; MemoryStream := MemoryStream.MemoryStream(DotArray); Image := Image.FromStream(MemoryStream); Image.Save('C:\Temp\Temp.png',ImageFormat.Png); END; END; END; CLEAR(Image); CLEAR(MemoryStream); CLEAR(DotArray); CLEAR(WordPage); CLEAR(WordPane); CLEAR(WordWindow); WordHelper.CallClose(WordDocument,FALSE); WordHelper.CallQuit(WordApplication,FALSE); CLEAR(WordDocument); CLEAR(WordApplication); END; } CODE { BEGIN END. } }1 -
Hello @Duikmeester
Thanks For the response but i am sorry to tell this i am getting this error as per my understanding this error is coming as My Navision 2016 version doesnt support Dotnet varaiables which you have mentioned and moreover i want to display a preview of attached word document not an image.
0 -
You know, NO is also an acceptable answer given to customers. PS. use WordHelper 9.0.0.0 for NAV2016.0
-
Hello @Duikmeester I used WordHelper version 9.0.0.0 and it worked but i m facing issue in using Panes, Pages,ShowRevisions, EnhMetaFileBits,MemoryStream

0 -
Check if E: is a Trusted location. Looks like the document is opened in Secured Preview mode.0
-
Hello @Duikmeester I have Checked the path it's in Trusted location only.0
-
Here is my version of converting Word to Html, version for Nav2017.
I used pieces of code from the following standard objects:
1. Page 2115 Report Viewer
2. Codeunit 9651 Document Report Mgt. (ConvertToHtml function, I'm not sure that it exists in Nav2016)OBJECT Page 50254 Word Viewer { OBJECT-PROPERTIES { Date=14.06.19; Time=15:30:00; Modified=Yes; Version List=; } PROPERTIES { CaptionML=[DEU=Berichtsviewer; ENU=Report Viewer]; OnOpenPage=BEGIN IF WordDocumentPath = '' THEN WordDocumentPath := FileManagement.OpenFileDialog('Select file', '',FileManagement.GetToFilterText('','*.docx')); IF NOT FileManagement.ClientFileExists(WordDocumentPath) THEN ERROR('File %1 doesn''t exist', WordDocumentPath); ConvertToHtml; END; OnClosePage=BEGIN IF EXISTS(ServerFileNameHtml) THEN IF ERASE(ServerFileNameHtml) THEN; END; } CONTROLS { { 1 ; ;Container ; ContainerType=ContentArea } { 2 ;1 ;Field ; Name=WebPageViewer; ApplicationArea=#Basic,#Suite; ControlAddIn=[Microsoft.Dynamics.Nav.Client.WebPageViewer;PublicKeyToken=31bf3856ad364e35] } } CODE { VAR FileManagement@1119429000 : Codeunit 419; WordDocumentPath@1000 : Text; NoDocErr@1001 : TextConst 'DEU=Es wurde kein Beleg angegeben.;ENU=No document has been specified.'; ServerFileNameHtml@1119429001 : Text; PROCEDURE SetFileName@1(NewFileName@1119429000 : Text); BEGIN WordDocumentPath := NewFileName; END; LOCAL PROCEDURE ConvertToHtml@22(); VAR TempBlobHtml@1006 : Record 99008535; PdfWriter@1119429000 : DotNet "'Microsoft.Dynamics.Nav.PdfWriter, Version=10.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.Microsoft.Dynamics.Nav.PdfWriter.WordToPdf"; InStreamWordDoc@1007 : InStream; OutStreamHtmlDoc@1008 : OutStream; WordFile@1119429002 : File; HtmlFile@1119429003 : File; ServerFileNameWord@1119429001 : Text; BEGIN ServerFileNameWord := FileManagement.UploadFileSilent(WordDocumentPath); ServerFileNameHtml := FileManagement.GetFileNameWithoutExtension(ServerFileNameWord) + '.html'; WordFile.OPEN(ServerFileNameWord); WordFile.CREATEINSTREAM(InStreamWordDoc); HtmlFile.CREATE(ServerFileNameHtml); HtmlFile.CREATEOUTSTREAM(OutStreamHtmlDoc); PdfWriter.ConvertToHtml(InStreamWordDoc,OutStreamHtmlDoc); HtmlFile.CLOSE; END; EVENT WebPageViewer@-2::ControlAddInReady@8(callbackUrl@1000 : Text); BEGIN IF ServerFileNameHtml = '' THEN ERROR(NoDocErr); CurrPage.WebPageViewer.SetContent(FileManagement.GetFileContent(ServerFileNameHtml)); END; EVENT WebPageViewer@-2::DocumentReady@9(); BEGIN END; EVENT WebPageViewer@-2::Callback@10(data@1000 : Text); BEGIN END; EVENT WebPageViewer@-2::Refresh@11(callbackUrl@1000 : Text); BEGIN IF ServerFileNameHtml <> '' THEN CurrPage.WebPageViewer.SetContent(FileManagement.GetFileContent(ServerFileNameHtml)); END; BEGIN END. } }1 -
[Topic moved from 'NAV/Navision Classic Client' forum to 'NAV Three Tier' forum]
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 328 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

