DOM Properties Accessing the Document Structures
In the Merge context one often wants to refer to properties of the objects in the various DOMs: _document
, _page
, _data
. There is quite a large set of available properties to get, and often to update as well. The Script Editor dialog in DocOrigin Design provides you with ready access to these property names (and function names as well) by using a right-click context menu. You don't have to memorize every spelling, but do read through the upcoming lists and establish an understanding of all that is available. Not only do the DOMs themselves begin with "_
" (underscore), but all properties do as well. This is to differentiate a DOM Object property such as _width
from a potential DOM Tree element of, say, _document.Carton.width
.
Property | Description |
---|---|
| These are read-only convenience functions for getting the absolute positions, in microns, of the left and right of the object's virtual minimum enclosing rectangle. See also |
| These are convenience functions for getting and setting the absolute positions, in microns, of the top and bottom of the object's virtual minimum enclosing rectangle. (See also |
| (As of 3.1.002.06) Return or set the Adjust height flag for a Field, one of "true" or "false". |
| (As of 3.1.002.06) Return or set the Adjust width flag for a Field, one of "true" or "false". |
| (As of 3.1.002.06) Return or set the Allow Break After flag for a Pane, one of "true" or "false". Set before pagination. |
| (As of 3.1.002.06) Return or set the Allow Break Before flag for a Pane, one of "true" or "false". Set before pagination. |
| (As of 3.1.001.10) Return or set the Allow split flag for a Pane, Group, Field or Label, one of "true" or "false". |
| (As of 3.1.001.10) Return or set the Allow multiple flag for a Pane or Row, one of "true" or "false". Set at the Start-of-Job or Start-of-Document event. |
| Set to "false" to turn off automatic formatting of Fields using Picture formatting. Note that setting to "true" does nothing. For example:
This code would calculate an extended price and presumably format as currency. If the value was less than zero, the field would instead display VOID. |
| Return or set the background color. See Colors page for options. |
| Return or set the display of an object's border, one of "true" or "false". |
| Return or set color of rectangle border. See Colors page for options. |
| Return or set the radius for rounded corners. Returned values are in microns. See the Script Units description for setting values. |
| Return or set the bottom inset for the object's border. Returned values are in microns. See the Script Units description for setting values. |
| Return or set the bottom margin. Returned values are in microns. See the Script Units description for setting values. |
| (As of 3.1.002.06) Return or set the caption field property. |
| Return or set the collate paper property. Best used on the Form object. |
| Return or set the text color. See Colors page for options. |
| Counts the number of sibling occurrences of a Pane or Row. Includes itself in the count. Caution required, see domObj.childNamed. |
| Returns a pointer to this object's Container object. |
| Returns a pointer to this object's Page object. |
| Return the Data DOM object whose value was used to populate this Field. This makes sense only on Document Field objects. In other cases, it will return NULL. See the |
| (As of 3.2.001.03) Returns the string value of a Field interpreted as a date and formatted as "yyyyMMdd" a string, empty string on failure. |
| (As of 3.2.001.03) Returns the JavaScript date object initialized by the value of a Field interpreted as a date, |
| (As of 3.1.001.10) Return or set a Form or Page's duplex property. Values are "dontChange", "simplex", "top", or "left". |
| Return or set the drawing of the object's borders. Values are "all", "none" or any combination of: "top", "bottom", "left", and "right", separated by a space. |
| Return the first (or only) child object of the current object. For example, if the current object is a Pane, then one could get the first object in that Pane. See also |
| Return or set a Field's font bolding status, one of "true" or "false". |
| Return or set a Field's font italic status, one of "true" or "false". |
| Return or set a Field's font point size. |
| (As of 3.1.001.15) Return or set a Field's font strike through status, one of "true" or "false". |
| Return or set a Field's font typeface name. |
| Return or set a Field's underline option, one of "none", "single", "word", or "double". |
| Return the fully qualified name of the object in dotted notation, e.g. |
| (As of 3.0.003.11) Return whether a Field is marked as Global or not. Essentially read-only, since by Data Merged, setting it would have no effect whatsoever. |
| Return or set the height of an object. Returned values are in microns. See the Script Units description for setting values. |
| Return or set the horizontal justification "left", "right", "center", "spread", or "spreadAll". |
| Return or set a Field's hyperlink URL. See Hyperlinks for further information on hyperlinks. |
| Return or set the Image Size/Crop to "Scale", "Clip", "Resize", "Stretch" or "FitWidth". |
| Return or set the Image file name of a Label object. |
| (As of 3.2.001.01) Return or set a Field's Initial Value. This makes sense only before the End of Merge event. |
| Return or set a Field's input status, one of "true" or "false". See Fillable Forms for further information and examples. |
| Return or set Input Field AM/PM setting. If "true", use 12hr clock and AM/PM option, otherwise use 24hr clock. |
| Return or set Input Field choice list. See Fillable Forms for more information. |
| Return or set Input Field Signature Clear button text. See Fillable Forms for more information. |
| Return or set Input Field Image. See Fillable Forms for more information. |
| Return or set Input Field Label for choice lists, radio buttons etc. See Fillable Forms for more information. |
| Return or set Input Field AM/PM setting. If "true", use 12hr clock and AM/PM option, otherwise use 24hr clock. |
| Return or set Input Field Readonly status, one of "true" or "false". See Fillable Forms for more information. |
| Return or set Input Field Required status, one of "true" or "false". See Fillable Forms for more information. |
| Return or set Input Field Required message text. See Fillable Forms for more information. |
| Return or set Input Field Date month style. Use "true" to display 'Jan' or "false" to display 'January'. See Fillable Forms for more information. |
| Return or set Input Field Date year style. Use "true" to display '09' or "false" to display '2009'. See Fillable Forms for more information. |
| Return or set the printer Input Tray for the current page. |
| Return or set Input Field Post destination URL. See Fillable Forms for more information. |
| Return or set Input Field date year range. See Fillable Forms for more information. |
| Return the last (or only) child object of the current object. For example, if the current object is a Pane, then one could get the last object in that Pane. See also |
| Return or set left or top position. Returned values are always in microns. See the Script Units description for setting values. The position is relative to top-left of the containing Pane, Cell, or Group. See also |
| Return or set the left inset for the object's border. Returned values in microns. See the Script Units description for setting values. |
| Return or set the left margin. Returned values in microns. See the Script Units description for setting values. |
| Return or set line spacing for text. Returned values are always in microns. See the Script Units description for setting values. |
| Return or set the line style, one of "solid", "dash", "dot", or "dashDot". |
| (As of 3.2.001.09) Return the |
| (As of 3.1.00.10) Return or set the Locale (e.g. en_US) for the current object. Often this will be |
| (As of 3.1.002.04) Return or set the Mandatory flag for a Pane, Row or Page, one of "true" or "false". Set at Start-of-Job or Start-of-Document. |
| Return or set minimum height allowed for this pane. Returned values in microns. See the Script Units description for setting values. |
| Return or set an object's Name. |
| Return the next object in the DOM from top to bottom. This is an easy way to "walk the entire DOM". NULL is returned at the end of the DOM. |
| Return the next child of a parent. Follows usage of |
| Returns the value of a Field as a raw number. This will remove any existing number formatting from a field value such as $1,234.56 and return the number 1234.56. |
| Return the number of children that the given object has. |
| Return the total number of pages in the document. This applies only on or after the Pagination Completed event. |
| Return or set the number of copies to be produced. Best used on the Form object. |
| Return an object's occurrence number within its enclosing parent pane. The numbers start at 0 the third occurrence of an object would return a value of 2. Typically used with repeating Panes. |
| (As of 3.1.002.06) Return or set the OnSplit Headers... property for a Pane or Overflow Headers... for a Container. It's a space-separated list of header panes. |
| (As of 3.1.002.06) Return or set the OnSplit Footers... property for a Pane or Overflow Footers... for a Container. It's a space-separated list of footers panes. |
| Return a Page's "original form name" for a composite Form created using DocOriginCombineForms. |
| Return or set the printer Output bin for the current page. |
| Return any text that overflows from a fixed-size text Field. Not applicable to Single line Fields, or Fields set to Adjust height. |
| Return or set page break flag for a Pane. |
| Return the number of pages in the document. This makes sense only after the Pagination Completed event. |
| (As of 3.1.002.02) Return the number of pages in the form. |
| Return the page# of the object document based. Since repeating line items (Panes) typically cause multiple pages to print, the final page number is not set until the |
| (As of 3.1.002.02) Return the page# of the object form based. |
| (As of 3.2.001.01) Return or set a Page's Orientation, one of "Portrait" or "Landscape". |
| (As of 3.1.001.10) Return or set a Page's placement property, one of "any", "anyFromFront" and as of 3.2.001.11, "front", or "back". |
| (As of 3.2.001.01) Return or set the Paper size, one of "A4", "Letter", etc. |
| Return or set the Paper type for the current page. |
| Return the parent object of the current object. This returns NULL when at the top of the DOM's ancestor stack. |
| Return or set a Field's picture clause. DocOrigin uses the ICU package for picture formatting. See setting-time-zones. |
| Return or set the presence of an object, one of "yes", "no", or "none". "none" indicates that the object takes up no space at design or print time. |
| Return the previous child of a parent. Follows usage of |
| Return the current Field/Label value. For Fields, this is the value before Field formatting has been applied (number, currency, date, and so on). See |
| Return or set the right inset for the object's border. Returned values are in microns. See the Script Units description for setting values. |
| Return or set the right margin. Returned values are in microns. See the Script Units description for setting values. |
| Counts the number of child Rows or Panes of a Table or Pane. Table Rows marked as headers or footers are ignored in this count. |
| Return the number of sheets of paper required to print the document. This makes sense only after the Pagination Completed event. |
| (As of 3.1.002.06) Return or set the Single line flag for a field, one of "true" or "false". |
| Return the Template (Form) DOM object from which the given Document DOM object was created. This makes sense on only Document DOM objects. In other cases, it will return NULL. This is useful for retrieving the value that an attribute was set to at design time. Often |
| Returns the width of the longest (widest) line in a text block, in microns. See also |
| Return or set the border thickness in microns. |
| Return or set the top inset for the object's border. Returned values are in microns. See the Script Units description for setting values. |
| Return or set the top margin. Returned values are in microns. See the Script Units description for setting values. |
| Return or set the object's transparency, one of "true" or "false". Set to "true" on an Image to allow what is under the Image to show through in the Image's lighter areas. See |
| Return the type of a document object. See the table of those type values below. |
| Return or set the current Field/Label value. The returned Field value has formatted text after applying the formatting (number, currency, date, and so on) to the original data. See |
| Return or set a Field's viewer attributes. See Fillable Forms for further information and examples. |
| Return or set the visibility of the Field or Label, one of "true" or "false". |
| Return or set the vertical justification, one of "top", "bottom", or "middle". |
| Return or set the width of an object. Returned values are in microns. See the Script Units description for setting values. |
Object type values returned from object._type |
---|
"Form", "Page", "Container", "Pane", "Group", "Line", "Rectangle", "Table", "Row", "Cell" |
"Field-Text-String", "Field-Text-Number", "Field-Text-Currency", |
"Field-Checkbox", "Field-Radiobutton", "Field-Image", "Field-Barcode", "Field-Comb" |
"Label-Text", "Label-Image", "Label-Barcode" |
"Arc", "PolyLine" dynamically generated by _chart |
Examples
1. The following example determines the sum of an amount_total field by page:
// abbreviation for repeating panes var r = _document.main_pane.detail_table.detail_line; var sum=0.0; var page=1; for (var i=0; i < r[0]._count; i++) { if (r[i]._pagenumber != page) { // when the page# changes, print info _printf("Sum for page %d is %10.2f\n", page, sum); sum = 0.0; page++; } sum = sum + r[i].extended_amount._num; } _printf("Sum for page %d is %10.2f\n", page, sum);
2. While it is not often that scripting adjusts object locations, here is an example that makes a "trailer" pane into a page"footer". Used in the Pagination Completed event. Imagine that this is on a "totals" pane or something of that nature.
// Place this pane at the very bottom of the container this._absTop = this._currentContainer._absBottom - this._height;