Showing posts with label Word. Show all posts
Showing posts with label Word. Show all posts

Friday, 4 September 2015

Customize the Report layout using Jet Express for Word

Click Edit Layout to customize this layout
JetReportDesign-1

The Jet Express for Word action panel may automatically open when this word file is opened.

If not, select the Jet Ribbon

Click on the Design icon

This presents a tree hierarchy of the fields from the selected report. 
JetReportDesign-2

Click on the icons on the hierarchy to expand or contract the lists.

The Search field makes it easy to find the fields you need.

Labels – NAV reports which were created by Jet Reports include a section for Labels. These fields are the descriptions of the fields themselves.

If you have multiple languages in your NAV instance, these labels can be helpful for creating multi-language documents.

Other Groupings – NAV reports which were created by Jet Reports include sections for Company, Customer, etc. These fields include the values of the fields.

The user can select from fields including Header or Lines in the hierarchy and insert an item, typically into a table in the Word document.
JetReportDesign-3

To add a field select the desired location in the Word document and double-click on the field.

Alternatively, you can select the field and click on the Insert button in the Jet Express for Word action panel.

To Add a picture to a document, right-click on the item and select Insert Picture
JetReportDesign-4

The Lines fields are also inserted as text and can be replicated by a Right-click, and choosing “Insert Repeater”.

Repeating items (such as Sales lines on a Sales order) can be added to a document.
JetReportDesign-5

Best practice for this is to create a table in Word that is two rows high.

The first row contains the Labels of the fields that you wish to include.

The second row contains the values of the fields.

Select the entire second row- include the area just to the right of the last column.

Right-click on the item in the hierarchy that you want to repeat and select Insert

To delete an item, click on it, and then click on its Title.
JetReportDesign-6
When you click on the Title it will change color.

Then press the Delete Button on your keyboard.

Note: It’s important to select the Title when deleting to avoid any leftover data.

When you have completed your changes Save your Word document
JetReportDesign-7
This will return you to NAV and prompt you to import the report layout changes.
JetReportDesign-8
Click Yes

You can Run Report to review your changes.
JetReportDesign-9
Here is the output for the report below.
JetReportDesign-10
We are done with customization of the report using Jet Reports.

I will come up with more details in my upcoming posts.

Thursday, 3 September 2015

Jet Express for Word – Objects for Navision 2015

Getting Started for Administrators

Overview

Microsoft introduced a new feature with Dynamics NAV 2015 which makes it easy and inexpensive for partners and end users to create and customize visually attractive document reports in NAV using Microsoft Word.

In collaboration with Microsoft, Jet Reports developed Jet Express for Word – an application that supports this process by providing users an easy-to-use interface inside Microsoft Word to create and modify these documents.

From where to download these objects

If you remember my previous post where I shared the link of download page. See here.

JetReportObjects-1
Refer to Step-3 in above screenshot.

Download the Objects from the Link.

Jet Express for Word includes four NAV reports and a set of sample sales documents.

These four NAV reports include:























 Report Number Name
14125500Sales Order – Jet. Ex. Word
14125501Sales Invoice – Jet. Ex. Word
14125502Sales Cr. Memo – Jet. Ex. Word
14125503Sales Quote – Jet. Ex. Word

Installing these reports in NAV

These four reports are included in a .FOB file which is available from the Jet Express for Word website.

To install this .FOB file you will need access and permissions to the Microsoft Dynamics NAV Development Environment.

In this application select File > Import… and browse to find the downloaded .fob file.
JetReportObjects-2

JetReportObjects-3

JetReportObjects-4

Uninstalling Jet Express for Word documents

If you need to uninstall the Jet components from the Microsoft Dynamics NAV Server-

  • Open the Microsoft Dynamics NAV Development Environment and then connect to the database

  • Open the Object Designer (on the Tools menu, choose Object Designer)

  • Select All to see all business objects.


Select the business objects which were inserted (listed above), right-click and select Delete. When asked if you want to delete the selected lines click Yes.
JetReportObjects-5

Wednesday, 2 September 2015

Jet Express for Word Overview & Installation - for Navision 2015

Jet Express for Word is a new feature available to Microsoft Dynamics users which makes it easy for end users to design documents in Microsoft Word. This feature is part of Jet Express for Microsoft Dynamics NAV and is available to Microsoft Dynamics NAV 2015 users.

Modify Reports in Microsoft Word

Need to change the layout of an invoice or credit memo? Just open the document in Microsoft Word to make changes in a program you already know—no programming required.

Provided you already have reports developed by the Navision professionals. You can only make Layout, Look & Feel changes. For any business logic or including/excluding fields in report will be handled from Navision only as we do.

Design with Flair

You can use document templates that provided by Jet Reports, templates from the Office Store, or create a document from scratch. Add company logos, change fonts, modify fields and customize for multiple regions easily.

Easy to Use

The simple interface allows you to customize or create document layouts using Microsoft Word. Your fields appear in clear text and the search feature makes it quick to add the fields you need.

New functionality in Microsoft Dynamics NAV 2015 allows you to import these document layouts into NAV and run them from within the NAV client.

Software Requirements

  • Microsoft Dynamics NAV 2015

  • Office 2013 Desktop Edition


Supported Languages

  • English, Danish, Dutch, French, German and Spanish

  • More languages will be added soon


Where to get Jet Report Installation Files

You can use this Link, Visit to Jet Reports site here.

JetReportInstallation-1

JetReportInstallation-2

- Download the Jet_Express_for_Word_Installer.zip file

- Right-click the zipped file and select "Extract All"

- Right-click the file "setup.exe" and choose "Run as administrator"

JetReportInstallation-3

JetReportInstallation-4

JetReportInstallation-5

Verifying the Installation

Open the Word and you will find one more TAB in Ribbon. [JET]

JetReportInstallation-6

Just in case you don’t find the Tab, Follow below set to enable the same, provided your Installation was successful in previous step without any error.

JetReportInstallation-7

Developer -> COM Add-Ins

Check if Jet Express for Word is enabled, if not select it and say OK.

If already enabled but still you don’t see, disable and enable again. Restart your word now you will be able to see the JET TAB.

I will come up with more information in my upcoming posts.

Saturday, 8 August 2015

Using Automation to Write a Letter in Microsoft Office Word

Automation lets you use the capabilities and features of Microsoft Office products, such as Microsoft Word or Microsoft Excel, in your Microsoft Dynamics NAV application.

Today we will implement Word Automation from a customer card in the Microsoft Dynamics NAV Windows client.

Note: The Microsoft Dynamics NAV Web client does not support automation.

Most information that we need to transfer to Word for this example is in the Customer table. The Customer table contains a FlowField called Sales (LCY) that contains the aggregated sales for the customer.

In this example we are learning about Automation, so we will use the existing value. In a real customer installation, we would need to set up an appropriate date filter to get the sales for the past year only.

We also need to retrieve the information about our own company that we will use in the letterhead and in the greeting of the letter. This information is contained in the Company Information and User tables.

  • The Automation server must be installed on the computer that compiles an object that uses Automation. If you must recompile and modify an object on a computer that does not have the Automation server installed, then you must modify the code to compile it again. We recommend that you isolate code that uses Automation in separate codeunits.

  • Performance can be an issue if extra work is needed to create an Automation server with the CREATE system call. If the Automation server is to be used repeatedly, then you will gain better performance by designing your code so that the server is created only once instead of making multiple CREATE and CLEAR calls).


Performance can be improved by putting the code on the customer card because you do not have to open and close Word for each letter that is created in the session.

You can work around this problem. If Word is already open when it is called from the code, then the running instance is reused. You can manually open Word or do not close Word after creating the first letter.

We will extract and transfer data one customer at a time. We will also initiate this processing and the subsequent processing in Word from the customer card.

We will insert fields into the Word template and give these fields convenient mnemonic names that correspond to the names of the record fields that we are using.

To make this work, C/AL code must make two extra calls to Microsoft Office Word. You must call the ActiveDocument.Fields.Update method before using the fields. After you have transferred all the information, you must call the ActiveDocument.Fields.Unlink method. This ensures that you can successfully use the Word fields as placeholders.

In addition, while you can name the Customer or Address fields, you must reference them by indexing into the Fields collection of the document. This can make the C/AL code harder to understand.

Creating the Word Template for Use by Automation


First, task is to create a Word template that we will use to create letters to customers that qualify for a discount. To create the template, we will add mail merge fields for displaying data that is extracted from Microsoft Dynamics NAV that you want included in the customer letter, such as the customer's name, contact, and total sales.

You will create and save the template on the computer running the Microsoft Dynamics NAV Windows client, because you will configure the automation object to run on the client.

  • On the computer running Microsoft Dynamics NAV Windows client, open Word and create a new document.


WordAutomation-1

  • Choose where you want to insert the fields. Then, on the Insert tab, in the Text group, choose Quick Parts, and then choose Field.


WordAutomation-2

  • In the Categories list, select Mail Merge.

  • In the Field names list, select MergeField.

  • In the Field Name box under Field Properties, type Contact. This field will display the name of your contact person at the customer site as taken from the Customer table.

  • Choose OK to add the field.


WordAutomation-3

  • Repeat steps as above to add the remaining fields as follows:






























Field name Description Underlying table
NameThe name of the customer.Customer
AddressThe address of the customer.Customer
Sales (LCY)The total amount that the customer has purchased from you.Customer
Company NameThe name of your company.Company Information


  • Save the Word document as a template with the name Discount.dotx in folder of your choice.


WordAutomation-4

Creating the Codeunit and Declaring the Variables


The next step is to create the codeunit that calls Word and creates the letter.

To create the codeunit



  • In Object Designer, choose Codeunit, and then choose the New button to create a new codeunit.

  • On the View menu, choose Properties to open the Properties window of the codeunit.

  • In the TableNo field, choose the AssistEdit button to open the Table List window.

  • In the Table List window, select the Customer table, and then choose OK.


WordAutomation-5

  • Close the Properties window.


To declare the variables



  • Choose the OnRun Trigger and on the View menu, choose C/AL Locals, and then choose the Variables tab.

  • On a blank line, type wdApp in the Name field and set the Data Type field to Automation.


Note

When you create an Automation variable, some hidden events are also created for it. If you want to delete the variable, be aware that the events are also not deleted. This can cause issues if you then create a variable with the same name.

  • In the Subtype field, choose the AssistEdit button. The Automation Object List window is displayed.

  • In the Automation Server field, choose the AssistEdit button.

  • In the Automation Server List, select Microsoft Word 15.0 Object Library if you are running Word 2013, or select Microsoft Word 14.0 Object Library if you are running Word 2010, and then choose OK.

  • From the list of classes in the Automation Object List, select the Application class, and then choose OK.


WordAutomation-6

  • Repeat steps above to add the following two Automation variables:























Name Data type Subtype Class
wdDocAutomationMicrosoft Word 14.0/15.0 Object LibraryDocument
wdRangeAutomationMicrosoft Word 14.0/15.0 Object LibraryRange


  • Add the following variables.























Name Data type Subtype Length
CompanyInfoRecordCompany Information
TemplateNameText250


  • Close the C/AL Locals window.


Writing the C/AL Code


Before you start writing the C/AL code that uses Automation, you must do some initial processing. You start by calculating the Sales (LCY) FlowField. Then, you check whether the customer qualifies for a discount. Finally, you retrieve the information from the Company Information and User tables that you use to fill in some of the fields in the letter.

To write the C/AL code



  • In the C/AL Editor, add the following lines of code to the OnRun section.








  CALCFIELDS("Sales (LCY)");CompanyInfo.GET;


  • To create an instance of Word before using it, enter the following line of code.








 CREATE(wdApp, FALSE, TRUE);


  • This statement creates the Automation object with the wdApp variable.




    1. The first Boolean parameter in the statement (FALSE) tells the CREATE function to try to reuse an already running instance of the Automation server that is referenced by Automation before creating a new instance. If you change this to TRUE, then the CREATE function always creates a new instance of the Automation server.

    2. The second Boolean parameter in the statement creates the Automation object on the client. This is necessary to use this codeunit on a page in the Microsoft Dynamics NAV Windows client.




  • Enter the following lines of code to add a new document to Word that uses the template that you designed earlier. If required, replace C:\Users\atripathi5283\Desktop\Nav-2015\Word Letter with the correct folder path to the template that you defined in the procedure.








 TemplateName := C:\Users\atripathi5283\Desktop\Nav-2015\Word Letter\Discount.dotx';wdDoc := wdApp.Documents.Add(TemplateName);wdApp.ActiveDocument.Fields.Update;


  • Because the Add method of the Documents collection requires that you pass the path to the template by reference, you must set up the TemplateName variable to hold this information. You will get a compilation error if you put the path into the call as a literal string.

  • The Documents property returns a Documents collection that represents all open documents. You can also see that the Documents collection object has an Add method, and that the Add method has the following syntax.

  • expression.Add(Template, NewTemplate, Document Type, Visible)

  • expression is a required argument, and it must be an expression that returns a Documents object. All the arguments are optional. You will use Template to open a new document that is based on your template.

  • For the syntax in the C/AL Symbol Menu, note that the Documents property returns an object of type DOCUMENTS, which is a user-defined type. The property returns a Documents class or IDispatch interface. This information helps the compiler perform a better type check during compilation. The following statement can also pass both the compile-time and the run-time type checks.

  • wdDoc := wdApp.Documents.Add(TemplateName);

  • Finally, the Add method returns a Document class. While you did not need to declare a C/AL variable for the interim Documents class, you have declared a variable for the wdDoc return value,.

  • The third line contains a call that must be made to ensure that the template works as intended.

  • wdApp.ActiveDocument.Fields.Update;


Transferring Data to Word


Now you can transfer the actual data from the Customer record to the placeholder fields in the Word document.

You have set up the first three fields in the template so that they can contain the contact, name, and address of the customer and you can transfer the data.

To transfer data to Word



  • Transfer the data by adding the following lines of code.








 wdRange := wdAPP.ActiveDocument.Fields.Item(1).Result; wdRange.Text := Contact; wdRange.Bold := 1; wdRange := wdAPP.ActiveDocument.Fields.Item(2).Result; wdRange.Text := Name; wdRange.Bold := 1; wdRange := wdAPP.ActiveDocument.Fields.Item(3).Result; wdRange.Text := Address; wdRange.Bold := 1;


  • You cannot use the fields directly as variables and make an assignment such as Fields.Item(3) := Address. Instead, you use the Result property of the field. This property returns the result of the field as a range. You place this range in the wdRange Automation variable that you declared.

  • You then set the Text property of the range to the desired values, which is the name of your contact person and the name and address of the customer. Finally, you add bold formatting.

  • The data you are transferring must be in text format. If it is not in text format, then you get a compilation error. wdRange.Text expects arguments to be of type BSTR, which maps to either Text or Code. This means that any data that is not Text or Code must be converted before it is passed to Word. To convert a field to Text, you use the FORMAT function. All the fields that are transferred in this step are in text format, so no conversion is needed and the FORMAT function is not used. However, in this example, you also need to transfer the Sales (LCY) field, which is a Decimal field. To see how to convert the Sales (LCY) field, go to the next step.

  • To transfer and format the data from the Sales (LCY) field, add the following code.








 wdRange := wdAPP.ActiveDocument.Fields.Item(4).Result;wdRange.Text := FORMAT("Sales (LCY)");wdRange.Bold := 0;


  • To transfer the information from the Company Information table, add the following code.








 wdRange := wdApp.ActiveDocument.Fields.Item(5).Result;wdRange.Text := CompanyInfo.Name;


  • To complete the processing in Word, add the following code.








 wdApp.Visible := TRUE;wdApp.ActiveDocument.Fields.Unlink;


  • The first statement opens Word and shows you the letter that was created. The second statement makes the fields work as placeholders.


WordAutomation-7

  • Save and compile the codeunit


To-Do List


Although this code will work, you must add a few things to make it complete:

  • We recommend that you do not use a hardcoded template name. You should keep the template name in a table, and the user should select it from a page. You can then have different templates for different types of letters that you want to send to your customers.

  • You should add some error-handling code. For example, the CREATE call fails if the user does not have Word installed or if the installation has been corrupted. You should check the return value of CREATE and give an appropriate message if it fails.

  • The user should get a message if the customer does not qualify for the discount. In the example, the codeunit closes without any message.


Calling the Codeunit from the Customer Card

The final task is to ensure that you can call the codeunit from the Customer Card page in the Microsoft Dynamics NAV Windows client.

To call the codeunit from the Customer card page in the Microsoft Dynamics NAV Windows client



  • Open Object Designer, and then choose Page.

  • Select the Customer Card page and then choose Design.

  • On the View menu, choose Page Actions.

  • To add a new action, locate the action container with the subtype set to ActionItems.

  • Right-click the next line after the ActionItems container, and then choose New.

  • In the Caption field of the new line, type Word Letter.

  • Set the Type field to Action.

  • With the new action selected, on the View menu, choose Properties.

  • In the RunObject field, type codeunit Discount Letter.


Note

If you saved the codeunit that you created in the previous procedure under a different name, then substitute Discount Letter with the name that you used.

  • Use the arrow buttons to make sure that the new action is indented only once from the ActionItems container above it


WordAutomation-8

  • Save and compile the Customer Card page.


To run the Customer Card and view the Word letter

  1. In Object Designer, choose the Page

  2. Select the Customer Card page, and then choose Run.

  3. In the ribbon, on the Actions tab, choose the Word Letter


The letter document opens in Word.

WordAutomation-9

Next Steps


The letter that you have just created only contains five fields and sample body text. Before you can use this letter in an actual situation, you will need to add some more fields, such as the name and address of your own company, the date, and the currency code, and the main text of the letter. It will also need some formatting to make it look more attractive. If you alter the order in which the fields appear in the template, you must change the numbering of the fields in the codeunit to ensure that the correct data is inserted into the appropriate fields.

 

Thursday, 30 July 2015

Word Document Reports and Custom Layouts

Reporting functionality has been greatly improved in Microsoft Dynamics NAV 2015 by adding support for defining report layouts in Word, and enabling end users to create custom RLDC and Word layouts for their reports. These two features make it easier to create visually pleasing document reports, as well as allow end users to modify reports to their liking with as little partner involvement as desired.

Today I am sharing again all the posts from earlier archive, if you missed you can find all of them below.

Soon I will come up with more posts on this topic. Till then go through below links and develop your skills so that we can take up few more complex ones.

  1. How many types of Layout is supported in NAV 2015?

  2. How to. Specify the Default Built-in Report Layout

  3. Import and Export a Word Report Layout

  4. Add Fields from a Report Dataset to a Word Report Layout

  5. Adding Image Fields

  6. Removing Label and Data Fields

  7. To create a Word report layout for a report

  8. Designing Report Layouts from the Microsoft Dynamics NAV Development Environment

  9. Creating my first Word List Report in Navision 2015

  10. To modify the Word report layout

  11. Creating Custom Word Layout for Document Reports in Navision 2015

  12. Creating Word Mail Merge Report in Microsoft Dynamics Navision 2015

  13. The New Report Scheduling feature for end users running reports in Microsoft Dynamics Navision 2015

Friday, 17 July 2015

Creating Custom Word Layout for Document Reports in Navision 2015

Open the MS Office Word.

File -> New and type Invoice in search and press enter to list available Invoice Templates.

Document Reports -1

In my example I am using [Sales Invoice (Blue Border Design)]

Document Reports -2

Select Create to download the template and create a document for you.

Your new document created from this template will look as below:

Document Reports -3

Prepare the Layout by removing extralines as we will be using repeating lines for Lines.

Save your Template.

I have made a copy of Report 206 - Sales – Invoice on new ID say (50005 as Sales - Invoice Word).

This report dosen’t have Word Layout. We will be creating one Customize Layout form above saved Invoice above. [Sales Invoice (Blue Border Design)]

Open Report Layout as shown in below Screen:

Document Reports -4

Document Reports -5

Slect the Report and choose Custom Layout as shown in above screen.

Document Reports -6

In Custom Report Layout Window Click on New.

From window Insert Build-in Layout for Report Select Insert Window Layout and click OK button.

Document Reports -7

From Custom Report Layout window Select Import Layout, Select your word file prepared above and Respond Open to Import.

Document Reports -8

Then, press Edit Layout and prepare layout on Developer tab, find XML Mapping Pane and find your document in Custom XML Part.

Now, you can find all fields from Dataset.

Document Reports -9

Please see below links to complete your report:

Adding image fields

Add fields from a report dataset to a word report layout

Creating my first word list report in Navision 2015

How to specify the default built in report layout

Create a word report layout for a report

Once you are done with your field assignment close the word layout.

Document Reports -10

Select Yes to import changes to the report.

Document Reports -11

Select Run Report to view the output of your report.

Now you are done with your Custom Report Layout.

Please see sections which will be more helpful to complete your task:

Reports

Thursday, 9 July 2015

Creating Word Mail Merge Report in Microsoft Dynamics Navision 2015

Today we will see Mail Merge feature in Word Report.

I would suggest to please go through my earlier post for creating simple List Report for better understanding as some parts I will be skipping in this post assuming you have already learned from my previous post.

Here is the Quick Link : [ Creating My First List Report in Navision 2015 ]

Lets assume ever month we require to send a Reminder Letter to our Customers for Due Payments.

Now we can design such report at customer ease.

Lets Start with creating a new Report.

Add the Data Items and desired columns as one shown below.

Add appropriate filters on Data Items, I have added [ Open = Yes, Document Type = Invoice, Remaining Amount > 0, Due Date <> ' '] you select your own as desired.

Set the Report Properties as shown in below screen.

Define Global Variables as shown in below screen.

We have Included WordMergeDataItem as Cust. Ledger Entry. This will set the table to loop for records.

Each records will be considered as New Page for the Report.

Word Mail Merge -1

In this report we are using Include Caption which will include caption for each required columns from one defined in respective table.

Add this property for each required column.

Add the code to the Data Item Trigger to fetch Customer Information for each record.

Word Mail Merge -2

Insert New Blank Word Layout to the Report.

Word Mail Merge -3

Export the Layout Template and Save.

Word Mail Merge -4

Open saved Layout Template in Word.

In below screen each component is shown, refer to earlier post Creating List Word Report, Link provided above for better understanding.

In this report Label is included as we have set property for each column to include caption.

Word Mail Merge -5

Design the sample Letter as one shown below.

I have highlighted all the Dataset Columns/Fields in yellow.

How to add fields please refer to earlier post Creating Word List Report, Link provided above.

Word Mail Merge -6

Now Save the Template and Import into the Report.

Word Mail Merge -7

Here is the out put from the report as below.

Each page will contain data as per in Customer Ledger Entry Due Payment Records.

Word Mail Merge -8

We are done !!!

You can use formatting feature of Word to add more better look to your Report as desired.

Stay tuned for more in upcoming posts.

Don’t forget to follow the Blog Site for future posts.