This document describes technologies are available in Internet Explorer 5. An earlier version of the DHTML Editing Component that is compatible with Internet Explorer 4.01 is available as an SDK that you can download from here.
Microsoft Corporation
Updated June 11, 1999
The DHTML Editing control supports a variety of commands that can be executed against the contents of the current document to edit it. These include commands to format the text; cut and paste; manage tables, links, and graphics; and more.
The commands are executed by calling the ExecCommand method and passing it a command ID (a constant representing a numeric command value).
You can pass the same command IDs to the QueryStatus method to determine whether the command is valid for the current state of the document. For example, you can determine whether the DECMD_BOLD command (to bold text) is currently supported. Based on the result returned by the QueryStatus method, you can conditionally execute the command.
You can also use the results returned by the QueryStatus method to update your application's user interface. For example, you can call QueryStatus to test the DECMD_BOLD command, and if the return value indicates that the command is not currently supported, you can disable a toolbar button used to apply bold formatting.
Note Command ID constants are defined in include files. For details about getting the correct include file for the language you are using, see Requirements.
This section documents the command IDs supported for both the QueryStatus and ExecCommand methods. The lists below arrange the commands into groups according to their major function.
General Editing Commands
DECMD_COPY, DECMD_CUT, DECMD_DELETE, DECMD_FINDTEXT, DECMD_PASTE, DECMD_PROPERTIES, DECMD_REDO, DECMD_SELECTALL, DECMD_UNDO
Formatting Commands
DECMD_BOLD, DECMD_FONT, DECMD_GETBACKCOLOR, DECMD_GETBLOCKFMT, DECMD_GETBLOCKFMTNAMES, DECMD_GETFONTNAME, DECMD_GETFONTSIZE, DECMD_GETFORECOLOR, DECMD_INDENT, DECMD_ITALIC, DECMD_JUSTIFYCENTER, DECMD_JUSTIFYLEFT, DECMD_JUSTIFYRIGHT, DECMD_ORDERLIST, DECMD_OUTDENT, DECMD_REMOVEFORMAT, DECMD_SETBACKCOLOR, DECMD_SETBLOCKFMT, DECMD_SETFONTNAME, DECMD_SETFONTSIZE, DECMD_SETFORECOLOR, DECMD_UNDERLINE, DECMD_UNORDERLIST
Hyperlink/Image Commands
DECMD_HYPERLINK, DECMD_IMAGE, DECMD_UNLIN
Table Commands
DECMD_DELETECELLS, DECMD_DELETECOLS, DECMD_DELETEROWS, DECMD_INSERTCELL, DECMD_INSERTCOL, DECMD_INSERTROW, DECMD_INSERTTABLE, DECMD_MERGECELLS, DECMD_SPLITCELL
Absolute Positioning Commands
DECMD_BRING_ABOVE_TEXT, DECMD_BRING_FORWARD, DECMD_BRING_TO_FRONT, DECMD_LOCK_ELEMENT, DECMD_MAKE_ABSOLUTE, DECMD_SEND_BACKWARD, DECMD_SEND_BELOW_TEXT, DECMD_SEND_TO_BACK
Note For details about absolute positioning, see Working with Absolutely Positioned Elements.
Description
Toggles the bold state of the selected text.
Syntax
retVal = object. QueryStatus( DECMD_BOLD )object. ExecCommand DECMD_BOLD
Part | Description |
object | The DHTML Editing control |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Description |
DECMDF_DISABLED (1) | The selection is an element (such as a control or table) that does not support bold formatting. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selection is not bold, or includes both bold and non-bold elements. |
DECMDF_LATCHED (7) | The selection is already bold. |
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command.
If nothing is selected but the insertion point is within a word, this command treats the current word as the selection.When passed with the ExecCommand method, this command places <STRONG> and </STRONG> tags around the selection or at the insertion point. If the selection is already formatted bold, the <STRONG> and </STRONG> tags are removed. If the selection is within a larger string of bold text, the command inserts </STRONG> and <STRONG> tags around the selection, effectively turning bold off for the selection.
Tip To allow users to select character formatting attributes for the selection, display the Font dialog box using the DECMD_FONT command.
Description
Moves an absolutely positioned element in front of the 1-D HTML stream by giving it a positive z-index.
Syntax
retVal = object. QueryStatus( DECMD_BRING_ABOVE_TEXT )object. ExecCommand DECMD_BRING_ABOVE_TEXT
Part | Description |
object | The DHTML Editing control |
Return Value
One of the following values is returned when you use this command ID by the QueryStatus method:
Setting | Description |
DECMDF_DISABLED (1) | The element is not absolutely positioned. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selected element can be repositioned. |
Remarks
This command is supported for absolutely positioned elements (those that have been positioned using DECMD_MAKE_ABSOLUTE). Use the QueryStatus method to determine whether the selected element can be moved in z-order.
When passed with the ExecCommand method, this command makes the element's Z-ORDER style attribute positive, moving it above the 1-D stream.
Note For details about absolute positioning, see Working with Absolutely Positioned Elements.
Description
Moves an absolutely positioned element one z-order layer toward the front of the document or container, adjusting the z-order of other elements in the same container.
Syntax
retVal = object. QueryStatus( DECMD_BRING_FORWARD )object. ExecCommand DECMD_BRING_FORWARD
Part | Description |
object | The DHTML Editing control |
Return values
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Description |
DECMDF_DISABLED (1) | The element is not absolutely positioned. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selected element can be repositioned. |
Remarks
This command is supported for absolutely positioned elements (those that have been positioned using DECMD_MAKE_ABSOLUTE). Use the QueryStatus method to determine whether the selected element can be moved in z-order.
When passed with the ExecCommand method, this command increments the element's Z-ORDER style attribute by one, readjusting the Z-ORDER style attribute of other elements in the same container as necessary.
Note For details about absolute positioning, see Working with Absolutely Positioned Elements.
Description
Moves an absolutely positioned element to the front of the document or container.
Syntax
retVal = object. QueryStatus( DECMD_BRING_TO_FRONT )object. ExecCommand DECMD_BRING_TO_FRONT
Part | Description |
object | The DHTML Editing control |
Return values
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Description |
DECMDF_DISABLED (1) | The element is not absolutely positioned. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selected element can be repositioned. |
Remarks
This command is supported for absolutely positioned elements (those that have been positioned using DECMD_MAKE_ABSOLUTE). Use the QueryStatus method to determine whether the selected element can be moved in z-order.
When passed with the ExecCommand method, this command sets the element's Z-ORDER style attribute to the highest of all the absolutely positioned elements on the page or in its container, readjusting the Z-ORDER style attribute of other elements as necessary.
Note For details about absolute positioning, see Working with Absolutely Positioned Elements.
Description
Copies the selection to the Windows Clipboard.
Syntax
retVal = object. QueryStatus( DECMD_COPY )object. ExecCommand DECMD_COPY
Part | Description |
object | The DHTML Editing control |
Return values
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Description |
DECMDF_DISABLED (1) | There is no selection or the selection consists of text in a password control. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selection can be copied. |
Remarks
When passed with the ExecCommand method, this command places two forms of the selected text on the Windows Clipboard. One form (CF_HTML) includes all HTML formatting instructions. The other (CF_TEXT) contains only the plain text, with all HTML tags removed.
Description
Copies the selection to the Windows Clipboard, then deletes it from the document.
Syntax
retVal = object. QueryStatus( DECMD_CUT )object. ExecCommand DECMD_CUT
Part | Description |
object | The DHTML Editing control |
Return values
One of the following values is returned when you use this command ID with the QueryStatus method:
Settingt | Description |
DECMDF_DISABLED (1) | There is no selection or the selection consists of text in a password control. |
DECMDF_ENABLED (3) | The selection can be cut. |
Remarks
When passed with the ExecCommand method, this command places two forms of the selected text on the Windows Clipboard. One form (CF_HTML) includes all HTML formatting instructions. The other (CF_TEXT) contains only the plain text, with all HTML tags removed.
Description
Deletes the selection without placing it on the Windows Clipboard.
Syntax
retVal = object. QueryStatus( DECMD_DELETE )object. ExecCommand DECMD_DELETE
Part | Description |
object | The DHTML Editing control |
Return value
When you use this command ID with the QueryStatus method, it always returns DECMDF_ENABLED (3).
Remarks
If no element is selected, passing this command with the ExecCommand method deletes the element or character immediately to the right of the insertion point.
Description
Deletes the selected cells from a table.
Syntax
retVal = object. QueryStatus( DECMD_DELETECELLS )object.ExecCommand DECMD_DELETECELLS
Part | Description |
object | The DHTML Editing control |
Return values
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Description |
DECMDF_DISABLED (1) | The selection or insertion point is not inside a table, or the selection includes elements in more than one row. This value is also returned if the insertion point is within the table caption or if the entire table is selected. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selection or insertion point is within cells in a table. |
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command. Use the ExecCommand method to remove a cell.
The selection or insertion point must be within one or more cells in a table. If nothing is selected, the current cell is the one in which the insertion point appears, and the one that will be deleted. If the selection includes more than one cell, all cells containing any portion of a selection will be deleted -- it is not necessary that the entire contents of a cell be selected.The overall table width is not altered when deleting a cell. Instead, the cell widths are adjusted to accommodate the deleted cell.
Description
Deletes all the columns in a table containing selected text.
Syntax
retVal = object. QueryStatus( DECMD_DELETECOLS )object.ExecCommand DECMD_DELETECOLS
Part | Description |
object | The DHTML Editing control |
Return values
One of the following values is returned when you use this command ID with the QueryStatus method:
Part | Description |
DECMDF_DISABLED (1) | The selection or insertion point is not inside a table. This value is also returned if the insertion point is within the table caption, if the entire table is selected, or if the selection spans more than one row. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selection or insertion point is within a column in a table. |
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command. Use the ExecCommand method to remove a column.
The selection or insertion point must be within one or more columns in a table. If nothing is selected, the current column is the one in which the insertion point appears, and the one that will be deleted. If the selection includes more than one column, all columns containing any portion of a selection will be deleted -- it is not necessary that the entire contents of a column be selected.The overall table width is not altered when deleting a column. Instead, the column widths are adjusted to accommodate the deleted column.
Description
Deletes all rows containing selected elements.
Syntax
retVal = object. QueryStatus( DECMD_DELETEROWS )object.ExecCommand DECMD_DELETEROWS
Part | Description |
object | The DHTML Editing control |
Return values
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Description |
DECMDF_DISABLED (1) | The selection or insertion point is not inside a table. This value is returned if the insertion point is within the table caption or if the entire table is selected. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selection or insertion point is within a row in a table. |
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command. Use the ExecCommand method to remove a row.
The selection or insertion point must be within one or more cells in a table, but within a single row. If nothing is selected, the current row is the one in which the insertion point appears. If the selection includes more than one row, all rows containing any portion of a selection will be deleted -- it is not necessary that the entire contents of a row be selected.When the row is deleted, the overall table height is reduced by the height of the deleted row.
Description
Displays the Find dialog box to allow users to specify text to search for in the current document.
Syntax
retVal = object. QueryStatus( DECMD_FINDTEXT )object.ExecCommand DECMD_FINDTEXT
Part | Description |
object | The DHTML Editing control |
Return values
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Description |
DECMDF_DISABLED (1) | The selection or insertion point is in a control or other element that does not support searching. This value is also returned if the current document is an HTML dialog box. |
DECMDF_ENABLED (3) | The Find dialog box can be displayed. |
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command.When passed with the ExecCommand method, this command always displays the Find dialog; there is no option not to display a user interface. The command searches the DHTML text of the entire current document, even if some text is selected. It ignores textual elements of controls, such as captions, labels, or parameter values.
Description
Displays the Font dialog box and applies the user's choices to the selection.
Syntax
retVal = object. QueryStatus( DECMD_FONT )object.ExecCommand DECMD_FONT
Part | Description |
object | The DHTML Editing control |
Return values
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Description |
DECMDF_DISABLED (1) | The selection includes an element, such as a table, that does not support the <FONT> element. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selection supports the <FONT> element. |
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command.When passed with the ExecCommand method, this command always displays the Font dialog; there is no option not to display a user interface. Executing this command adds a <FONT> element around the selection if one is not already there. Within the <FONT> element, the command sets the COLOR, FACE, and SIZE attributes with information taken from the dialog box. The command will also add <STRONG>, <EM>, or <U> tags around the selection as appropriate.
Note Although the Font dialog box displays font sizes in points, the command translates these into HTML font sizes (in the range 1 to 7).
If nothing is selected but the insertion point is within a word, this command treats the current word as the selection.To set font attributes without displaying a dialog box, use the following commands:
To get the current font attributes for the selection, execute the following commands:
Description
Gets the background color of the text in the selection.
Syntax
retVal = object. QueryStatus( DECMD_GETBACKCOLOR )retVal = object. ExecCommand DECMD_GETBACKCOLOR
Part | Description |
object | The DHTML Editing control |
Return values
One of the following values is returned when you use this command ID with the QueryStatus method:
Stting | Description |
DECMDF_DISABLED (1) | The selection is an element that does not support a BACKCOLOR attribute. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selection contains text. |
DECMDF_NINCHED (11) | There is no selection, or the selection does not have a BACKCOLOR attribute set. |
When you use this command ID with the ExecCommand method, the return value is a background color. This string is an RGB color value such as #FF0000 for red.If the selection includes a mixture of text with a BACKCOLOR attribute and any other type of element -- for example, a control or text without a BACKCOLOR attribute -- the method returns the empty string ("") as the return value.
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command. Use the ExecCommand method to return the current background color.
Description
Returns the HTML paragraph format of the selection.
Syntax
retVal = object. QueryStatus( DECMD_GETBLOCKFMT )retVal = object. ExecCommand DECMD_GETBLOCKFMT
Part | Description |
object | The DHTML Editing control |
Return values
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Description |
DECMDF_DISABLED (1) | The selection includes an element, such as a table or control, that does not support HTML formats. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selection supports formats. |
When you use this command ID with the ExecCommand method, the return value is a string containing the name of an HTML paragraph format, such as "Normal" or "Heading 1". If the text has not been formatted with a block format, the command returns "Normal" If the command cannot return a single format (for example, if the selection contains text from paragraphs with different formats), the command returns the empty string ("").
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command. Use the ExecCommand method to return the current format.This command is only supported if the selection contains text. The command returns the format information for the paragraph in which the insertion point appears; it is not necessary to select the entire paragraph.
Note To get a list of valid HTML paragraph format names, execute the DECMD_GETBLOCKFMTNAMES command.
Description
Gets a list of valid paragraph format names for use with the DECMD_SETBLOCKFMT command.
Syntax
retVal = object. QueryStatus( DECMD_GETBLOCKFMTNAMES)object. ExecCommand DECMD_GETBLOCKFMTNAMES, OLECMDEXECOPT_DODEFAULT, blockFmtParam
Part | Description |
object | The DHTML Editing control |
OLECMDEXECOPT_DODEFAULT | A constant value specifying that the command should perform its default user interface behavior (in this case, do not display a dialog box.) This parameter is passed primarily as a placeholder so the blockFmtParam parameter is interpreted correctly. |
blockFmtParam | A DEGetBlockFmtNamesParam object created before this command is executed. The command loads the object's Names property with an array of strings containing the list of currently supported, localized paragraph format names.
This parameter is not optional; you must pass an object of this type to the DECMD_GETBLOCKFMTNAMES command. For more information, see "Remarks" below. |
Return value
QueryStatus always returns DECMDF_DISABLED (1) for this command. However, this command is valid at any time.
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command. Use the ExecCommand method to return a list of formats.
The blockFmtParam parameter requires an object that must be created before being passed to the DECMD_GETBLOCKFMTNAMES command. The object's progID is:
DEGetBlockFmtNamesParam.DEGetBlockFmtNamesParam
Its classID is:
8d91090e-b955-11d1-adc5-006008a5848c
For example, the following Visual Basic® code creates a DEGetBlockFmtNamesParam object, passes it to a DECMD_GETBLOCKFMTNAMES command, and populates a combo box called cmbBlockFmt with the results returned by the command in the object.
' The following appears in the Declarations. Optional, but provides ' statement completion for the object. Dim f as DEGetBlockFmtNamesParam ' [...] Private Sub DisplayFormats() If cmbBlockFmt.ListCount < 1 Then Set f=CreateObject("DEGetBlockFmtNamesParam.DEGetBlockFmtNamesParam ") DEdit1.ExecCommand(DECMD_GETBLOCKFMTNAMES, _ OLECMDEXECOPT_DODEFAULT,f) For Each fmtName in f.Names cmbBlockFmt.AddItem(fmtName) Next End If End Sub
If you are working in a scripting language, you can create a DEGetBlockFmtNamesParam object in code using the CreateObject function. Alternatively, you can use an <OBJECT> element, which gives the object global scope. If you use an <OBJECT> element, you must pass the parameter object's Class ID. Typically, you would hide the object. The following example shows how you can create a GetBlockFmtNamesParam using an <OBJECT> element and how you can then call the DECMD_GETBLOCKFMTNAMES command from Visual Basic Scripting Edition (VBScript) to display a list of formats in a message box:
<!-- the following creates a GetBlockFmtNamesParam object --> <object CLASSID="clsid:8D91090E-B955-11D1-ADC5-006008A5848C" ID="fmtBlock" VIEWASTEXT> </object> <!-- the following line includes a VBScript file that defines the command constants (for example, DECMD_GETBLOCKFMTNAMES=5012). The path in the SRC attribute should be corrected as necessary. --> <SCRIPT LANGUAGE="VBScript" SRC="\VBEdit\INC\DHTMLEd.vbs"></SCRIPT> <SCRIPT LANGUAGE="VBSCript"> Function btn1_onclick() on error resume next de1.ExecCommand DECMD_GETBLOCKFMTNAMES, OLECMDEXECOPT_DODEFAULT, _ fmtBlock s = "" For Each ft in fmtBlock.Names s = s & chr(13) & ft Next MsgBox s End Function </SCRIPT>
Note For details about getting the DHTMLEd.vbs file, see Requirements.
Description
Returns the font face of the selected text.
Syntax
retVal = object. QueryStatus( DECMD_GETFONTNAME)retVal = object. ExecCommand DECMD_GETFONTNAME
Part | Description |
object | The DHTML Editing control |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Description |
DECMDF_DISABLED (1) | The selection is an element that does not support font information, such as a table, control, or image. In some instances, such as when the selection is a control, QueryStatus returns this value even though the command can be executed. In other cases, such as if a table is selected, calling the ExecCommand method in this state results in an error. |
DECMDF_ENABLED (3) | The selection contains text. This value is also returned if the selection contains a mix of elements that do and do not support the <FONT> element. |
DECMDF_NINCHED (11) | There is no selection or if the selection does not have a COLOR attribute set. |
When you use this command ID with the ExecCommand method, the return value is the font face name returned by the command. If the command cannot return a single font face name (for example, if the selection contains text with different font faces), the command returns the empty string ("").
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command. Use the ExecCommand method to return the current font name.
This command is only supported if the selection contains text. It returns the font face for the selection as established by a <FONT> element or by the FONT-FAMILY style attribute. If the text has not been formatted with a specific font face, the command returns the default font face name for the selected element.
Tip The font face can be set with the DECMD_SETFONTNAME or DECMD_FONT commands.
Description
Returns the HTML font size of the selected text.
Syntax
retVal = object. QueryStatus( DECMD_GETFONTSIZE)retVal = object. ExecCommand DECMD_GETFONTSIZE
Part | Description |
object | The DHTML Editing control |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Description |
DECMDF_DISABLED (1) | The selection is an element that does not support font information, such as a table, control, or image. In some instances, such as when the selection is a control, QueryStatus returns this value even though the command can be executed. In other cases, such as if a table is selected, calling the ExecCommand method in this state results in an error. |
DECMDF_ENABLED (3) | The selection contains text. |
DECMDF_NINCHED (11) | The selection contains text formatting with more than one font size. |
When you use this command ID with the ExecCommand method, it returns an HTML font size, 1-7. If the command cannot return a single font size (for example, if the selection contains text with different font sizes), the command returns the empty string ("").
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command. Use the ExecCommand method to return the current font size.
This command is only supported if the selection contains text. It returns the font size for the selection as established by the SIZE attribute of the <FONT> element. (It does not return an absolute point size.) If the text has not been formatted with a specific HTML font size, the command returns the default font size for the selected element.
Tip The font size can be set with the DECMD_SETFONTSIZE or DECMD_FONT commands.
Description
Gets the foreground color of the text in the selection.
Syntax
retVal = object. QueryStatus( DECMD_GETFORECOLOR)retval = object. ExecCommand DECMD_GETFORECOLOR
Part | Description |
object | The DHTML Editing control |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Description |
DECMDF_DISABLED (1) | The selection is an element that does not support a COLOR attribute. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selection contains text. |
DECMDF_NINCHED (11) | There is no selection, or the selection does not have a COLOR attribute set. |
When you use this command ID with the ExecCommand method, the value returned is a foreground color. This string is an RGB color value such as #FF0000 for red.If the selection includes a mixture of text with a COLOR attribute and any other type of element--for example, a control or text without a COLOR attribute--the command returns the empty string ("") as the return value.
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command. Use the ExecCommand method to return the current color.
This command returns the value of the COLOR attribute in the <FONT> element that applies to the selection. If no <FONT> element applies, the command returns the default color for the selection.
Tip The font color can be set with the DECMD_SETFORECOLOR or DECMD_FONT commands.
Description
Creates a link by inserting <A> and </A> tags around the selection or at the insertion point.
Syntax
retVal = object. QueryStatus( DECMD_HYPERLINK)object. ExecCommand DECMD_HYPERLINK [, cmdExecOpt] [, url]
Part | Description |
object | The DHTML Editing control |
cmdExecOpt | Optional parameter determines if the command will display a user interface. Possible values are:
|
url | If cmdExecOpt contains OLECMDEXECOPT_DONTPROMPTUSER, contains the target URL for the link. |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The selection spans more than one cell in a table, includes a mixture of elements inside and outside a table, or includes a design-time control. If you call the ExecCommand method in this state, an error can occur.
Note The value DECMDF_DISABLED is also returned if no text is selected but the insertion point is in a paragraph. This is not an error condition; in that state, the user can insert an <A> tag to create a bookmark. |
DECMDF_ENABLED (3) | A link can be inserted at the current location or around the selected elements. |
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command.
When passed with the ExecCommand method, this command inserts an <A> tag around the selection. Unless executed with the OLECMDEXECOPT_DONTPROMPTUSER option, the DECMD_HYPERLINK command displays the Hyperlink dialog box, which prompts the user for the name of the target file and for the protocol.If text or an image is selected, the command converts it into a link. If the selection is within an existing <A> tag when this command is executed, the Hyperlink dialog box is displayed to allow the user to modify the HREF attribute.
If no text is selected, the command inserts an <A> tag at the current insertion point, which is useful for creating bookmarks. For bookmarks, the protocol selected in the Hyperlink dialog box should be "(other)".
Description
Inserts a graphic at the current insertion point.
Syntax
retVal = object. QueryStatus( DECMD_IMAGE)object. ExecCommand DECMD_IMAGE [, cmdExecOpt] [, url]
Part | Description |
object | The DHTML Editing control |
cmdExecOpt | Optional parameter determines if the command will display a user interface. Possible values are:
|
url | Path and file name of graphics file to insert as HREF attribute of image. This parameter is used only if cmdExecOpt is set to OLECMDEXECOPT_DONTPROMPTUSER. |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The selection spans more than one cell in a table, includes a mixture of elements inside and outside a table, or includes a design-time control. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | An image can be inserted at the current location. |
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command.
When passed with the ExecCommand method, this command inserts an <IMG> tag at the current location in the document. If text is selected, the <IMG> tag replaces the text.Unless executed with the OLECMDEXECOPT_DONTPROMPTUSER option, the DECMD_IMAGE command displays the Picture dialog box, which prompts the user for the name of the graphics file and for attributes such as alternate text, borders, alignment, and spacing.
If you want to avoid displaying the Picture dialog box, specify the OLECMDEXECOPT_DONTPROMPTUSER option. In the url parameter, pass the path and file name of the image. You cannot specify additional attributes this way.
Description
Indents the selected paragraph.
Syntax
retVal = object. QueryStatus( DECMD_INDENT)object. ExecCommand DECMD_INDENT
Part | Description |
object | The DHTML Editing control |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The selection is an element that cannot be indented, such as a control, image, or table. You can indent the contents of individual table cells. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selection can be indented. |
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command.
When passed with the ExecCommand method, this command affects the entire container containing the insertion point or selection, such as a <P> or <DIV> element. This command adds a <BLOCKQUOTE> element around the container for the selection. The command affects the entire container in which the insertion point or selection occurs, even if a subset of the text is selected.To reverse the effect of indenting a paragraph, execute the DECMD_OUTDENT command.
Description
Inserts a single cell to the left of the current cell in a table.
Syntax
retVal = object. QueryStatus( DECMD_INSERTCELL)object. ExecCommand DECMD_INSERTCELL
Part | Description |
object | The DHTML Editing control |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The selection or insertion point is not inside a table. This value is returned if the insertion point is within the table caption or if the entire table is selected. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selection or insertion point is within one or more cells in a table. |
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command. Use the ExecCommand method to insert a cell.
The selection or insertion point must be within a cell in a table. If nothing is selected, the current cell is the one in which the insertion point appears. If the selection spans more than one cell, the current cell is defined as the one that is leftmost and topmost in the selection.The overall table width is not altered when inserting a cell. Instead, the cell widths are adjusted to accommodate the new cell. When the new cell is inserted, individual cell attributes are copied from the current cell to the new one.
Description
Inserts a new column to the left of the current column in a table.
Syntax
retVal = object. QueryStatus( DECMD_INSERTCOL)object.ExecCommand DECMD_INSERTCOL
Part | Description |
object | The DHTML Editing control |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The selection or insertion point is not inside a column in a table. This value is returned if the insertion point is within the table caption or if the entire table is selected. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selection or insertion point is within one or more cells in table. |
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command. Use the ExecCommand method to insert a column.
The selection or insertion point must be within a column in a table. If nothing is selected, the current column is the one in which the insertion point appears.The overall table width is not altered when inserting a column. Instead, the cell widths are adjusted to accommodate the new column.
The new column will contain the same number of cells as the current column. The individual cell attributes are copied cell for cell from the current column to the new one.
Description
Inserts a new row above the current row in a table.
Syntax
retVal = object. QueryStatus( DECMD_INSERTROW)object.ExecCommand DECMD_INSERTROW
Part | Description |
object | The DHTML Editing control |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The selection or insertion point is not inside a row in a table. This value is returned if the insertion point is within the table caption or if the entire table is selected. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selection or insertion point is within one or more cells in a table |
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command. Use the ExecCommand method to insert a row.
The selection or insertion point must be within a row in a table. If nothing is selected, the current row is the one in which the insertion point appears.The new row will contain the same number of cells as the previous row, with the same COLSPAN attributes, cell attributes, and styles.
Description
Inserts a table.
Syntax
retVal = object. QueryStatus( DECMD_INSERTTABLE)object.ExecCommand DECMD_INSERTTABLE, OLECMDEXECOPT_DODEFAULT, insertTableParam
Part | Description |
object | The DHTML Editing control |
OLECMDEXECOPT_DODEFAULT | A constant value specifying that the command should perform its default user interface behavior (in this case, do not display a dialog box.) This parameter is passed primarily as a placeholder so the insertTableParam parameter is interpreted correctly. |
insertTableParam | A tableParam object created before this command is executed. The object supports the following properties that determine attributes of the new table at the time it is created:
For more information, see "Remarks" below. |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The selection is an element that cannot be replaced with a table, including another table, a control, an image, and so on. |
DECMDF_ENABLED (3) | A table can be inserted at the current insertion point. This value is returned even if there is a selection, and even if the selection includes a control, image, or table, including the whole document. |
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command.
When passed with the ExecCommand method, this command inserts a <TABLE> element with the specified number of <TR> and <TD> elements at the insertion point. If text is selected, the new table replaces the text. Tables can be inserted inside existing tables.The insertTableParam requires an object that must be created and populated before being passed to the command. The object's progID is:
DEInsertTableParam.DEInsertTableParam
Its classID is:
47B0DFC7-B7A3-11D1-ADC5-006008A5848c
For example, in Visual Basic you can create the object and execute the command using code such as the following:
' The following appears in the Declarations. Optional, but provides ' statement completion for the object. Private tParam As DEInsertTableParam ' [...] Private Sub InsertTable() Set tParam = CreateObject("DEInsertTableParam.DEInsertTableParam") tParam.NumRows = 2 tParam.NumCols = 3 tParam.TableAttrs = "50%" tParam.CellAttrs = "" tParam.Caption = "New Table" DEdit1.ExecCommand(DECMD_INSERTTABLE, OLECMDEXECOPT_DODEFAULT, tParam) End Sub
If you are working in a scripting language, you can create table parameter object in code using the CreateObject function. Alternatively, you can use an <OBJECT> element, which gives the object global scope. If you use an <OBJECT> element, you must pass the parameter object's Class ID instead. Typically, you would hide the object. The following example shows how you can create a table parameter object using an <OBJECT> element and how you can then call the DECMD_INSERTTABLE command from VBScript:
<!-- the following creates a table parameter object --> <OBJECT CLASSID="clsid:47B0DFC7-B7A3-11D1-ADC5-006008A5848c" ID="tableparamobj" STYLE="visibility:hidden"> </OBJECT> <!-- the following line includes a VBScript file that defines the command constants (for example, DECMD_INSERTTABLE=5022). The path in the SRC attribute should be corrected as necessary. --> <SCRIPT LANGUAGE="VBScript" SRC="\VBEdit\INC\DHTMLEd.vbs"></SCRIPT> <SCRIPT LANGUAGE="VBScript"> Sub btnInsertTable_onclick() ' DECMD_INSERTTABLE is a constant defined in DHTMLEd.vbs. If you do ' include that file, susbtitute the command number (5022) DHTMLEdit1.ExecCommand DECMD_INSERTTABLE, OLECMDEXECOPT_DONTPROMPTUSER, document.all.tableparamobj End Sub </SCRIPT>
Note Set the parameter values for the table parameter object at run time. Values set at design time using <PARAM> tags will be ignored at run time.
Note For details about getting the DHTMLEd.vbs file, see Requir ements.
Description
Toggles the italic state of the selected text.
Syntax
retVal = object. QueryStatus( DECMD_ITALIC)object.ExecCommand DECMD_ITALIC
Part | Description |
object | The DHTML Editing control |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The selection is an element (such as a control or table) that does not support italics. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selection is not italic, or includes both italics and non-italic elements. |
DECMDF_LATCHED (7) | The selection is already italic. |
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command.
If nothing is selected but the insertion point is within a word, this command treats the current word as the selection.When passed with the ExecCommand method, this command places <EM> and </EM> tags around the selection or at the insertion point. If the selection is already formatted italic, the <EM> and </EM> tags are removed. If the selection is within a larger string of italic text, the command inserts </EM> and <EM> tags around the selection, effectively turning italics off for the selection.
Tip To allow users to select character formatting attributes for the selection, display the Font dialog box using the DECMD_FONT command.
Description
Centers the selected paragraph.
Syntax
retVal = object. QueryStatus( DECMD_JUSTIFYCENTER )object.ExecCommand DECMD_JUSTIFYCENTER
Part | Description |
object | The DHTML Editing control |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The selection is an element that cannot support an ALIGN attribute (such as an HTML or ActiveX® control). |
DECMDF_ENABLED (3) | The selection can be centered. |
DECMDF_LATCHED (7) | The selection or insertion point is in a paragraph is already centered. |
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command.
When passed with the ExecCommand method, this command adds an ALIGN attribute to the container (<P> or <DIV>) for the current text. It cannot be applied to text in a container that does not support the ALIGN attribute, such as text in an HTML control or to an ActiveX control. If necessary (such as for text in a table cell), the command adds a <DIV> element to create a container.
Note Justification can be applied to cells within a table, but not to a table as a whole.
The command affects the entire container in which the insertion point or selection occurs, even if a subset of the text is selected.To return to default alignment after executing the DECMD_JUSTIFYCENTER command, execute the DECMD_JUSTIFYLEFT command.
Description
Left justifies the selected paragraph.
Syntax
retVal = object. QueryStatus( DECMD_JUSTIFYLEFT)object.ExecCommand DECMD_JUSTIFYLEFT
Part | Description |
object | The DHTML Editing control |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The selection is an element that cannot support an ALIGN attribute (such as an HTML or ActiveX control). |
DECMDF_ENABLED (3) | The selection can be left-justified. |
DECMDF_LATCHED (7) | The selection or insertion point is in a paragraph that is already left-justified (has no ALIGN attribute). |
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command.
When passed with the ExecCommand method, this command removes the ALIGN attribute inserted earlier with a DECMD_JUSTIFYRIGHT or DECMD_JUSTIFYCENTER command. It affects the entire container in which the insertion point or selection occurs, even if a subset of the text is selected.
Note Justification can be applied to cells within a table, but not to a table as a whole.
Description
Right justifies the selected paragraph.
Syntax
retVal = object. QueryStatus( DECMD_JUSTIFYRIGHT)object.ExecCommand DECMD_JUSTIFYRIGHT
Part | Description |
object | The DHTML Editing control |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The selection is an element that cannot support an ALIGN attribute (such as an HTML or ActiveX control). |
DECMDF_ENABLED (3) | The selection can be right-justified. |
DECMDF_LATCHED (7) | The selection or insertion point is in a paragraph that is already right-justified |
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command.
When passed with the ExecCommand method, this command adds an ALIGN attribute to the container (<P> or <DIV>) for the current text. It cannot be applied to text in a container that does not support the ALIGN attribute, such as text in an HTML control or to an ActiveX control. If necessary (such as for text in a table cell), the command adds a <DIV> element to create a container.
Note Justification can be applied to cells within a table, but not to a table as a whole.
The command affects the entire container in which the insertion point or selection occurs, even if a subset of the text is selected.To return to default alignment after executing the DECMD_JUSTIFYRIGHT command, execute the DECMD_JUSTIFYLEFT command.
Description
Toggles the lock state of an absolutely positioned element, which prevents the element from being moved or resized at design time.
Syntax
retVal = object. QueryStatus( DECMD_LOCK_ELEMENT )object.ExecCommand DECMD_LOCK_ELEMENT
Part | Description |
object | The DHTML Editing control |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The element is not absolutely positioned. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selected element can be repositioned. |
DECMDF_LATCHED (7) | The selected element is already locked. |
Remarks
Use the QueryStatus method to determine whether the selected element can be moved in z-order.
When passed with the ExecCommand method, this command adds the DESIGN_TIME_LOCK style attribute to the element and sets it to True.
Note For details about absolute positioning, see Working with Absolutely Positioned Elements.
Description
Toggles the selected element between static positioning and absolute positioning.
Syntax
retVal = object. QueryStatus( DECMD_MAKE_ABSOLUTE )object.ExecCommand DECMD_MAKE_ABSOLUTE
Part | Description |
object | The DHTML Editing control |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | A portion of the selection includes an element, such as text outside a division, that cannot be absolutely positioned. This value is also returned if the selection includes only part of an element (such as a <SPAN> element) that can be positioned absolutely. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selection completely contains an element that can be absolutely positioned. |
DECMDF_LATCHED (7) | The selection is already absolutely positioned. |
Remarks
This command is supported only for elements that can support a setting of "absolute" for the POSITION style attribute. In general, this includes containers such as <DIV>, <SPAN>, <MARQUEE>, and <TABLE> elements as well as images, HTML controls (buttons, text areas), objects, applets, and horizontal rules. Text outside of container elements cannot be positioned absolutely. Design-time controls (DTCs) cannot be positioned absolutely.
Note For details about absolute positioning, see Working with Absolutely Positioned Elements.
Use the QueryStatus method to determine whether the selected element can be positioned absolutely.When passed with the ExecCommand method, this command acts on the selection. The command adds a STYLE attribute to the selected element and sets the following style attributes: POSITION (which is set to "absolute"), TOP, and Z-INDEX. If the selection is already part of an ordered list, POSITION and Z-INDEX attributes are removed.
Description
Merges two or more table cells into a single cell.
Syntax
retVal = object. QueryStatus( DECMD_MERGECELLS )object.ExecCommand DECMD_MERGECELLS
Part | Description |
object | The DHTML Editing control |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The selection includes elements outside a table or does not include at least two table cells. If you call the ExecCommand method in this state, an error occurs.
Note This value is returned if only one cell is selected. In that case, executing the command does not accomplish anything, but no error occurs. |
DECMDF_ENABLED (3) | The selection includes two or more table cells and no text outside the table. |
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command. Use the ExecCommand method to merge cells.
The selection must include two or more table cells. All cells containing any portion of a selection will be merged--it is not necessary that the entire contents of a cell be selected.When cells are merged, their contents are concatenated together in the remaining cell. The merged cells assume the attributes of the cell that was leftmost and topmost in the selection. The overall table width is not altered when cells are merged. Instead, the cell widths are adjusted.
Description
Turns the selection into a numbered (ordered) list or removes selected list items from a numbered list.
Syntax
retVal = object. QueryStatus( DECMD_ORDERLIST )object.ExecCommand DECMD_ORDERLIST
Part | Description |
object | The DHTML Editing control |
Return values
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Description |
DECMDF_DISABLED (1) | The selection includes an element, such as a table, that cannot be put into a list. (The contents of individual cells can be put into a list.) If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selection can be turned into a list. |
DECMDF_LATCHED (7) | The selection is already part of a list. |
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command.
When passed with the ExecCommand method, this command acts on the selection, or if nothing is selected, on the current paragraph only. The command surrounds the affected paragraphs with <OL> and </OL> tags, and places <LI> and </LI> around individual paragraphs. If the selection is already part of an ordered list, the tags are removed and surrounding text is fixed up appropriately.
Description
Decreases the indentation of the selected paragraph.
Syntax
retVal = object. QueryStatus( DECMD_OUTDENT )object.ExecCommand DECMD_OUTDENT
Part | Description |
object | The DHTML Editing control |
Return values
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The selection is an element that does not support a <BLOCKQUOTE> element, such as a control, image, or table. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selection can be outdented. This value is returned for a selection that supports <BLOCKQUOTE> even if it is not indented. |
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command.
When passed with the ExecCommand method, this command undoes the effect of the DECMD_INDENT command by removing the <BLOCKQUOTE> element from around the current paragraph or division. The command affects the entire container in which the insertion point or selection occurs, even if a subset of the text is selected.
Description
Pastes the contents of the Windows Clipboard at the insertion point or over the selection.
Syntax
retVal = object. QueryStatus( DECMD_PASTE )object.ExecCommand DECMD_PASTE
Part | Description |
object | The DHTML Editing control |
Return values
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | There is no text on the Windows Clipboard, the selection spans more than one cell in a table, or a design-time control is selected. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The contents of the Clipboard can be pasted at the current location. |
Remarks
When passed with the ExecCommand method, this command copies text from the Windows Clipboard to the current location.
HTML text can be on the Clipboard in two forms. One form (CF_HTML) includes all HTML formatting instructions. The other (CF_TEXT) contains only the plain text, with all HTML tags removed. When you paste from the Clipboard into the DHTML Editing control, the control attempts to paste the version of the text that includes HTML formatting.
Description
Displays a Properties window for the selected element if supported by the host application.
Syntax
retVal = object. QueryStatus( DECMD_PROPERTIES )object.ExecCommand DECMD_PROPERTIES
Part | Description |
object | The DHTML Editing control |
Return values
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The selected element does not support a property page or if more than one element is selected. This value is also returned if the host application does not allow property pages to be displayed. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selected element supports a property page. |
Remarks
Certain elements that can appear on a document--such as ActiveX controls--include support for displaying and editing properties in a Properties window. If so, passing this command with the ExecCommand method displays the Properties window for that element.
Description
Re-executes the command most recently reversed with the DECMD_UNDO command.
Syntax
retVal = object. QueryStatus( DECMD_REDO )object.ExecCommand DECMD_REDO
Part | Description |
object | The DHTML Editing control |
Return values
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | There is no edit command to redo. |
DECMDF_ENABLED (3) | A command is available to be redone. |
Remarks
Use the QueryStatus method to determine whether there are commands that can be redone. Use the ExecCommand method to redo a command.
This command can be called as many times as there are commands to be undone. Commands can only be re-executed in the order they were undone--you cannot selectively redo a specific command. After a command has been redone, it is removed from the list of commands (the redo buffer) that can be redone.
Description
Removes all formatting tags from the selection.
Syntax
retVal = object. QueryStatus( DECMD_REMOVEFORMAT )object.ExecCommand DECMD_REMOVEFORMAT
Part | Description |
object | The DHTML Editing control |
Return values
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The selected element does not support elements that can be removed (such as controls). |
DECMDF_ENABLED (3) | The selection supports removable elements. QueryStatus returns this value even if there are no tags to remove. |
Remarks
When passed with the ExecCommand method, this command will remove any of the following elements contained in the selection:
ACRONYM | B | BDO | BIG |
BLINK | BLOCKQUOTE | CITE | CODE |
DEL | DFN | EM | FONT |
I | INS | KBD | NOBR |
Q | S | SAMP | SMALL |
STRIKE | STRONG | SUB | SUP |
TT | U | VAR |
Description
Selects everything in the body of the document.
Syntax
retVal = object. QueryStatus( DECMD_SELECTALL )object.ExecCommand DECMD_SELECTALL
Part | Description |
object | The DHTML Editing control |
Return values
QueryStatus always returns DECMDF_ENABLED (3) for this command.
See Also
ExecCommand method
Description
Moves an absolutely positioned element one z-order layer toward the back of the document or container, adjusting the z-order of other elements in the same container.
Syntax
retVal = object. QueryStatus( DECMD_SEND_BACKWARD )object.ExecCommand DECMD_SEND_BACKWARD
Part | Description |
object | The DHTML Editing control |
Return values
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The element is not absolutely positioned. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selected element can be repositioned. |
Remarks
This command is supported for absolutely positioned elements (those that have been positioned using DECMD_MAKE_ABSOLUTE). Use the QueryStatus method to determine whether the selected element can be moved in z-order.
When passed with the ExecCommand method, this command decrements the element's Z-ORDER style attribute by one, readjusting the Z-ORDER attribute of other elements in the same container as necessary.
Note For details about absolute positioning, see Working with Absolutely Positioned Elements.
Description
Moves an absolutely positioned element behind the 1-D HTML stream by giving it a negative z-index.
Syntax
retVal = object. QueryStatus( DECMD_SEND_BELOW_TEXT )object.ExecCommand DECMD_SEND_BELOW_TEXT
Part | Description |
object | The DHTML Editing control |
Return values
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The element is not absolutely positioned. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selected element can be repositioned. |
Remarks
This command is supported for absolutely positioned elements (those that have been positioned using DECMD_MAKE_ABSOLUTE). Use the QueryStatus method to determine whether the selected element can be moved in z-order.
When passed with the ExecCommand method, this command assigns a negative value to the element's Z-ORDER style attribute, readjusting the Z-ORDER style attribute of other elements as necessary. Because the 1-D HTML stream is considered to have a z-order value of 0, giving an element a negative z-order value places it behind the 1-D stream.
Note For details about absolute positioning, see Working with Absolutely Positioned Elements.
Description
Moves an absolutely positioned element to the back of the document or container.
Syntax
retVal = object. QueryStatus( DECMD_SEND_TO_BACK )object.ExecCommand DECMD_SEND_TO_BACK
Part | Description |
object | The DHTML Editing control |
Return values
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The element is not absolutely positioned. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selected element can be repositioned. |
Remarks
This command is supported for absolutely positioned elements (those that have been positioned using DECMD_MAKE_ABSOLUTE). Use the QueryStatus method to determine whether the selected element can be moved in z-order.
The z-index of a new object on a page is initially set to be higher than all other objects in its container, and therefore on top of previous items in the container.When passed with the ExecCommand method, this command sets the element's Z-ORDER style attribute to the lowest of all the absolutely positioned elements on its side of the 1-D stream. (Elements with a positive Z-ORDER style attribute value are in front of the 1-D stream; elements with a negative Z-ORDER style attribute value are behind it.) The command adjusts the Z-ORDER style attribute of other elements as necessary. If the element is already at the back, executing this command makes no change.
Note For details about absolute positioning, see Working with Absolutely Positioned Elements.
Description
Sets the background color of the text in the selection.
Syntax
retVal = object. QueryStatus( DECMD_SETBACKCOLOR )object.ExecCommand DECMD_SETBACKCOLOR, OLECMDEXECOPT_DODEFAULT, backColor
Part | Description |
object | The DHTML Editing control |
OLECMDEXECOPT_DODEFAULT | A constant value specifying that the command should perform its default user interface behavior (in this case, not displaying a dialog box). This parameter is passed primarily as a placeholder so the backColor parameter is interpreted correctly. |
backColor | String containing either a color name (such as "red," "white," "black," and so on) from the Internet Explorer color table, or a six-digit numeric RGB color value (such as "FF0066"), with or without the leading "#" character. |
Return values
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The selection is an element that does not support a background color. Only text does. |
DECMDF_ENABLED (3) | The selection includes only text. |
DECMDF_NINCHED (11) | The selection includes some elements or text whose back color is not already set. |
Remarks
This command is only supported if the selection contains text.
When passed with the ExecCommand method, this command adds a <FONT> tag around the selection if one is not already there. Within the <FONT> element, this command adds or changes the style attribute BACKGROUND-COLOR plus the number or name of the color.
See Also
DECMD_GETBACKCOLOR, DECMD_SETFORECOLOR
Description
Sets the paragraph formatting of the selected text.
Syntax
retVal = object. QueryStatus( DECMD_SETBLOCKFMT )object.ExecCommand DECMD_SETBLOCKFMT, OLECMDEXECOPT_DODEFAULT, formatName
Part | Description |
object | The DHTML Editing control |
OLECMDEXECOPT_DODEFAULT | A constant value specifying that the command should perform its default user interface behavior (in this case, not displaying a dialog box). This parameter is passed primarily as a placeholder so the formatSize parameter is interpreted correctly. |
formatName | A string containing the name of an HTML paragraph format, such as "Normal" or "Heading 1". You can get a list of supported block format names by executing the DECMD_GETBLOCKFMTNAMES command. Passing an invalid format name results in an error.
Note The valid names you can pass with this command are not the names of the corresponding HTML tags. For example, to enclose a paragraph in an <H2> element, you must pass the format value "Heading 2." |
Return values
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The selection includes an element, such as an image, table, or control, that ordinarily does not support paragraph formatting. If you call the ExecCommand method in this state, an error can occur. |
DECMDF_ENABLED (3) | The selection supports paragraph formatting. |
Remarks
Use the QueryStatus method to determine whether a paragraph format can be applies to the selection.
When passed with the ExecCommand method, this command adds an appropriate element around the selection. For example, if you pass the value "Heading 2" to the command, the selection is enclosed in <H2> and </H2> tags.If nothing is selected, the current paragraph is the one in which the insertion point appears.
To remove a specific format, apply the Normal format, which places <P> and </P> tags around the current paragraph.
Description
Applies a font face to the selected text.
Syntax
retVal = object. QueryStatus( DECMD_SETFONTNAME )object.ExecCommand DECMD_SETFONTNAME, OLECMDEXECOPT_DODEFAULT, fontName
Part | Description |
object | The DHTML Editing control |
OLECMDEXECOPT_DODEFAULT | A constant value specifying that the command should perform its default user interface behavior (in this case, not displaying a dialog box.) This parameter is passed primarily as a placeholder so the fontName parameter is interpreted correctly. |
fontName | A string containing the name of the font face.
Note The command does not validate that you are passing a valid font face. |
Return values
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The selection includes an element, such as a table, that does not support the <FONT> element. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selection supports the <FONT> element. This value is also returned if the selection contains a mix of elements that do and do not support the <FONT> element. |
Remarks
This command is only supported if the selection contains text.
When passed with the ExecCommand method, this command adds a <FONT> tag around the selection if one is not already there. Within the <FONT> element, this command adds or changes the FACE attribute.If nothing is selected but the insertion point is within a word, this command treats the current word as the selection.
This command does not display a user interface; you must pass a font face name with the command. To allow the user to choose a font face, display the Font dialog box using the DECMD_FONT command.
If you need to be able to reset the font name to its previous value, you should execute the DECMD_GETFONTNAME command and save off the current font before executing the DECMD_SETFONTNAME command. If you want to remove the FONT attribute altogether, you must update the HTML text of the document directly (using the DOM property).
Description
Sets the HTML font size of the selected text.
Syntax
retVal = object. QueryStatus( DECMD_SETFONTSIZE )object.ExecCommand DECMD_SETFONTSIZE, OLECMDEXECOPT_DODEFAULT, fontSize
Part | Description |
object | The DHTML Editing control |
OLECMDEXECOPT_DODEFAULT | A constant value specifying that the command should perform its default user interface behavior (in this case, not displaying a dialog box.) This parameter is passed primarily as a placeholder so the formatSize parameter is interpreted correctly. |
fontSize | A numeric value indicating the HTML font size to apply in the range 1 to 7. |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The selection includes an element, such as a table, that does not support the <FONT> element. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selection supports the <FONT> element. This value is also returned if the selection contains a mix of elements that do and do not support the <FONT> element. |
Remarks
This command is only supported if the selection contains text.
When passed with the ExecCommand method, this command adds a <FONT> element around the selection if one is not already there. Within the <FONT> element, this command adds or changes the SIZE attribute.If nothing is selected but the insertion point is within a word, this command treats the current word as the selection.
This command does not display a user interface; you must pass a font size with the command. To allow the user to choose a font size, display the Font dialog box using the DECMD_FONT command.
If you need to be able to reset the font size to its previous value, you should execute the DECMD_GETFONTSIZE command and save off the current size before executing the DECMD_SETFONTSIZE command. If you want to remove the SIZE attribute altogether, you must update the HTML text of the document directly (using the DOM property).
Tip To allow users to select character formatting attributes for the selection, display the Font dialog box using the DECMD_FONT command.
Description
Sets the foreground color of the text in the selection.
Syntax
retVal = object. QueryStatus( DECMD_SETFORECOLOR )object.ExecCommand DECMD_SETFORECOLOR, OLECMDEXECOPT_DODEFAULT, foreColor
Part | Description |
object | The DHTML Editing control |
OLECMDEXECOPT_DODEFAULT | A constant value specifying that the command should perform its default user interface behavior (in this case, do not display a dialog box.) This parameter is passed primarily as a placeholder so the foreColor parameter is interpreted correctly. |
foreColor | String containing either a color name (such as "red," "white," "black," and so on) from the Internet Explorer color table, or a six digit numeric RGB color value (such as "FF0066"), with or without the leading "#" character. |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The selection is an element that does not support a background color. Only text does. |
DECMDF_ENABLED (3) | The selection includes only text. |
DECMDF_NINCHED (11) | The selection includes a mix of text with a foreground color and text without. |
Remarks
This command is only supported if the selection contains text.
When passed with the ExecCommand method, this command adds a <FONT> element around the selection if one is not already there. Within the <FONT> element, this command adds or changes the COLOR attribute plus the number or name of the color.
Tip To allow users to select character formatting attributes for the selection, display the Font dialog box using the DECMD_FONT command.
If you need to be able to reset the color to its previous value, you should execute the DECMD_GETFORECOLOR command and save off the current color before executing the DECMD_SETFORECOLOR command. If you want to remove the COLOR attribute altogether, you must update the HTML text of the document directly (using the DOM property).
Description
Splits one or more table cells.
Syntax
retVal = object. QueryStatus( DECMD_SPLITCELL )object.ExecCommand DECMD_SPLITCELL
Part | Description |
object | The DHTML Editing control |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The selection or insertion point is not inside a table. This value is also returned if the insertion point is within the table caption or if the entire table is selected. If you call the ExecCommand method in this state, an error occurs.
Note This value is returned if more than one cell is selected. However, it is possible to split multiple cells in one operation. In that case, no error occurs when you execute the command. |
DECMDF_ENABLED (3) | The selection or insertion point is within cells in a table. |
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command. Use the ExecCommand method to split a cell.
The selection or insertion point must be within one or more cells in a table. If nothing is selected, the current cell is the one in which the insertion point appears, and the one that is split. If the selection includes more than one cell, all cells containing any portion of a selection will be split--it is not necessary that the entire contents of a cell be selected.Each selected cell is split horizontally--an empty cell is added to the right of the selected cell. The overall table width is not altered when splitting a cell. Instead, the cell widths are adjusted to accommodate the deleted cell.
Description
Toggles the underline state of the selected text.
Syntax
retVal = object. QueryStatus( DECMD_UNDERLINE )object.ExecCommand DECMD_UNDERLINE
Part | Description |
object | The DHTML Editing control |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The selection is an element (such as a control or table) that does not support underlining. If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selection is not underlined, or includes both underlined and non-underlined elements. |
DECMDF_LATCHED (7) | The selection is already underlined. |
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command.
If nothing is selected but the insertion point is within a word, this command treats the current word as the selection.When passed with the ExecCommand method, this command places <U> and </U> tags around the selection or at the insertion point. If the selection is already underlined, the selection is <U> and </U> tags are removed. If the selection is within a larger string of underlined text, the command inserts </U> and <U> tags around the selection, effectively removing underlining for the selection.
Tip To allow users to select character formatting attributes for the selection, display the Font dialog box using the DECMD_FONT command.
Description
Reverses the effect of the last editing operation.
Syntax
retVal = object. QueryStatus( DECMD_UNDO )object.ExecCommand DECMD_UNDO
Part | Description |
object | The DHTML Editing control |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | There is no edit command to undo. |
DECMDF_ENABLED (3) | A command is available to be undone. |
Remarks
Use the QueryStatus method to determine whether there are commands that can be undone. Use the ExecCommand method to undo the command.
As a general rule, the DECMD_UNDO command can only undo the effects of commands made in Edit mode (commands executed with the ExecCommand method). For example, it cannot undo the effect of setting a property value or calling a method. You can undo an unlimited number of previously made edits, but they are undone in the reverse order --you cannot selectively undo specific commands.
Description
Removes <A> and </A> tags from the selection.
Syntax
retVal = object. QueryStatus( DECMD_UNLINK )object.ExecCommand DECMD_UNLINK
Part | Description |
object | The DHTML Editing control |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The selection or insertion point is not in a link. |
DECMDF_ENABLED (3) | The selection or insertion point is in a link. |
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command.When passed with the ExecCommand method, this command affects the entire container in which the insertion point or selection occurs, even if a subset of the text is selected.
Description
Turns the selection into a bulleted (unordered) list or removes selected list items from a bulleted list.
Syntax
retVal = object. QueryStatus( DECMD_UNORDERLIST )object.ExecCommand DECMD_UNORDERLIST
Part | Description |
object | The DHTML Editing control |
Return value
One of the following values is returned when you use this command ID with the QueryStatus method:
Setting | Value |
DECMDF_DISABLED (1) | The selection includes an element, such as a table, that cannot be put into a list. (The contents of individual cells can be put into a list.) If you call the ExecCommand method in this state, an error occurs. |
DECMDF_ENABLED (3) | The selection can be turned into a list. |
DECMDF_LATCHED (7) | The selection is already part of a list. |
Remarks
Use the QueryStatus method to determine whether the selection or insertion point location can accept this command.
When passed with the ExecCommand method, this command acts on the selection, or if nothing is selected, on the current paragraph only. The command surrounds the affected paragraphs with <UL> and </UL> tags, and places <LI> and </LI> around individual paragraphs. If the selection is already part of an ordered list, the tags are removed and surrounding text is fixed up appropriately.