// Merge Word table cell procedure mergeWordCell; var WordApp: TWordApplication; ??? WordDoc: TWordDocument; ??? DocInx, oFileName, CfCversions, oReadOnly, AddToRctFiles, PswDocument, ??? PswTemplate, oRevert, WPswDocument, WPswTemplate, oFormat : Olevariant; ??? I, irow, icol: integer; ??? mycell: core; ??? mycent: row; begin? Memo1.Lines.clear;
??? // ===== Create an object ===== ??? if not assigned (wordapp) THEN ????????????????????????????????????? ???? begin ????? WordApp: = twordapplication.create (nil); ????? Wordapp.visible: = false; ??? end; ??? if not assigned (worddoc) THEN ?? ??? WordDoc: = TWordDocument.create (nil) ;? Try ??? docinx: = 1; ??? ofilename: = 'd: /test.doc'; ??? oreadonly: = true; ??? cfcversions : = EmptyParam; ??? AddToRctFiles: = EmptyParam; ??? PswDocument: = EmptyParam; ??? PswTemplate: = EmptyParam; ??? oRevert: = EmptyParam; ??? WPswDocument: = EmptyParam; ??? WPswTemplate: = EmptyParam; ??? o format: = EmptyParam; ???? ??? // ===== Open file ===== ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????? ??? Wordapp.Documents.open (OfileName, Cfcvers, Oradonly, AddtorctFiles, ?????? pswdocument, pswinterplate, orevert, wpswdocument, wpswtemplate, OFORMAT); ??? // ==== = Related file ===== ??? WordDoc.connectto (Wordapp.Documents.Item (Docinx));
??? // Merge first, two columns ??????? iStart: = WordDoc.tables.Item (i) .cell (1, 1) .range.start; ??????? mycol: = WordDoc.tables.Item (i) .Columns.Item (2); ??????? Iend: = mycol.cells.Item (mycol.cells.count) .range.end_; ????????????????????????????? ? myrange: = worddoc.range; ??????? myrange.start: = iStart; ??????? myrange.end_: = IEND; ??????? myRANGE.CELLS.MERGE