L
lanyun2
Unregistered / Unconfirmed
GUEST, unregistred user!
2007-1-13 12:34 守柔
此事很难,之前我也谈到过,以下代码供参考:
Sub Example()
Dim oTable As Table, oCell As Cell
Dim H As Variant, W As Single, R As Integer, C As Byte
Dim A As Single, B As Single
For Each oTable In ActiveDocument.Tables
For Each oCell In oTable.Range.Cells
With oCell
R = .RowIndex
C = .ColumnIndex
If .Height = wdUndefined Then
A = .Range.Information(wdVerticalPositionRelativeToPage)
.Range.Select
Selection.MoveDown
B = Selection.Information(wdVerticalPositionRelativeToPage)
H = Int(B - A)
Else
H = Int(.Height)
End If
W = Int(.Width)
.Range.InsertBefore "(" & R & "," & C & "" & W & ":" & H
End With
Next
Next
End Sub
以上代码可以在Word中运行
谁能帮我翻译成Delphi可运行代码?
关键是 Information方法老是不能调用!
此事很难,之前我也谈到过,以下代码供参考:
Sub Example()
Dim oTable As Table, oCell As Cell
Dim H As Variant, W As Single, R As Integer, C As Byte
Dim A As Single, B As Single
For Each oTable In ActiveDocument.Tables
For Each oCell In oTable.Range.Cells
With oCell
R = .RowIndex
C = .ColumnIndex
If .Height = wdUndefined Then
A = .Range.Information(wdVerticalPositionRelativeToPage)
.Range.Select
Selection.MoveDown
B = Selection.Information(wdVerticalPositionRelativeToPage)
H = Int(B - A)
Else
H = Int(.Height)
End If
W = Int(.Width)
.Range.InsertBefore "(" & R & "," & C & "" & W & ":" & H
End With
Next
Next
End Sub
以上代码可以在Word中运行
谁能帮我翻译成Delphi可运行代码?
关键是 Information方法老是不能调用!