863
社区成员
发帖
与我相关
我的任务
分享
Dim WordApp As Word.Application = Global.WgmWordAss.Globals.WgmWordAss.Application
Dim oDoc As Word.Document = WordApp.ActiveDocument
Dim M As Integer = 1
Dim RowNo, ColNo As Integer
Dim Tb As Word.Table
Dim Txt As String
If WordApp.Selection.Information(Word.WdInformation.wdWithInTable) Then
Tb = WordApp.Selection.Tables(1)
Dim Num As Integer = Tb.Rows.Count
Dim N As Integer = WordApp.Selection.Information(Word.WdInformation.wdEndOfRangeRowNumber)
While WordApp.Selection.Information(Word.WdInformation.wdWithInTable)
RowNo = WordApp.Selection.Information(Word.WdInformation.wdEndOfRangeRowNumber)
ColNo = WordApp.Selection.Information(Word.WdInformation.wdEndOfRangeColumnNumber)
Txt = Tb.Cell(RowNo, ColNo).Range.Text
If Strings.Left(Txt, 1) = "(" Then
Tb.Cell(RowNo, ColNo).Range.Text = "(" & CStr(Format(M, "000")) & ")"
Else
Tb.Cell(RowNo, ColNo).Range.Text = CStr(Format(M, "000"))
End If
M = M + 1
If M > Num - N + 1 Then
Exit While
End If
WordApp.Selection.MoveDown(Word.WdUnits.wdLine)
End While
End If
Dim WordApp As Word.Application = Global.WgmWordAss.Globals.WgmWordAss.Application
Dim oDoc As Word.Document = WordApp.ActiveDocument
Dim M As Integer = 1
Dim RowNo, ColNo As Integer
Dim Tb As Word.Table
Dim Txt As String
If WordApp.Selection.Information(Word.WdInformation.wdWithInTable) Then
Tb = WordApp.Selection.Tables(1)
Dim Num As Integer = Tb.Rows.Count
Dim N As Integer = WordApp.Selection.Information(Word.WdInformation.wdEndOfRangeRowNumber)
Dim LastRowNo as Integer=0
While WordApp.Selection.Information(Word.WdInformation.wdWithInTable)
RowNo = WordApp.Selection.Information(Word.WdInformation.wdEndOfRangeRowNumber)
ColNo = WordApp.Selection.Information(Word.WdInformation.wdEndOfRangeColumnNumber)
if RowNo>LastRowNo then
Txt = Tb.Cell(RowNo, ColNo).Range.Text
If Strings.Left(Txt, 1) = "(" Then
Tb.Cell(RowNo, ColNo).Range.Text = "(" & CStr(Format(M, "000")) & ")"
Else
Tb.Cell(RowNo, ColNo).Range.Text = CStr(Format(M, "000"))
End If
M = M + 1
LastRowNo=RowNo
If M > Num - N + 1 Then
Exit While
WordApp.Selection.MoveDown(Word.WdUnits.wdLine)
end if
else
Exit While
End if
End While
End If