InputObject Method |
[Top] [Chapter] [Previous] [Next] |
Applies to 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.
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 (CParam=width, IParam = margin offset) }
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);
This code inserts a blue thick line
IWPMemo Memo = wpdllInt1.Memo; IWPTextCursor Cursor = Memo.TextCursor; Cursor.InputObject(13, "", "", 0); IWPTextObj obj = Memo.CurrObj; if (obj != null) { obj.SetProp(34, "blue"); // Set color value obj.SetProp(32, "-760"); // margin offset (outside of margins) obj.Height = 70; }
|