Domino 9 und frühere Versionen > ND6: Entwicklung

Return im Textfeld entfernen

(1/4) > >>

Hedwig14:
Hallo,

die User haben teilweise in einem Textfeld ein Return gesetzt.
Dieses Return möchte ich nachträglich entfernen, da ich sonst
Probleme bei der Auswertung (Export in txt oder csv) habe.

Bislang habe ich es mit diesem Agenten versucht - leider ohne Erfolg

Sub Initialize
   Dim s As New NotesSession
   Dim db As NotesDatabase
   Dim view As NotesView
   Dim collection As NotesDocumentCollection
   Dim doc As NotesDocument
   Dim anzDoks As Double
   
   Set db = S.CurrentDatabase
   Set view =db.GetView ("(Umfrage_PR)")                              ' Ansichtsname
   Set collection = db.UnprocessedDocuments            ' ausgewähle Dokumente
   Set doc = collection.GetFirstDocument
   
   anzDoks = 0
   
   While Not(doc Is Nothing)
      anzDoks = anzDoks + 1
      Print anzDoks
      
      Dim varResult As Variant
      Dim varResult2 As Variant
      
      Const strFormula = |@ReplaceSubString(U_Antwort_5 ;@Newline;" ") |
      Const strFormula2 = |@ReplaceSubString(U_Antwort_5b ;@Newline;" ") |
      
      varResult = Evaluate(strFormula, doc)
      varResult2 = Evaluate(strFormula2, doc)
      
      doc.U_Antwort_5 = varResult
      doc.U_Antwort_5b = varResult2
      
      Call doc.save(True,True)      
      
      Set doc = collection.GetNextDocument( doc)
   Wend
   
   Msgbox "Es wurden "& anzDoks & " Dokumente angepasst"
   
End Sub

Thomas Schulte:
Dim CrLf As String
Dim PosOfCrLf As Integer
Const spaces = " " ' 2 spaces

CrLf = Chr$(13) & Chr$(10) ' Carriage Return and a Line Feed character

PosOfCrLf = Instr(Stringfield, CrLf)
While PosOfCrLf > 0
Mid$(stringfield, PosOfCrLf, 2) = spaces
PosOfCrLf = Instr(stringfield, CrLf)
Wend

Anywhere in the string that Chr$(13) and Chr$(10) appear together will be replaced by two spaces.

Axel:
Um welche Domino-Version handelt es sich hier denn?

Axel

Hedwig14:
Domino 6.55

LohCon:
... oder ersetze in Deiner Formel @NewLine durch -> @Char(0)

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln