Friday, March 21, 2014

To write Data WordDocument thrugh X++

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

Convert Call stack to readable format in D365FO X++

//Input --container _xppCallStack = xSession::xppCallStack();  Public static str POL_formatXppCallStack(container _xppCallStack, int _skipFr...