How to Wirte a "Word Automation" Report???????????

vijay_sr261982vijay_sr261982 Member Posts: 39


hai,

This is vijay from india. Can any one help me in , how to create Word Report using "Word Automation" like Excel. As i got an urgent "word report" from my client as a new requirement. Pls Help me.............. :(



Urs,
Vijay

Comments

  • kamalbkamalb Member Posts: 8
    i would like to know also
    plz help :shock:
  • WaldoWaldo Member Posts: 3,412
    Word automation is not that difficult. Mailmerge is a whole different story.

    I think you'll have to decide what you want to do.

    For simple Word Automation:
    //*** I use these variables:
    
    Name	DataType	Subtype	Length
    wrdApp	Automation	'Microsoft Word 11.0 Object Library'.Application	
    wrdDoc	Automation	'Microsoft Word 11.0 Object Library'.Document	
    wrdSel	Automation	'Microsoft Word 11.0 Object Library'.Selection	
    wrdTable	Automation	'Microsoft Word 11.0 Object Library'.Table	
    wrdColumn	Automation	'Microsoft Word 11.0 Object Library'.Column	
    wrdRange	Automation	'Microsoft Word 11.0 Object Library'.Range	
    
    
    
    //*** Here is some code:
    //***** Init a word document
    IF ISCLEAR(wrdApp) THEN
      CREATE(wrdApp);
    wrdDoc := wrdApp.Documents.Add;
    wrdSel := wrdApp.Selection;
    
    
    //***** Insert Text
    wrdSel.TypeText(ptxtText);
    wrdSel.TypeParagraph;
    
    
    //***** Insert a Title
    wrdSel.Font.Bold := 1;
    wrdSel.Font.Underline := 1;
    wrdSel.TypeText(ptxtText);
    wrdSel.Font.Bold := 0;
    wrdSel.Font.Underline := 0;
    
    //***** Insert a table
    InsertTable(pintRows : Integer;pintCols : Integer)
    wrdRange := wrdSel.Range;
    wrdTable := wrdDoc.Tables.Add(wrdRange,pintRows,pintCols);
    
    .
    .
    .
    

    If you just run a macro, record of what you want to accomplish in code, then view the code in VBA, then you can use this code in C/SIDE (converting to C/AL).

    For Mailmerge:
    I advise you to study codeunit 5054 thoroughly. You can learn many things of this codeunit.

    I prefer the mailmerge-methodology, because this gives the opportunity to work with templates. If you want to use the simple method, then the design is changed "in code".

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • vijay_sr261982vijay_sr261982 Member Posts: 39
    Thanks for helping me in my urgency Mr . Eric :-({|=.......................
  • WaldoWaldo Member Posts: 3,412
    No prob

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • BT_MarcBT_Marc Member Posts: 30
    Sorry wrong Them
Sign In or Register to comment.