Live ParagraphFormat API
Inspect the current paragraph
Move the caret between paragraphs or select several paragraphs. The diagram and values follow the document automatically.
Waiting for the editorFormatting applies to every paragraph touched by the selection.
Mixed means the selected paragraphs use different values for that attribute.
Ready to tryUse the controls above to interact with this demo.
What this demonstrates
Paragraph scope and layout measurements
ParagraphFormat exposes the layout attributes of every paragraph touched by the current selection, including a zero-length caret selection.
Paragraph object
TXTextControl.selection.paragraphFormat
Format events
inputPositionChanged / paragraphFormatChanged
Mixed value detection
Selection.isCommonPargraphFormatValueSelected
How it works
The current Selection determines the affected paragraphs. With only a caret, formatting applies to that paragraph. A selection spanning paragraph marks applies changes to all included paragraphs, so no separate paragraph lookup is required.
Distances and indents are returned in twips. The inspector converts them to points for display and converts the editable point values back to twips before calling setLeftIndent, setRightIndent, setTopDistance, and setBottomDistance.
isCommonPargraphFormatValueSelected checks each attribute before it is displayed. This is especially important when several paragraphs are selected because getters otherwise return their default value for mixed formatting.
The highlighted-frame action first calls setFrame with Frame.Box. It can then apply the line color, width, and FrameStyle.Double safely.
NuGet packages
TXTextControl.TextControl.Core.SDK
34.0.4
Provides the core document model and server-side document processing APIs.
dotnet add package TXTextControl.TextControl.Core.SDK --version 34.0.4
Provides the browser-based TX Text Control document editor and JavaScript API.
dotnet add package TXTextControl.Web --version 34.4.0
TXTextControl.Web.DocumentEditor.Backend
34.4.0
Hosts the WebSocket-based backend used by the browser document editor.
dotnet add package TXTextControl.Web.DocumentEditor.Backend --version 34.4.0