Friday, October 10, 2014

Write Data to Word Documen

// Write Data to Word Document from AX

static void writeWordData(Args _args)
{
    COM                 document;
    COM                 wordDocument;
    COM                 range;
    COM                 app;
    COM                 font;
    COM                 shading;
    ;
    app = new COM('Word.Application');
    app.visible(true);
    document     = app.Documents();
    wordDocument = document.add();
    wordDocument.activate();
    range = wordDocument.range();
    range.insertBefore('Welcom To AX Document');
   
    font = range.font();
    font.Size(16);
    font.bold(2);
   
    shading = font.shading();
   
    //You can use either the integer directly or better way is to use RGB2Int
    //shading.BackgroundPatternColor(65535); //Yellow
    shading.BackgroundPatternColor(WinApi::RGB2int(255, 255, 0)); //Yellow
}

No comments:

Post a Comment

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...