locked
Insert Picture in MS Word Template Using Automation Variable in NAV 2009 R2 RRS feed

  • Question

  • Hi Experts!

    Could you tell me, How to Insert picture in MS Word using Automation Variable in nav 2009.

    Already i used a Custom Function to insert data from NAV, But Now My requirement is insert a picture.

    //<<================07.24.2015====================>>

    //<<============Automation Variable=================>>

    Name        DataType         Subtype           Length
    wdApp      Automation    'Microsoft Word 15.0 Object Library'.Application 
    wdDoc      Automation    'Microsoft Word 15.0 Object Library'.Document 
    wdRange  Automation    'Microsoft Word 15.0 Object Library'.Range 
    TemppathG Text 250

    //<<================End Variable======================>>
    CREATE(wdApp);
    TemppathG := 'C:\Users\Binesh.Singh\Desktop\Item Task\Technical Specification Word Template -2.docx';
    ItemSpec.GET("No.");
    IF NOT EXISTS(TemppathG) THEN
       ERROR('File Not Found In The Given Path.');

    wdDoc := wdApp.Documents.Add(TemppathG);
    wdApp.ActiveDocument.Fields.Update;

    wdRange := wdApp.ActiveDocument.Fields.Item(1).Result;

    wdRange.Text := ItemSpec."Item No.";
    wdRange.Bold := 1;
    wdRange := wdApp.ActiveDocument.Fields.Item(2).Result;
    wdRange.Text := Description;
    wdRange.Bold := 0;

    wdRange := wdApp.ActiveDocument.Fields.Item(3).Result;
    wdRange.Text := ItemSpec."Image URL";
    wdRange.Bold := 0;


    wdApp.Visible := TRUE;
    wdApp.ActiveDocument.Fields.Unlink;

    //<<==========END===========>>

    __________________________

    Thanks & Best Regards

    Binesh Singh Rajput

    (MCTS, MS, MCP)

    Friday, July 24, 2015 1:12 PM

All replies