Показать сообщение отдельно
  #3  
Старый 01.12.2009, 00:47
GePard GePard вне форума
Прохожий
 
Регистрация: 29.11.2009
Сообщения: 2
Репутация: 10
По умолчанию

Вот полный код, может что-то забыл добавить?

Код:
unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComObj;

type
  TForm2 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;
  Word:variant;
  Doc:variant;
  Table1:variant;
  
implementation

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);
begin
  Word:=CreateOleObject('Word.Application');
  Word.visible:=true;
  Doc:=Word.Documents.Add;
  Doc.Activate;
  Doc.PageSetup.LeftMargin:=25000/353;//Здесь хотел использовать CentimetersToPoints
  Doc.PageSetup.TopMargin:=10000/353;
  Doc.PageSetup.RightMargin:=10000/353;
  Doc.PageSetup.BottomMargin:=10000/353;
  Table1:=Doc.Tables.Add(Range:=Word.Selection.Range,NumRows:=100,NumColumns:=35);
  Table1.Rows.Height:=2500/353;
  Table1.Columns.Width:=5000/353;
  Table1.Rows.HorizontalPosition:=2500/353;
  Table1.Range.Font.Size:=5;
  Table1.Cell(1,1).Merge(Table1.Cell(3,29));
  Table1.Cell(1,2).Merge(Table1.Cell(3,7));
  Table1.Cell(1,2).Range.Text:='Листов _____';
  Table1.Cell(1,2).Range.Font.Size:=12;
  Table1.Cell(1,2).Paragraphformat.Alignment:=wdAlignParagraphCenter;
  Table1.Cell(1,2).VerticalAlignment:=wdCellAlignVerticalCenter;
  
end;

end.
Ответить с цитированием