procedure TForm1.BitBtn1Click(Sender: TObject);
var
vWord,vDoc, vLine : OleVariant;
begin
vWord := CreateOleObject('Word.Application');
vWord.Visible := True;
vDoc := vWord.Documents.Open('C:/1.doc');
vLine := vdoc.Shapes.AddLine(10, 10, 250, 250, EmptyParam).Line;
// vLine.DashStyle := msoLineDashDotDot;
vLine.ForeColor.RGB := RGB(50, 0, 128);// 设置颜色
end;
{其他属性
With ActiveDocument.Shapes.AddLine(100, 100, 200, 300).Line
.DashStyle = msoLineDashDotDot
.ForeColor.RGB = RGB(50, 0, 128)
.BeginArrowheadLength = msoArrowheadShort
.BeginArrowheadStyle = msoArrowheadOval
.BeginArrowheadWidth = msoArrowheadNarrow
.EndArrowheadLength = msoArrowheadLong
.EndArrowheadStyle = msoArrowheadTriangle
.EndArrowheadWidth = msoArrowheadWide
end}