/ / ==================? Word_vba code? ============================= // SUB INWORD () DIM MyTable As Table? DIM MyTable As Table? DIM MyBOX, MyPict, Myshape As Shape? 'Draws the first rectangular box? Set mybox = activeDocument.shapes.addTextBox (orientation: = 1, left: = 90, top: = 70, width: = 414, Height: = 200)? 'Painted a vertical line? Set myline = activeDocument.shapes.addline (255, 70, 255, 270)
? 'Draw the first picture? Set mypict = activedocument.shapes.addpicture ("d: /test/test/load_jpg1/photo/108259.jpg", _? Linktofile: = false, savewithdocument: = true, left: = 180 , Top: = 80, width: = 65, height: = 80)? 'Painted the second picture? Set mypict = activeDocument.shapes.addpicture ("d: /test/test/load_jpg1/Photo/108259.jpg" , _? Linktofile: = false, savewithdocument: = true, left: = 262, top: = 80, width: = 65, height: = 80)?? 'Name? Set myshape = activeDocument.shapes.addTextBox (orientation: = 1, left: = 108, top: = 198, width: = 126, height: = 18)? Myshape.line.visible = msofalse? Myshape.textFrame.TextRange.text = "Name: New help"
? 'Age? Set myshape = activeDocument.shapes.addTextBox (orientation: = 1, left: = 108, top: = 225, width: = 126, height: = 18)? Myshape.line.visible = msofalse? Myshape.textframe .TextRange.text = "Age: 12"? 'Personal Information? Set myshape = ActiveDocument.Shapes.addTextBox (Orientation: = 1, Left: = 351, Top: = 90, width: = 126, Height: = 99) ? myshape.line.visible = msofalse? myshape.textframe.textRange.text = "Personal Information"
? 'Text box Add table? Set myshape = activeDocument.shapes.addTextBox (orientation: = 1, left: = 288, top: = 198, width: = 189, height: = 63)? Myshape.line.visible = msofalse ? Set myTable = ActiveDocument.Tables.Add (Range: = myShape.TextFrame.TextRange, NumRows: = 3, NumColumns: = _ ??????? 2, DefaultTableBehavior: = wdWord9TableBehavior, AutoFitBehavior: = wdAutoFitFixed)? myTable. Cell (1, 1) .range.text = "Weight"? MyTable.cell (1, 2) .range.text = "40kg"? MyTable.cell (2, 1) .range.text = "Height"? MyTable? .Cell (2, 2) .range.text = "120cm"? MyTable.cell (3, 1) .Range.text = "Sit high"? MyTable.cell (3, 2) .range.text = "65cm" End sub / / ================================================ // Procedure Indelphi ; varWordApp, WordDoc, WordTable, wordShape: OleVariant ;? // se: Selection; filename:? string; begin SaveDialog1.InitialDir:? = ExtractFilePath (Application.ExeName) 'out_file' ;? SaveDialog1.Execute ;? self.Refresh FileName: = Savename: = Savedialog1.FileName ;? if longth (filename) = 0 THEN? Begin ???? Application.MessageBox ('? No storage location of the statistics, can not save statistics!?', 'prompt box ', MB_OK;?? ?? exit ;? end ;? Wordapp: = createoleObject ('word.application') ;? Wordapp.visible: = true ;? WordDoc: = Wordapp.Documents.add ;? Try
? // Draw the first rectangular box? WordDoc.shapes.addTextBox (orientation: = 1 ,? left: = 90, top: = 70, width: = 414, height: = 200) ;? // draw a vertical line WordDoc.shapes.addline (255, 70, 255, 270) ;? // Draw the first picture? WordDoc.shapes.addpicture (extractfilepath (application.exename) 'Photo / 108259.jpg' ,? linktofile: = false, Savewithdocument: = true, left: = 180, top: = 80, width: = 65, Height: = 80);??? 第二 第二 第二? WordDoc.shapes.addpicture (extractFilepath (Application.exename) 'Photo /108259.jpg ',? Linktofile: = false, savewithdocument: = true, left: = 262, top: = 80, width: = 65, Height: = 80);
? // Dialect Name box? Wordshape: = worddoc.shapes.addtextBox (orientation: = 1, left: = 108, top: = 198, width: = 126, height: = 18) ;? Wordshape.Line.Visible: = False ;? wordshape.text: = 'Name: New help';? // Age? Box? Wordshape: = worddoc.shapes.addTextBox (orientation: = 1, left: = 108, top: = 225, width : = 126, Height: = 18); //. Select ;? Wordshape.Line.Visible: = false ;? Wordshape.TextFrame.TextRange.text: = 'Age: 12' ;? // Personal Information? Box? Wordshape : = WordDoc.shapes.addTextBox (orientation: = 1, Left: = 351, Top: = 90, width: = 126, Height: = 99); //. select ;? Wordshape.Line.Visible: = false ;? Wordshape.textFrame.TextRange.text: = 'Personal Information'; // Add Table in Wordshape: = WordDoc.shapes.addTextBox (Orientation: = 1, Left: = 288, Top: = 198, width: = 189, Height: = 63); //. Select ;? Wordshape.Line.Visible: = false ;? WordTable: = WordDoc.tables.add (Range: = Wordshape.TextFrame.TextRange, Numrows: = 3, NumColumns: = 2, ???????? DefaultTableBehavior: = WDWORD9TABEBEHAVIOR, Autofitbehavior: = wdautofitfixed);? WordTable.cell (1, 1) .range.text: = 'Weight';? WordTable.cell (1, 2). Range.text: = '40kg';? WordTable.cell (2, 1) .range.text: = 'Height';? WordTable.cell (2, 2) .range.text: = '120cm' ;? WordTable. Cell (3, 1) .range.text: = 'Sit high';? WordTable.cell (3, 2) .range.text: = '65cm' ;? WordDoc.saveas (filename) ;? Application.MessageBox (' ? Output success! ? ',' Prompt box ', MB_OK);
Finally? WordDoc.saved: = true ;? WordDoc.close ;? Wordapp.quit ;? End;
END;