Nachdem die Function ProcessRTTags(...) ( in lib.appl.functions )aus welchem grunde auch immer in der Version 1.5.3 nicht mehr oder nicht unbedingt immer zu funktionieren scheint, habe ich mir den Code heute noch einmal vorgenommen.
Die Funktion steigt an dieser Stelle mit einem fehler aus
| If rtnav.FindFirstString ( TAG_PREFIX, _ |
| RT_FIND_CASEINSENSITIVE) Then |
| Do |
| Call rtrange.SetBegin ( rtnav ) |
| strTemp = strTemp + TAG_DELIMITER + Mid$ ( rtrange.textRun, 3, Instr( rtrange.textRun,TAG_SUFFIX ) -3 ) |
| Loop While rtnav.FindNextString ( TAG_PREFIX, RT_FIND_CASEINSENSITIVE ) |
| End If |
offenbar kommt das rtrange.textRun nicht mit den im text enthaltenen CRLF klar. Aber das wohl erst seit Neuestem. Hatten wir doch erst im November letzten Jahres einen Workaround implementiert, bei dem die <<tags>> nicht mehr aus dem RTfeld selber, sondern aus dem unformatierten Feldinhalt ( GetUnformattedText ) ermittelt. Hat ja auch ganz gut funktioniert.
Lange Rede, kurzer Sinn. Funktioniert nicht mehr, also muss eine neue Lösung her.
Hier also dann die momentan funktionierende Funktion
| Function ProcessRTTags(rtitem As NotesRichTextItem, linkto As NotesDocument, basedoc As NotesDocument, parentdoc As NotesDocument) As Integer |
| %REM |
| ################################################################################### |
| Goal: Replace defined tags in richtext item rtitem with corresponding items/values from referenced docs |
| |
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| Arguments: Description: |
| rtitem NotesRichTextItem RichTextItem to search for tags and replace them with appropriate values |
| linkto NotesDocument actual document |
| basedoc NotesDocument base document of actual document |
| parentdoc NotesDocument parent document of actual document |
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| Return: |
| TRUE or FALSE. |
| TRUE if the function runs without an error |
| FALSE if the function has an error |
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| Example: |
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| VERSION / WHEN / WHO / CHANGES |
| |
| 1.0/22.03.2006/Marc Aigner/ |
| 1.1/26.04.2006/Thomas Schulte/added functionality to enter newlines with multivalue fields and replace CRLF within strings. |
| 1.2/18.02.2007/Ulrich Krause/Replace all occurencies of space, CRL and TAB in rtitem.text |
| '################################################################################### |
| %END REM |
| On Error 4504 Goto ERROR_4504 |
| On Error Goto ERRHANDLE |
| |
| Const TAG_FORMULA_PREFIX = "[" |
| Const TAG_FORMULA_SUFFIX = "]" |
| Const TAG_PREFIX = "<<" |
| Const TAG_SUFFIX = ">>" |
| Const TAG_DELIMITER ="~" |
| Const TAG_FIELDDELIMITER = ":" |
| |
| Dim rtnav As NotesRichTextNavigator |
| Dim rtrange As NotesRichTextRange |
| Dim fieldreaddoc As NotesDocument |
| |
| Dim strT As String |
| Dim strReplT As String |
| Dim strTemp As String |
| Dim strTag As String |
| Dim getString As String |
| Dim arrRetFieldNames As Variant |
| Dim arrRetGetFieldFrom As Variant |
| Dim ret As Integer |
| Dim retvar As Variant |
| Dim readfromitem As NotesItem |
| Dim CrLf As String |
| |
| ProcessRTTags = True |
| |
| If Not linkto Is Nothing Then |
| strTemp = "" |
| |
| ' |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
Die Funktion ist der echte Horror, weil es selbst im Debugger keinerlei Anhaltspunkte gibt, warum beim rtRange.TextRun ein fehler auftritt. Alle Workarounds stützen sich mehr auf Vermutungen als auf sichere Erkenntnisse.
Hierzu einen Call bei IBM aufzumachen ist wahrscheinlich genauso sinnlos, wie dem Papst das Zölibat auszureden ... Aber das ist eine andere Geschichte.