flashx.textLayout.conversion

# ITextExporter - AS3

Package | flashx.textLayout.conversion
Interface | public interface ITextExporter

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Interface for exporting text content from a TextFlow instance to a given format, which may for example be String or XML format, or a user-defined format. Exporters support the getting and setting of properties to control the export of data. These properties are implemented as public properties, but the direct access of these properties should be avoided, since a user might replace the converter class in the TextConverter registry, causing a downcast to fail.

Public Properties

| Property | Defined By
--- | --- | ---
|  | errors : Vector.<String> [read-only] This property contains a vector of error messages as strings after a call to an exporter method is the throwOnError property is set to false, which is the default. | ITextExporter
|  | throwOnError : Boolean The throwOnError property controls how the exporter handles errors. | ITextExporter
|  | useClipboardAnnotations : Boolean The useClipboardAnnotations property controls whether or not the importer should handle the extra information necessary for the clipboard. | ITextExporter

Public Methods

| Method | Defined By
--- | --- | ---
|  | export(source:flashx.textLayout.elements:TextFlow, conversionType:String):Object Export text content from a TextFlow instance in String, or XML, or a user defined format. | ITextExporter

Property Detail

### errors

property

`errors:Vector.<String>` [read-only]

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10.2, AIR 2.0

This property contains a vector of error messages as strings after a call to an exporter method is the `throwOnError` property is set to `false`, which is the default. If there were no errors, the property returns `null`. The property is reset on each method call.

Implementation
`public function get errors():Vector.<String>`

### throwOnError

property

`throwOnError:Boolean`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10.2, AIR 2.0

The throwOnError property controls how the exporter handles errors. If set to `true`, methods throw an Error instance on errors. If set to `false`, which is the default, errors are collected into a vector of strings and stored in the `errors` property, and the exporter does not throw.

Implementation
`public function get throwOnError():Boolean`
`public function set throwOnError(value:Boolean):void`

### useClipboardAnnotations

property

`useClipboardAnnotations:Boolean`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

The `useClipboardAnnotations` property controls whether or not the importer should handle the extra information necessary for the clipboard. When data is in a TextFlow, paragraphs are always complete, and include a terminator character. When a range of text is pasted to the clipboard, it will form paragraphs, but the range may not include in the final terminator. In this case, the paragraph needs to be marked as a partial paragraph if it is intended for the clipboard, so that if it is later pasted it will merge into the new text correctly. If the content is intended for the clipboard, useClipboardAnnotations will be true.

Implementation
`public function get useClipboardAnnotations():Boolean`
`public function set useClipboardAnnotations(value:Boolean):void`
Method Detail

### export

()
method

`public function export(source:flashx.textLayout.elements:TextFlow, conversionType:String):Object`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Export text content from a TextFlow instance in String, or XML, or a user defined format.

Set the `conversionType` parameter to either of the following values, or a user defined format in user-defined exporters.

- `flashx.textLayout.conversion.ConversionType.STRING_TYPE`;
- `flashx.textLayout.conversion.ConversionType.XML_TYPE`.

Parameters

| `source:flashx.textLayout.elements:TextFlow` — The TextFlow to export
| `conversionType:String` — Return a String (STRING_TYPE) or XML (XML_TYPE), or any user defined format.

Returns

| `Object` — Object The exported content

Related API Elements

flashx.textLayout.conversion.ConversionType
Example ( How to use this example )

This code snippet shows a use of the `export` method to perform repeated exports of formatted text.

Copy

    package flashx.textLayout.conversion.examples
    {
        import flashx.textLayout.conversion.ConversionType;
        import flashx.textLayout.conversion.ITextExporter;
        import flashx.textLayout.conversion.TextConverter;
        import flashx.textLayout.elements.TextFlow;

        public class ITextExporterExample
        {
            // Serialize the TextFlow into a String
            static public function export(textFlow:TextFlow):String
            {
                var exporter:ITextExporter = TextConverter.getExporter(TextConverter.TEXT_LAYOUT_FORMAT);
                return exporter.export(textFlow, ConversionType.STRING_TYPE) as String;
            }
        }
    }

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00