creating a table in MS WORD from NAV

RudiRutscheRudiRutsche Member Posts: 30
I am trying to create an interaction template with a bookmarkin it.
At this mark I want to create a dynamic filled table when I log a segment.

I have this code for creating and filling the table:
IF RECORD FIND ('-') THEN BEGIN
  IF wrdDoc.Bookmarks.Exists(BookmarkName) THEN BEGIN
    wrdRange := wrdDoc.Bookmarks.Item(BookmarkName.Range;
    wrdRange.Text := '';
    wrdRange.Start := wrdRange."End";    
    wrdRange.Tables.Add(wrdRange,RECORD.COUNT + 1,3);
    wrdTable := wrdRange.Tables.Item(1);
  [...]


In line wrdTable := wrdRange.Tables.Item(1); occurs an error, cause word couldnt find the item.
Is there any problem in the way I created the table?
Did I forget anything?

Comments

  • garakgarak Member Posts: 3,263
    Hi, for Tables and Table i use the own functions:
    ...
    WordRange := WordSelection.Range;
        
    //Instanz für Tabelle
    WordTables := WordRange.Tables;
    ....
    
    WordTable := WordTables.AddOld(WordRange,Lines,Coloumns);
    ....
    
    

    After creating the Table i fill this out with my data and then move left or right (WordSelection.Move(i) or MoveDown / MoveLeft / MoveRight/ etc.)

    Regards
    Do you make it right, it works too!
Sign In or Register to comment.