InputObject Method

[Top]  [Chapter]  [Previous]  [Next]

Applies to

IWPTextCursor

Declaration

int InputObject(TextObjTypes ObjType, string Name, string Command, int Mode)

Description

Creates different object kinds at cursor position. It can be used to create a single object and an object pair.

 

Note: If you need to create a "text object" you can also use InputFieldObject, for mail merge fields use InputField.

 

Parameters

ObjType

TextObjTypes:

0=(default, will create "text object")  

1=merge field,

2=hyperlink,

3=bookmark,

7=text object,

8=page reference,

11=footnote,

12=image or text box and

13 for horizontal lines.

Name

The name of the new object.

This can be the name of a page reference, bookmark or mail-merge field.

"Text objects" can use the following predefined names:

'PAGE', 'NEXTPAGE', 'PRIORPAGE', 'NUMPAGES', 'DATE', 'TIME' and 'SECTIONPAGES'. You can use other names but then have to use the event OnTextObjectGetText to provide the text which should be actually displayed.

Command

The command parameter of the new object.

Hyperlinks use this parameter as url.

Mode

If bit 1 is set an object pair will be created. The cursor will be placed within both objects.

Bit 2 activates the "editable" mode used for form fields. This must be combined with ObjType=1

Returns

0 if not successful. Otherwise the interface CurrObj can be used to change object properties.

Enum TextObjTypes:

 

Public Enum TextObjTypes

{

   wpobjCustom, // undefined

    // This objects are usually used pairwise

    wpobjMergeField, // Name=fieldname

    wpobjHyperlink, // Name=Title, Command = url

    wpobjBookmark, // Name=bookmark name

    wpobjTextProtection, // reserved

    wpobjSPANStyle, // Special texts styles 

    wpobjCode, // reserved

    // This objects are usually used singular

    wpobjTextObject, // A Text Object field (one char Text, such As PAGE), Command=Mask)

    wpobjReference, // A Text Object field (Name=Bookmark, Command=Default Text

    wpobjPageSize, // reserved

    wpobjPageProps, // reserved

    wpobjFootnote, // Only used with premium license. Name = name of text layer (RTFDataBlock)

    wpobjImage, // an image

    wpobjHorizontalLine // a line

}

 

Example:

 

This code inserts page numbering objects:

 

     IWPTextCursor TextCursor;

     TextCursor = WpdllInt1.Memo.TextCursor;

     TextCursor.InputObject(TextObjTypes.wpobjTextObject, "PAGE", "", 0);

     TextCursor.InputText("/");

     TextCursor.InputObject(TextObjTypes.wpobjTextObject, "NUMPAGES", "", 0);


[idh_iwptextcursor_inputobject.htm]    Copyright © 2007 by WPCubed GmbH