NTPAddAttachment

 

NTPAddAttachment ( <ReportHandle>, <ServerName>, <DatabaseName>, <UNID>, <ItemName>, <AttachmentName> ) -> <ErrorCode>

 

 

Description

This function enables you to convert attachments of a Notes document and to attach them to a report. Which attachments (file name) and from which fields of the document they are to be passed, you define via the parameters <ItemName> and <AttachmentName> .

 

 

Functionality:

During the conversion, each supported file attachment is loaded in a separate NotesToPaper report.

There are three ways to define this report for file attachments:

 

Using the default report layouts (usable directly without adjustments)

Loading report definition from a database

Loading report definition from a file system

 

For that the following options are used:

NTPOPTION_ATTACHMENT_REPORTNAME        
NTPOPTION_ATTACHMENT_DBNAME        
NTPOPTION_ATTACHMENT_SERVERNAME

The transfer is done via the function NTPSetOptionString and described in the chapter NTPSetOptionString(Attachments).

 

A short explanation you should note when creating your own report template:

 

Report settings:

Create a report layout with type "label" and an optional name.

Then create a field (Field name="ATTACHMENT_FILENAME" with field type=Text).

 

Layout settings:

Create a PDF object.

 

Please note: The property "Data source->Formula = ATTACHMENT_FILENAME"

 

 

Declaration for LotusScript

Declare Function NTPAddAttachment Lib LibName ( ByVal ReportID As Long,_

ByVal ServerName As Unicode String, ByVal DatabaseName As Unicode String,_

ByVal UNID As Unicode String, ByVal ItemName As Unicode String,_

ByVal AttachmentName As Unicode String ) As Long

 

 

Parameter

 

<ReportHandle> (LONG)

Report handle, returned by calling NTPInit or NTPInitFromDatabase.

 

ServerName> (UNICODE STRING)

This is the server name, where the database may be found, that contains the rich text field with the attachment. If this is a local database (from the perspective of the client or the server), then please enter "" as the value.

 

<DatabaseName> (UNICODE STRING)

This is the database name, that contains the rich text field with the attachment. Please keep in mind that under certain circumstances this name must also include a path if the database is found in a subdirectory of the Notes data directory. The path may however not be an absolute path ("C:\Notes\Data\Test.nsf") but always only be described as a path relative to the data directory of the client or the server ("NotesToPaper\Test.nsf").

 

<UNID> (UNICODE STRING)

This is the "Universal Document ID" of the rich text field.

 

<ItemName> (UNICODE STRING)

This is the name of the rich text field with the attachment that is to be added to the PDF file. If all attachments of a document are to be converted, no matter which field the attachment is saved in, then pass "" here.

 

<AttachmentName> (UNICODE STRING)

If you wish to pass a certain attachment from the document, then place the attachments name here (e.g. "Bullshark.jpg"). If you pass "" as a value, then all attachments are used that can be found in the field <ItemName>. If you want to pass more than one attachment, separate the different names with a semicolon (e.g. "Bullshark.jpg;shark.jpg").

 

 

Return value

 

<ErrorCode> (LONG)

Number of the error encountered (0 = no error)