Dynamics AX Blog - Posts from December 2013

These posts are machine-translated.
Currently, only posts from »December 2013« are displayed Filter entfernen

How to use an assembly/DLL in Dynamics AX

To use a DLL in Dynamics AX, the DLL must be added to the References node of the AOT.

This can be achieved by right-clicking on the node and select Add Reference. This opens a dialog where - depending on the "location" of the DLL - the following steps must be taken:

  • If the DLL is already registered in the Global Assembly Cache (GAC), it should already appear in the list where they can be selected using the checkbox on the left and selected with Select now.

    To register a DLL in the GAC, it is necessary that the DLL has been signed.
    They can be achieved via the command line using the following command
    "gacutil / i MyClassLibrary.dll"
  • If the DLL for example, is stored in the BIN directory of the client, you must first select it using the Browse button. Now they should appear in the list where they can be selected using the checkbox on the left and selected with Select.

In both cases, the dialog needs to be confirmed with OK.


 
 
 

Create word document by code

Microsoft WordBelow you will find a simple job, that creates a Word document containing a table. The example also sets the frame and the color of the table.
The example requires a locally installed Microsoft Word.

static void CreateWordFileWithTable(Args _args)
{
    COM wordApplication;
    COM wordTables;
    COM wordTable;
    COM wordSelection;
    COM wordTableRows;
    COM wordRange;
    COM wordTableCell;
    COM wordTableCellRange;
    COM wordDocuments;
    COM wordDocument;
    COM wordTableBorders;
    ;
 
    // Initialize Word object and document
    wordApplication = new COM("Word.Application");
    wordDocuments = wordApplication.documents();
    wordDocuments.add();
    wordDocument = wordDocuments.item(1);
 
    wordSelection = wordApplication.selection();
    wordRange = wordSelection.range();
 
    // Get table collection
    wordTables = wordSelection.tables();
 
    // Create table with 3 rows and 5 columns
    wordTable = wordTables.add(wordRange, 3, 5);
 
    // Fill cell: First line, second column
    wordTableCell = wordTable.Cell(1, 2);
    wordTableCellRange = wordTableCell.range();
    wordTableCellRange.text("Hello");

    // Fill cell: Second line, third column
    wordTableCell = wordTable.Cell(2, 3);
    wordTableCellRange = wordTableCell.range();
    wordTableCellRange.text("World");
 
    // Enable table borders
    wordTableBorders = wordTable.borders();
    wordTableBorders.enable(true);

    // Add colored borders
    wordTableBorders.InsideLineStyle(3);
    wordTableBorders.OutsideLineStyle(5);
    wordTableBorders.OutsideColorIndex(2);
 
    // Get table row collection and add a new row
    wordTableRows = wordTable.rows();
    wordTableRows.add();
 
    // Open word
    wordApplication.visible(true);
    wordApplication.finalize();
}

The created word document looks like this:

Screenshot


 
 
 

 

 
 
 
Posts of the actual month
December 2013
MoTuWeThFrSaSu
 1
2345678
9101112131415
16171819202122
23242526272829
3031 
 
© 2006-2025 Heinz Schweda | Imprint | Contact | German version | Mobile version
In order to provide you with better service, this site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.