
06.12.2007, 18:07
|
Начинающий
|
|
Регистрация: 05.01.2007
Адрес: Днепропетровск
Сообщения: 141
Репутация: 25
|
|
И продолжение.
Код:
Function SetMergeCellsTable(Table:integer;Row1,Column1,Row2,Column2:integer):boolean;
var cel_:variant;
begin
SetMergeCellsTable:=true;
try
cel_:=W.ActiveDocument.Tables.Item(Table).Cell(Row2,Column2);
W.ActiveDocument.Tables.Item(Table).Cell(Row1,Column1).Merge(cel_);
except
SetMergeCellsTable:=false;
end;
End;
Function GetSelectionTable:boolean;
const wdWithInTable=12;
begin
try
GetSelectionTable :=W.Selection.Information[wdWithInTable];
except
GetSelectionTable :=false;
end;
End;
Function GoToNextTable (table_:integer):boolean;
const wdGoToTable=2;
begin
GoToNextTable:=true;
try
W.Selection.GoToNext (wdGoToTable);
except
GoToNextTable:=false;
end;
End;
Function GoToPreviousTable (table_:integer):boolean;
const wdGoToTable=2;
begin
GoToPreviousTable:=true;
try
W.Selection.GoToPrevious(wdGoToTable);
except
GoToPreviousTable:=false;
end;
End;
Function GetColumnsRowsTable(table_:integer; var Columns,Rows:integer):boolean;
const
wdMaximumNumberOfColumns=18;
wdMaximumNumberOfRows=15;
begin
GetColumnsRowsTable:=true;
try
Columns:=W.Selection.Information[wdMaximumNumberOfColumns];
Rows:=W.Selection.Information[wdMaximumNumberOfRows];
except
GetColumnsRowsTable:=false;
end;
End;
Function GetColumnRowTable(table_:integer; var Column,Row:integer):boolean;
const
wdStartOfRangeColumnNumber=16;
wdStartOfRangeRowNumber=13;
begin
GetColumnRowTable:=true;
try
Column:=W.Selection.Information[wdStartOfRangeColumnNumber];
Row:=W.Selection.Information[wdStartOfRangeRowNumber];
except
GetColumnRowTable:=false;
end;
End;
Function AddRowTableDoc (table_:integer):boolean;
begin
AddRowTableDoc:=true;
try
W.ActiveDocument.Tables.Item(table_).Rows.Add;
except
AddRowTableDoc:=false;
end;
End;
Function InsertRowsTableDoc(table_,position_,count_:integer):boolean;
begin
InsertRowsTableDoc:=true;
try
W.ActiveDocument.Tables.Item(table_).Rows.Item(position_).Select;
W.Selection.InsertRows (count_);
except
InsertRowsTableDoc:=false;
end;
End;
Function InsertRowTableDoc(table_,position_:integer):boolean;
var row_:variant;
begin
InsertRowTableDoc:=true;
try
row_:=W.ActiveDocument.Tables.Item(table_).Rows.Item(position_);
W.ActiveDocument.Tables.Item(table_).Rows.Add(row_);
except
InsertRowTableDoc:=false;
end;
End;
//------------------------------ TextBox ----------------------------------
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;
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;
Function CreateLine(BeginX,BeginY,EndX,EndY:real;var name:string):boolean;
begin
CreateLine:=true;
try
name:=W.ActiveDocument.Shapes.AddLine(BeginX,BeginY,EndX,EndY).Name;
except
CreateLine:=false;
end;
End;
Function CreatePicture(FileName:string;Left,Top:real;var name:string):boolean;
begin
CreatePicture:=true;
try
name:=W.ActiveDocument.Shapes.AddPicture(FileName).Name;
W.ActiveDocument.Shapes.Item(name).Left:=Left;
W.ActiveDocument.Shapes.Item(name).Top:=Top;
except
CreatePicture:=false;
end;
End;
Function GetNameIndexShape(NameIndex:variant):string;
begin
try
GetNameIndexShape:=W.ActiveDocument.Shapes.Item(NameIndex).Name;
except
GetNameIndexShape:='';
end;
End;
Function SetNewNameShape(NameShape:variant;NewNameShape:string):string;
begin
try
W.ActiveDocument.Shapes.Item(NameShape).Name:=NewNameShape;
SetNewNameShape:=NewNameShape;
except
SetNewNameShape:='';
end;
End;
Function DeleteShape (NameShape:variant): variant;
Begin
DeleteShape:=true;
try
W.ActiveDocument.Shapes.Item(NameShape).Delete;
except
DeleteShape:=false;
end;
End;
|