Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Server

Managing stylesheets in Dynamics NAV

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
8/17/2011 5:44:29 PM
Sending documents to MS Word had always been a challenge in NAV, until the new "export to Excel" and "export to Word" functionality was introduced in NAV version 5 and carried over to version 2009. Automatic "Send to Excel" and "Send to Word" capability uses stylesheets to format the output from almost any page in Dynamics NAV. Just click a button, and the information will be displayed on a Word document or an Excel spreadsheet. The output is nicely formatted using the XML stylesheets, which can be structured into proper rows and columns with row headers, descriptions, field captions, logos, other pictures, and many more.

The initial version of this functionality required XML designing in order to preformat stylesheets, which required programming knowledge. However, with the new stylesheet tool, users can design new or edit existing stylesheet formats with no programming knowledge.

In this article, we will learn the use of the stylesheet tool to create stylesheets for Word documents:

  1. 1. To start using this tool, import the Style Sheet Tool v2 from Customer Source. The ZIP file can be extracted to the FOB file. Import all objects using the object designer. The system will create 19 new objects and replace "Codeunit 403," once all the objects are imported.

    In this example, we are going to create a stylesheet format for a customer list with number, name, credit limit, and balance.

  2. 2. The stylesheet designer can be used by running Style Sheet card(Form 680) in the Object Designer using the Classic client. Create a new record for the new stylesheet.

  3. 3. Enter the relevant code and description. For example, for the Customer List we can use CUST and Customer fields respectively.

  1. 4. Choose the setup as shown in the previous screenshot.

  2. 5. Click Style Sheet | Select Fields to open the Fields Used List window. These fields are the ones we want to show in the final Word document.

  1. 6. In the Field No. field, click the Assist button, and in the Style Sheet Field List window, select the fields we want in the Word document. For example, No., Name, Credit Limit, and Balance.

  1. 7. The Include Caption checkbox in the Item Style Sheet Fields Used List window has automatically been selected for each field, based on the stylesheet setup settings. This will make the caption of the fields available in our Word document. If we don't want captions but only want the data fields to be visible on our document, clear the checkbox for the field captions we don't want.

  2. 8. The Currency checkbox is used to display currency-related fields and are displayed with two decimals in the final Word document. In this example, we can check the Currency Box for the Credit Limit and Balance fields. If we don't check it, the number of decimals in the original data field, will be displayed.

  3. 9. Close the Fields Selection window, and the Fields Selected field in the Style Sheet Card form should be automatically checked.

  4. 10. In the Style Sheet menu, click on Create Mail Merge and this will open the Word document for us. Under the Mailings tab, click on Insert Merge Field to open the list of fields we want to insert in the Word document.

    (The following screenshot shows an example of how this would look in the MS Word 2010 version, but this should be similar for Word 2007):

We can design the document as necessary by adding our own text and pictures.

  1. 1. The mail merge could look like the following screenshot:

  1. 2. Close the Word document and click Yes to import the mail merge document. Click Yes to convert the mail merge document to a stylesheet document and Yes to update Manage Style Sheets. This will associate the stylesheet we just created with the customer list.

  2. 3. Now, to see the output of the stylesheet we just created, go to the Customer List and click on the Word icon. This should export the customer list in the Word document and the output should look like the following screenshot:

The definitions of fields and menu buttons on the Style Sheet Card are as follows:

  • Code: Used to enter alphanumeric code for this stylesheet, for example CUST.

  • Description: Name or description of the stylesheet.

  • Form No.: Lookup to select the form we want to associate with this stylesheet; this document will open when using the "export to Word" function on the customer card.

  • Page No.: Similar to Form No., pages are used in the RoleTailored client in NAV 2009 or later versions; but the functionality of exporting to Word is the same as in forms.

  • Mail Merge Document: This field is automatically selected if there is a mail merge document associated with the stylesheet.

  • Style Sheet Document: Similar to the Mail Merge Document field, this field is also automatically selected if there is a stylesheet associated to the document.

  • Version No.: This field shows the version of the stylesheet document. The version is automatically updated every time any changes are made to the stylesheet.

  • Table No. and Table Name: Shows the object number and the name of the table used.

  • Base Record: This is the base table used in this stylesheet form. We can use as many tables in a single stylesheet without having a direct relationship with the base table, but there must be one base record on every stylesheet. This table is used to relate to the other tables that are used for setting up table relationships.

  • Multiple Lines: This field is used if we want to have multiple lines for a record. For example, list pages or document pages with header and lines, where we have multiple lines related to a single header record.

    To use multiple lines, we will need to create a table in Word with the relevant fields and use the MULTILINE_BEGIN_XX tag. This tag can be found under the Mail Merge menu in MS Word.

If we want a limited number of lines, we can use filters on the main page or form. The exported data follows the filters used on the main page.


  • Fields Selected: This field is selected automatically, if we have selected one or more fields on the stylesheet.

  • Relationships: Select this field if we have defined any relationship with the base record.

  • Select Fields: Use this option to select the fields that we want to include in the stylesheet by table. If the Include Captions checkbox is selected, then the field caption for that field will be included in the stylesheet document.

  • Currency: This checkbox is selected only for decimal type fields; then the field will be displayed with two decimals.

Note: The number of decimal places are "not" taken from the rounding precision or any other setting for the stylesheet document.


  • Assign Table Relationship: This option allows us to define the table relationships to the base record.

  • Create Mail Merge: This option allows us to create our stylesheet in MS Word. When we close Word, we will be asked if we want to import the mail merge document and if we want to convert the document to a stylesheet.

  • Open Mail Merge: This command allows us to open the stored mail merge document. If we make changes, we can reconvert it to a stylesheet with the Convert Mail Merge to Style Sheet option.

  • Update Manage Style Sheets: This command creates a record in the stylesheet table (2000000066) so that we can use the new stylesheet in the rest of the Microsoft Dynamics NAV stylesheet implementation.

The options under Manage menu are as follows:

  • Mail Merge Document (Import, Export, and Remove): These options allow us to import, export, or remove the Word document associated with the stylesheet

  • Style Sheet Document (Import, Export, and Remove). These options allow us to import, export, or remove the associated XML stylesheet object

  • Definition Import and Export: These options allow us to export and import style definitions

After importing the document, we need to update the stylesheet using the Update Manage Style Sheet option.


Let's walk through the options under the Style Sheet setup:

  • Show Process Dialogs: This option allows the user to see the progress of all stylesheet processes. If this is not selected, then the user will see only the dialog boxes where user input is required.

  • Debug: This option is used to debug the XML data file for any error corrections and so on.

  • Location for XML file: This specifies the location where the debug file is stored.

  • Includes Captions Default: By checking this option, the captions are automatically included in the mail merge document. The user can still choose not to include a particular caption by not adding it in the actual document.

Let's walk through the options under the Role Tailored Client tab:

  • NAV Server Computer Name: This is the name of the NAV server computer that we connect to, with the RoleTailored client.

  • NAV Server Service Name: This is the name of the NAV server service that we connect to, with the RoleTailored client. The default value is Dynamics NAV.

Let's walk through the options under the Options tab:

  • Include Work Date: We can use this option to add a field in the mail merge document that will be replaced at runtime with the work date in the Word document.

  • Include Data Link: This feature allows us to add a field that will be replaced at runtime with the actual link back to the original form or page, where the stylesheet was run.

Other -----------------
- Exchange Server 2010 : Mastering Mobile Device and Wireless Access Essentials & Mastering Remote Mail and Outlook Anywhere Essentials
- Exchange Server 2010 : Managing Mobile Messaging Users - Mastering Outlook Web App Essentials
- Microsoft SQL Server 2008 Analysis Services : Designing More Complex Dimensions - Grouping and Banding
- Microsoft SQL Server 2008 Analysis Services : Building a Simple Cube
- Migrating to Windows Small Business Server 2011 Standard : Preparing Your Server (part 4) - Running the Migration Preparation Tool
- Migrating to Windows Small Business Server 2011 Standard : Preparing Your Server (part 3) - Best Practices Analyzer & Optimize Exchange Mailboxes
- Migrating to Windows Small Business Server 2011 Standard : Preparing Your Server (part 2) - Install Router, Firewall & Configuring Active Directory
- Migrating to Windows Small Business Server 2011 Standard : Preparing Your Server (part 1) - Network Configuration
- Microsoft Dynamics CRM 2011 : Adding Target Products and Sales Literature
- Microsoft Dynamics CRM 2011 : Selecting Target Marketing Lists
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server