Options

Nav2015 - Make Word Layout Non-Editable when Running Report

izzySzaboizzySzabo Member Posts: 3
edited 2015-10-02 in NAV Three Tier
Hi all,

I am playing around with word layouts for reports in Dynamics Nav - 2015.

I have a report (based on standard 205 - Order Confirmation). When I run the report, I click on 'Preview' and it brings up the word document for me filled in with some details (variables I put in) ready to be edited. -- But Editing this word document makes no sense in my case and could cause problems with data consistency if any values were accidentally(or on purpose) changed.

So I'm wondering how do I make this word document non-editable? Or how do I solve this issue, where the data in the report shouldn't be changed by the user when this report is run?
(NOTE: this word document can also be opened from the 'Print...' dropdown button on the request page)

Thanks,
Izzy

Answers

  • Options
    ivarskivarsk Member Posts: 12
    We are handling this by actually not giving .docx to the user, but silently jumping to .pdf for the reports that are supposed to be "read-only".
    The users then have a clear convention - when it comes in Word, it's ok to be edited, if in PDF, it's a strict-content document.

    It's done in Codeunit 9651 Document Report Mgt., e.g. like so:
    OutStrWordDoc := NAVWordXMLMerger.MergeWordDocument(InStrWordDoc,InStrXmlData,OutStrWordDoc);
    COMMIT;
    
    // custom code >>
    IF CustomReportLayout."Disable Word Preview" THEN
      IF ReportAction = ReportAction::Preview THEN
        ReportAction := ReportAction::SaveAsPdf;
    // custom code <<
    

    Obviously you need some setup where you specify the behavior, in our case it's the custom "Disable Word Preview" checkmark in Custom Report Layouts, which only super-users are allowed to alter just for emergency.

    ---

    PS.
    I'm in love with Word reports - and avoiding RDLC as much as possible in recent projects.

    We're currently doing a report-heavy NAV upgrade from 3.60 to 2015 for a customer having like everything coming out from NAV - from 5 kinds of contracts to 7 sorts of invoices and attorney and warning letters etc., >100 document reports total. And Word is the life-saver.
    Yes, it's cumbersome to do those show/hide/if/else things for Word, as Word does not have ANY means of having report logic programmed in, and every bit of logic must be in the NAV dataitems, but this is such a great thing for maintainability and code clarity.

    The second blessing of Word - for really complex or semi-custom printouts you can have NAV generate the report "only so far", and leave the rest to the user, in a Word that anyone can handle. As an example, we recently did a product catalog in Word generated from NAV (some 300 pages), which was then processed by some VB Macros, had TOC added (Word functionality), manually adjusted for prettiness, and finally went to the printhouse. Extends your borders so much.

    And the third - you can actually train your customers to adjust/customize those Word layouts themselves, so it's finally easier for them to just do it instead of requesting another development done.
  • Options
    izzySzaboizzySzabo Member Posts: 3
    Thanks!

    This might just work :thumbsup:
Sign In or Register to comment.