Composing a document

Is there a way I can have a document composed without it actually showing up on the screen??

Subject: Composing a document

Yes. Backend document classes in LotusScript. See NotesDocument class to create and save a doc without it showing up in the UI.

Subject: RE: Composing a document

I’m having a difficult time with this. Can someone post generic code to do this task please.

Subject: RE: Composing a document

Here’s one - create a new document from a view:

Dim session As New notessession

 Dim db As notesdatabase

 Dim view As notesview

 Dim collection As notesdocumentcollection

 Dim docA As notesdocument

 

 Set db = session.currentdatabase

 Set view = db.getview("Form A")

 Set collection = db.unprocesseddocuments

 Set docA = collection.getfirstdocument

 

 Dim docB As New notesdocument(db)

 Dim a As String

 Dim b As String

 Dim c As String

 Dim d As String

 

 a = docA.Name(0)

 b = docA.Phone(0)

 c = docA.Location(0)

 d = docA.Dept(0)

 docB.Form = "Form A"

 docB.Name = a

 docB.Phone = b

 docB.Location = c

 docB.Dept = d

 

 Call docB.save (True, True)

Subject: RE: Composing a document

This is extrememely basic:===========================

dim s as new notessession

dim db as notesdatabase

dim doc as notesdocument

set db = s.currentdatabase

set doc = db.createdocument

doc.field1 = “abcdefg”

doc.field2 = “abc”

doc.field3 = 1000

doc.field4 = 0

call doc.save(true,true)

===========================

where field1, field2, etc. are field names you decide.

Notice that fields 1 & 2 are text fields, fields 3 & 4 are number fields.

It just gets more complicated after that, if you want to enter dates, or if you want to create readers fields, etc.

If you are just wanting to build a document to see how it works, this will do it.

  • Matt