Description
Returns all paragraph tags in a string.
Syntax
sResult = GetAllTags(bTable) |
bTable
True, if searching in a table.
Public Function GetAllTags(ByVal bTable) As String ' bTable = true: if in table, select table tags; bTable = false: select local cell para tags Dim oC = Text.GetCursor(modeSrcOn, cposCursor, False) ' current position: may be in text or at start para - with tags shown or hidden, in a table or not Dim oT = oC.Duplicate Dim markerParaStart As Short = tptUnknown Dim curPos As Short = tptUnknown
If Text.TestCursorInTable Then If bTable Then markerParaStart = tptPara oT = CursorTableFirstCell() Else markerParaStart = tptStartTab End If Else markerParaStart = tptPara End If Dim bMoved As Boolean = False Dim strTagsP As String = "" Dim iMovedPos As Integer = 0 Do ' find end of prev para or start text; handle also long tag strings of tables Dim oDT = oT.GetDesc curPos = oT.GetDesc.GetType If curPos = tptStartCmd Then strTagsP = ">" & strTagsP If curPos = tptEndCmd Then strTagsP = "<" & strTagsP If oT.GetDesc.GetChar > 0 Then strTagsP = ChrW(oT.GetDesc.GetChar) & strTagsP End If If bMoved And (oDT.GetType = markerParaStart) Then oT.Move(1) ' Text.InsTedTextAt(oT, "#from") ' Text.CursorTo(oT) ' Text.EditBlockStart() Exit Do End If bMoved = True iMovedPos += 1 If oT.Move(-1) <> 0 Then Exit Do Loop Dim strTags As String = "" Dim oSP = oT.Duplicate curPos = tptUnknown Do curPos = oSP.GetDesc.GetType If curPos = tptText Or curPos = tptStartTab Or curPos = tptPara Then Exit Do If curPos = tptStartCmd Then strTags = strTags & ">" If curPos = tptEndCmd Then strTags = strTags & "<"
If oSP.GetDesc.GetChar > 0 Then strTags = strTags & ChrW(oSP.GetDesc.GetChar) End If If oSP.Move(1) <> 0 Then Exit Do Loop Text.CursorTo(oC) Return strTags End Function
|
See also