Problem : How can I position a picture (.JPEG) in a WORD-document ? Based on sales lines items, i want to create a word document using navision automation microsoft word 9.0 object library containing pictures. My (simple) document must contain the quote no., a picture and a picture description. N-pictures (and its description) must be included in the word document in the same order as in the sales quote. In the navision code included, the picture is always put in the first paragraph. I could not solve the problem by using the range nor the selection command (wrong syntax ?, inlineshape ?). Please find the following Navision code from a codeunit(BE 2.00.A). CREATE(wdApp); TemplateName := ‘C:\Windows\Applicationdata\Microsoft\Templates\offerte’; wdDoc := wdApp.Documents.Add(TemplateName); wdApp.ActiveDocument.Fields.Update; wdRange := wdApp.ActiveDocument.Fields.Item(1).Result; wdRange.Text := ‘Quote number : ’ + Rec.“No.”; “Sales line”.RESET; “Sales line”.SETRANGE(“Document type”,Rec.“Document type”); “Sales line”.SETRANGE(“Document no.”,Rec.“No.”); “Sales line”.SETFILTER(Type,’=%1’,“Sales line”.Type::Item); IF “Sales line”.FIND(’-’) THEN BEGIN REPEAT BEGIN Item.GET(“Sales line”.“No.”); picture := Item.“Place and name JPEG”; wdInlineShape := wdApp.ActiveDocument.InlineShapes.AddPicture(picture); S := ‘’; text := 10; S[1] := text; wdApp.ActiveDocument.Range.InsertAfter(S); text := 13; S[1] := text; wdApp.ActiveDocument.Range.InsertAfter(S); wdApp.ActiveDocument.Range.InsertAfter(S); wdApp.ActiveDocument.Range.InsertAfter(S); S := Item.Description; wdApp.ActiveDocument.Range.InsertAfter(S); END; UNTIL “Sales line”.NEXT = 0; END; wdApp.Visible := TRUE; wdApp.ActiveDocument.Fields.Unlink; CLEAR(wdApp); How can i solve this problem? Best regards, Jan (Belgium)
I don’t have a real solution, but have you considered these ?: * Try using the range of the inlineshape : wdApp.ActiveDocument.InlineShapes.Range * The InsertAfter-method needs a text as parameter. This text has to be included in double quotes ("). This is quite a trick in Navision, because you’ll have to make them with double (or triple???) single quotes (’’). Something like : text := ‘‘13’’; I hope this will work for you ! Fozzie