comet.CTextModel ******************************************************************************* .. py:class:: comet.CTextModel CTextModel is used for accessing and modifying the document text. Text model addressing =============================================================================== Usually, the active text model of a script is automatically defined and available to the script - it is therefore not necessary to address the current text selection or its frame. The necessary calculations are performed by the script environment itself. The text indices used in the scripts always refer to the currently active area of a script, such as a placeholder, and not to the entire text frame. The index 0 therefore does not refer to the first character of the current text frame but to the first character of the placeholder. When it becomes necessary to access the global text model of a frame, use :py:meth:`.CFrame.getTextModel` to obtain the entire frame model. Placeholder ------------------------------------------------------------------------------- In text placeholders the text model is automatically determined by the text. The text indices are determined by the beginning and end of the placeholder. If the placeholder is linked to a graphic frame, no text model is available. Panel actions ------------------------------------------------------------------------------- For panel actions the current text model is defined if the text tool is active or if the respective frame for which the script is executed is a text frame. If the panel action is executed for a graphics frame, no text model is available. XML elements ------------------------------------------------------------------------------- Scripts can be specified as the value of XML attributes of a document. In this case, the XML tag whose attribute value is the script may include a text or graphics frame that displays the contents of the XML tag. When the script is executed, the associated XML element is automatically passed to the script. This element can be used to determine the associated text model during script execution and is available to subsequent functions. If an XML element is not linked to a frame but to a piece of text, the index positions automatically refer to this text selection. Position 0 is thus the text start for the XML element, not that of the text. Methods =============================================================================== .. automethod:: comet.CTextModel.replace .. automethod:: comet.CTextModel.getFrame .. automethod:: comet.CTextModel.getStart .. automethod:: comet.CTextModel.getLength .. automethod:: comet.CTextModel.getText .. automethod:: comet.CTextModel.getFontSize .. automethod:: comet.CTextModel.setFontSize .. automethod:: comet.CTextModel.getFont .. automethod:: comet.CTextModel.setFont .. automethod:: comet.CTextModel.getTracking .. automethod:: comet.CTextModel.setTracking .. automethod:: comet.CTextModel.getLeading .. automethod:: comet.CTextModel.setLeading .. automethod:: comet.CTextModel.getListType .. automethod:: comet.CTextModel.getColor .. automethod:: comet.CTextModel.setColor .. automethod:: comet.CTextModel.getHorizontalJustification .. automethod:: comet.CTextModel.setHorizontalJustification .. automethod:: comet.CTextModel.getParaStyle .. automethod:: comet.CTextModel.setParaStyle .. automethod:: comet.CTextModel.getCharStyle .. automethod:: comet.CTextModel.setCharStyle .. automethod:: comet.CTextModel.getInlines .. automethod:: comet.CTextModel.insertCrossRef