Das Notes Forum

Domino 9 und frühere Versionen => ND6: Entwicklung => Thema gestartet von: Alexis am 10.03.06 - 13:27:37

Titel: Tabellentexte im RTF-Feld
Beitrag von: Alexis am 10.03.06 - 13:27:37
Hallo Forum,

folgende Problematik kann ich selbst nicht zu lösen:

•   Per Button lege ich in einer geöffneten Maske eine Tabelle mit Beschriftung an.
•   Danach editiere ich immmer noch im Editmode weitere Zellen der Tabelle,
•   Speichern der Tabelle mit:@If(@Command([FileSave]);@Command([FileCloseWindow]);"").
•   Nach dem abermaligen Öffnen des Dokumentes sind die editierten Texte verschwunden.

Hier der Code zum Erstellen der Tabelle und das (fehlerhafte) Handling im Frontend/Backend:

Zitat
Sub Click(Source As Button)
   Dim session As New NotesSession
   Dim workspace  As New NotesUIWorkspace
   Dim doc As NotesDocument
   Dim uidoc As NotesUIDocument
   Dim rtnav As NotesRichTextNavigator
   Dim db As NotesDatabase
   Set db = session.CurrentDatabase
   Set uidoc = workspace.CurrentDocument
   Set doc = uidoc.Document
   Call uidoc.close
   Dim body As New NotesRichTextItem(doc, "Content")
   Call doc.ReplaceItemValue("Form", "Angebot")
   Call doc.ReplaceItemValue("Content", "Table 4 x 3")
   rowCount% = 4
   columnCount% = 2
   Call body.AppendTable(rowCount%, columnCount%)
   Set rtnav = body.CreateNavigator
   Call rtnav.FindFirstElement(RTELEM_TYPE_TABLECELL)
   Call body.BeginInsert(rtnav)
   Dim richStyle As NotesRichTextStyle
   Set richStyle = session.CreateRichTextStyle
   richStyle.NotesColor = COLOR_BLACK
   richStyle.Bold = True
   Call body.AppendStyle(richStyle)
   richStyle.Bold = False
   Call body.AppendText("Angebotsordner:")
   Call body.EndInsert
   Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL,2)
   Call body.BeginInsert(rtnav)
   Call body.AppendText("Anfrage:")
   Call body.EndInsert
   Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL,2)
   Call body.BeginInsert(rtnav)
   Call body.AppendText("Angebot:")
   Call body.EndInsert
   Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL,2)
   Call body.BeginInsert(rtnav)
   Call body.AppendText("Auftrag:")
   Call body.EndInsert
   Call doc.Save( True, False)
   doc.saveoptions="0"
   Call uidoc.Close
   Set uidoc=workspace.editdocument(True,doc,False)
End Sub

Kann mir jemand raten?

Alexis
Titel: Re: Tabellentexte im RTF-Feld
Beitrag von: Axel am 10.03.06 - 13:42:01
Das liegt am Feld SaveOptions. Das musst du in deinem Script am Ende wieder entfernen.

Code
...
	Call doc.Save( True, False) 
	doc.saveoptions="0" 
	Call uidoc.Close
	Set uidoc=workspace.editdocument(True,doc,False)
	Set doc = uidoc.Document
	doc.RemoveItem("SaveOptions")
End Sub



Axel
Titel: Re: Tabellentexte im RTF-Feld
Beitrag von: koehlerbv am 10.03.06 - 13:47:42
Warum sollte SaveOptions dort stören? Das Doc wurde ja gerade erst im Backend gespeichert.
Allerdings verwundert mich (auch wenn das mit dem Problem nix zu tun hat): Was soll das uidoc.Close (und damit natürlich auch das SaveOptions = "0") eigentlich unten - uidoc.Close wird doch schon weit vorher ausgeführt (gleich nach Instantiierung von doc).

Bernhard
Titel: Re: Tabellentexte im RTF-Feld
Beitrag von: koehlerbv am 10.03.06 - 13:53:45
Schmarrn, Axel hat natürlich Recht: doc.SaveOptions wird gesetzt und dann diese Instanz wieder geöffnet! Es wird ja nicht das doc von Platte neu gelesen ...

Mea culpa, Axel!

Bernhard
Titel: Re: Tabellentexte im RTF-Feld
Beitrag von: Alexis am 10.03.06 - 14:22:53
Hallo ihr Spezis,

Problem gelöst und wieder etwas gelernt.

Super! Herzlichen Dank.

Alexis