添加一addTextBox成功,如何设置其属性并填充字符串,在线等,谢谢!!!!!!

解决方案 »

  1.   

    Function TextToTextBox (TextBox:variant;text: string):boolean;
     const msoTextBox=17;
    begin
     TextToTextBox:=true;
     try
      if w.ActiveDocument.Shapes.Item(TextBox).Type = msoTextBox then
       W.ActiveDocument.Shapes.Item(TextBox).TextFrame.TextRange.Text:=Text
      else TextToTextBox:=false;
     except
      TextToTextBox:=false;
     end;
    End;
      

  2.   

    Function CreateTextBox (Left,Top,Width,Height:real;
      var name:string):boolean;
     const msoTextOrientationHorizontal=1;
    begin
     CreateTextBox:=true;
     try
      name:=W.ActiveDocument.Shapes.AddTextbox
      (msoTextOrientationHorizontal,Left,Top,Width,Height).Name;
     except
      CreateTextBox:=false;
     end;
    End;
      

  3.   

    请问Left,Top,Width,Height的单位是什么,谢谢
      

  4.   

    procedure TSheet.ExportLabelsToExcel(workSheet: OleVariant);
    var i: integer; TextBox:variant;
    begin
      TextBox:= workSheet.Shapes.AddTextBox(1, 20, 20,50,20).name;
      workSheet.Shapes.Item(TextBox).TextFrame.TextRange.Text:='Text'; //出错行
    end;出错信息:ProjectAcReport.exe raised exception class EOleError with Message 'Method 'TextRange' not supported by automation object'