Domino 9 und frühere Versionen > Entwicklung
wieder mal rich text fields
zeeboo:
hallo
wieder mal eine frage zu rich text felder
;)
ich will mir einige werte (text, number... und eben auch richtext) aus einem dokument holen und möchte diese in ein anderes dokument reinschreiben.
bei text, number... mach ich das so
doc.einText = Cstr(otherdoc.GetItemValue("myText")(0))
bei rich text haut das eben nicht so hin - weil die methode einen string liefert.
nun suche ich eine möglichkeit das selbe auch für rich text fields zu machen!
mfg
zeeboo
Till_21:
--- Zitat von: zeeboo am 23.07.03 - 10:00:04 ---bei rich text haut das eben nicht so hin - weil die methode einen string liefert.
--- Ende Zitat ---
??
na egal, muss ich nicht verstehen...
schau mal in die designer hilfe unter der notesrichtextitem - class...
hier ein auszug :
Dim doc As NotesDocument
Dim rtitem As Variant
Dim plainText As String
Dim fileNum As Integer
'...set value of doc...
Set rtitem = doc.GetFirstItem( "Body" )
If ( rtitem.Type = RICHTEXT ) Then
plainText = rtitem.GetFormattedText( False, 0 )
End If
gruss
Axel:
Hi,
wenn ich das richtig verstanden habe, willst du den Inhalt eines Richtextfeldes in ein RTF-Feld in einem anderen Dokument kopieren.
Hier ein Beispiel aus der Desinger-Hilfe:
--- Zitat --- 1. This script takes the Body item on document B and appends it to the end of the Body item on document A. The Body item on document B is deleted using the Remove method defined in NotesItem.
Dim docA As NotesDocument
Dim docB As NotesDocument
Dim rtitemA As Variant
Dim rtitemB As Variant
'...set values of docA and docB...
Set rtitemA = docA.GetFirstItem( "Body" )
Set rtitemB = docB.GetFirstItem( "Body" )
If ( rtitemA.Type = RICHTEXT And _
rtitemB.Type = RICHTEXT ) Then
Call rtitemA.AppendRTItem( rtitemB )
Call rtitemB.Remove
Call docA.Save( False, True )
Call docB.Save( False, True )
End If
--- Ende Zitat ---
Axel
zeeboo:
hab das nun kurz so ausprobiert
Dim db As NotesDatabase
Dim session As New NotesSession
Set db = session.CurrentDatabase
Dim docA As New NotesDocument (db)
Dim docB As New NotesDocument (db)
docA.Form = "testform"
docB.Form = "testform2"
Dim rtitemA As Variant
Dim rtitemB As Variant
Set rtitemA = docA.GetFirstItem( "rtfield1" )
Set rtitemB = docB.GetFirstItem( "rtfield2" )
If rtitemA.Type = RICHTEXT And rtitemB.Type = RICHTEXT Then
Call rtitemB.AppendRTItem( rtitemA )
Call rtitemA.Remove
Call docA.Save( False, True )
Call docB.Save( False, True )
End If
das ganze liefert aber beim "if" einen fehler: "object variable not set"
Axel:
Hi,
das ist es wieder, das alte leidige Thema mit den RTF-Feldern.
Diese sind erst vollständig initialisiert wenn das Dokument einmal gespeichert, geschlossen und wieder geöffnet wurde.
Versuch's mal so
Dim rtitemA As NotesRichTextItem
Dim rtitemB As NotesRichTextItem
Set rtitemA = New NotesRichTextItem (docA, "rtfield1" )
Set rtitemB = New NotesRichTextItem (docB, "rtfield2" )
...
Axel
Navigation
[0] Themen-Index
[#] Nächste Seite
Zur normalen Ansicht wechseln