Simulating 'Use Paragraph Font'
The Use Paragraph Font option in TX Text Control resets inline style attributes back to the surrounding paragraph defaults. This C# sample uses the InlineStyle class and its ResetToParagraph method with the Attributes enumeration to replicate this behavior programmatically.

TX Text Control's button bar contains a drop down list with all available styles that can be applied to a document. Generally, by applying a ParagraphStyle to a Selection, the InlineStyles are not be changed. The combo box contains an item called [Use Paragraph Font].
This item resets one or more of the style's attributes to its default value, which is the same value as defined for the surrounding paragraph. By resetting all values, the mixed paragraph will adapt the complete formatting of the ParagraphStyle. The attribute can be a bitwise combination of values from the Attributes enumeration contained in the InlineStyle class.
private void ParStyles_SelectedIndexChanged(object sender, System.EventArgs e)
{
if(ParStyles.SelectedItem.ToString() == "[Use Paragraph Font]")
{
try
{
TXTextControl.InlineStyle style = textControl1.InlineStyles.GetItem(textControl1.Selection.FormattingStyle);
style.ResetToParagraph(TXTextControl.InlineStyle.Attributes.FontSize);
style.Apply();
}
catch
{
}
}
}Related Posts
Create a Table of Contents in Windows Forms using C#
This article explains how to create a table of contents in Windows Forms using the ribbon or programmatically. Creating a table of contents is required to organize large documents.
Two Ways to Restart Numbered Lists in TX Text Control
In TX Text Control, numbered lists are continued by default and need to be reset when required. There is more than one way if you want to restart numbered lists in a document. In this article, two…
Paste Special: The Easy Way to Implement
TX Text Control version 15.0 introduced a ClipboardFormat parameter on the Paste method, enabling native Paste Special functionality. The GetClipboardFormats method returns all available clipboard…
How to Remove All Section Breaks in a Document?
TX Text Control 15.0 adds per-section page column support alongside existing section breaks. To remove all section breaks programmatically, iterate through SectionCollection using…
Batch Printing: How to Print Documents in One Print Job
Batch printing multiple documents as a single print job using TX Text Control relies on a .NET PrintDocument with PrintPage and QueryPageSettings events. Each page is rendered individually via the…
