Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export to Word format issue

Status
Not open for further replies.

Auggz

Programmer
Dec 22, 2005
12
0
0
US
I have a Lotus Script agent that exports contents from a web form into a word document. The issue I am running into is that when the agent exports certain fields that contain bullets or numberings, it wraps them around on the word document and does not format them properly on word to appear bulletted or numbered in paragraphs. I was wondering is there a way to tell the agent to format the field contents the same way they are formated on the web form?

This is more of a presentation issue because the agent does perform its function properly only that the users want the document to look presentable also on word without intervention.

Heres the script with the fields in question.

Dim ses As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim descItem As NotesItem
Dim sumItem As NotesItem
Dim specItem As NotesItem

Set db = ses.CurrentDatabase
Set lookupdoc = db.GetDocumentByUNID(v_docid$)
Set descItem = lookupdoc.getfirstitem("desc")
Set sumItem = lookupdoc.getfirstitem("summary")
Set specItem = lookupdoc.getfirstitem("specs")

Print |Content-Type:application/vnd.ms-word|
Print |Content-Disposition: attachment; filename="preq.doc"|

Print |<br><b>General Summary:</b>|
Print |<br>| & sumItem.text
Print |<br>|
Print |<br><b>Principal Duties and Responsibilities: </b>|
Print |<br>| & descItem.text
Print |<br>|
Print |<br><b>Job Specifications (education, years of professional experience,technical skills, etc)</b>|
Print |<br>| & specItem.text
 
It would have been better/more effective to use an OLE object for this, but then Word has to be installed on the server in question...

Another suggestion is to use the NotesStream instead of Print, see Notes Help 6.x

To loop around and get a better formatting, use a loop something similar to this:

...
stream.WriteText("<h4>Principal Duties and Responsibilities</h4>")
stream.WriteText("<UL>", EOL_PLATFORM)
For i=LBound(sumItem) to UBound(sumItem)
stream.WriteText(sumItem(i).Text, EOL_PLATFORM)
Next
stream.WriteText("</UL><BR><BR>", EOL_PLATFORM) ' Couple of add'l line breaks...

stream.WriteText("<h4>Job Specifications etc...</h4>")
stream.WriteText("<UL>", EOL_PLATFORM)
For i=LBound(specItem) to UBound(specItem)
stream.WriteText(specItem(i).Text, EOL_PLATFORM)
Next
stream.WriteText("</UL><BR><BR>", EOL_PLATFORM)
...

With a NotesStream object there could be easier to write directly to file, but it is only a suggestion... The above will also work fine with PRINT

TrooDOS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top