Skype:TextControlSupport
Orders:877-462-4772
TX Text Control - word processing components.
« »

Simulating 'Use Paragraph Font'

Blogged by Björn Meyer on December 16, 2005 and tagged with Samples, .NET.

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
{
}
}
}
« Prev:Updated TX Text Control Blog XML feed
» Next:TX Text Control Feature Overview

top

Top 10 Bestselling Product Award 2007Top 25 Publisher Product Award 2007Top 10 Bestselling Product Award 2007 in JapanTop 25 Bestselling Product Award 2006Top 25 Bestselling Publisher Award 2006Reader's Choice Award, dot.net magazin, 3rd place