Home > Back-end >  For help: Delphi xe3 how to invoke WORD within the template form to insert a new line?? urgent
For help: Delphi xe3 how to invoke WORD within the template form to insert a new line?? urgent

Time:10-18

1, I use CreateOleObject call WORF template - success!

2, I use VBA macro recording: insert form
FDoc. WordApplication. Selection. Insertrows (1); Prompt WordApplication error!

3, use the ADD method to increase form lines are also failed
WordApplication. Selection. Name the Item (1). The Add (WordApplication. Selection. Range, 2, 1, EmptyParam, EmptyParam);

Thank you master door!!!!!!!!!!

CodePudding user response:

 
Var
WordApp: OleVariant;
The begin
WordApp:=CreateOleObject (' word. Application);
Wordapp. Visible:=true;
Wordapp. Documents. The open (' C: \ Users \ lenovo \ Desktop \ Beijing. Doc ');

//insert row 2 column form
WordApp. ActiveDocument. Tables. The add (WordApp. Selection. Range, 2, 2, wdWord9TableBehavior);//wdWord9TableBehavior=1 automatically adjust form
//before the first line to join a line
WordApp. ActiveDocument. Tables. The item (1). The rows. The add (WordApp. ActiveDocument. Name the item (1) rows. The item (1));
end;
Pro feasible measurement
Method is to find the building Lord, but the parameter generation wrong!

CodePudding user response:

I have been to this matter, can automatically generate word and words and form to fill in
At that time, seems to be going to look inside the word source code, source code is a VB,
And then to convert the source code to Delphi

CodePudding user response:

It is recommended to use the rich style format changes, return to Word,
  • Related