Jul 12

Microsoft Office Integration from Dynamics NAV uses stylesheets to transfer data to Excel and Word. If you are on a v5 database or higher this is standard functionality. If you have upgraded your executables, you will notice the new buttons in the toolbar, but nothing happens when you click them. In order to get them working you need to import some new objects, and add a couple of new functions to codeunit 1. The objects are:

  • Form 690: Manage Style Sheets
  • Form 691: Send-to Programs
  • Form 692: Import Style Sheet
  • Form 693: Program Selections
  • Form 694: Style Sheets
  • Codeunit 403: Application Launch Management

Most of this blog entry is really nothing hot of the press, but i found a nice little trick for getting the records inserted into the tables automatically.

The new functions in codeunit are:

LaunchApp(DataXML : Automation "'Microsoft XML, v4.0'.DOMDocument40";StylesheetID : GUID;ApplicationXML : Automation "'Microsoft XML, v
EXIT(AppLaunchMgt.LaunchApp(DataXML,StylesheetID,ApplicationXML));

SelectStyleSheet(ObjectType : Integer;ObjectID : Integer;VAR StyleSheetID : GUID) : Boolean
EXIT(AppLaunchMgt.SelectStyleSheet(ObjectType,ObjectID,StyleSheetID));

ManageStyleSheets(ObjectType : Integer;ObjectID : Integer)
StyleSheets.SetObject(ObjectType,ObjectID);
StyleSheets.RUN;

These function needs to have these specifics ID’s in codeunit 1:

  • LaunchApp, ID=116
  • SelectStyleSheet, ID=117
  • ManageStyleSheets, ID=118

when you have the objects imported, and the functions created in codeunit 1 you are almost ready to rock and roll. You just need to setup the Send-To Program in table 2000000065 and import the Stylesheets via Tools, Manage Style Sheets. At least that is the way i used to do it until i found i could just run Codeunit 403 Application Launch Management, as it actually inserts all these records for you. Nice!

Now you are ready to go.

Of course you might want to change the Cronus logo in the default stylesheets to be your own logo. There are multiple guides on how to this, but i have found this to be a very quick/dirty way to do it:

  1. Open the stylesheet in eg. Notepad.exe, and search for “bindata”, you will see a big section of Base64 encoded text. That is the Cronus logo in bitmap format, encoded to Base64. Delete this.
  2. Go to http://www.motobit.com/util/base64-decoder-encoder.asp and input your own logo, choose output to Base64 text and copy/paste this back into notepad, where you just deleted the Cronus logo.
  3. Thats it.

The previous guide i used was from http://www.nextequalzero.com/2008/03/using-send-to-functionality-in-a-non-v5-dynamics-nav-database but suggested inserting all the records by hand. And a guide to change logo: http://www.nextequalzero.com/2008/02/xml-stylesheets-for-dynamics-nav-adding-your-logo

Also the official MS guide is here: https://mbs.microsoft.com/downloads/partner/Nav/50material/TechWhitePapers/XMLStyleSheetsTechWhitePaper.pdf

There are also a lot of hints on this on the main user groups MIBUSO and Dynamicsuser.

One Response to “RIM for Styleheets in Dynamics NAV”

  1. Thanks for this, helped me.

Leave a Reply to Mister Waster

preload preload preload
pornpants.com pornofri.com kilporn.com