Hi,
I have an editor that I'm trying to get alignment to work properly and I cant seem to get anything but the entire page/block to work. If I use txtEditor.EditInfo.ApplyStyle("text-align:Right", True) this works for the entire page but if I select some text/lines in my editor with the last param set to "False" nothing happens. Am I wrong in thinking that this code should work like all other formatting options (bold/font/etc) or is there some trick to getting selected text to have different alignment properties?
Any help would be great!
amy
After playing around with this myself, there doesn't really seem to be an easy way to have the Enter key insert a paragraph tag in such as way that you will be able to align the text blocks independently. You can simply do something like "this.ultraFormattedTextEditor.EditInfo.InsertValue("<p />"))" but this will add a block in the middle and not cause the sections to independantly shift alignment. You will probably have to manipulate the value yourself to place paragraph tags around the relevant sections; see the UITypeEditor for the Value property at design-time to see what these values might look like.
You could also submit this issue to Developer Support to see if they have any other suggestions, or perhaps submit a feature request to enable an option to allow the Enter key to create a new paragraph.
-Matt
Hi Matt,
This works fine in the Web formatted text editor, but not in the WinForms version. Could you provide some sample code to do this?
Thanks
Amy,
The text align setting will only apply to something like a paragraph tag and you can't use it just on a few lines; this is the same behavior that you will see in Word, where even if you select a few lines in a paragraph tag, changing the alignment will change that of the entire paragraph. On the same token, pressing Enter in the UltraFormattedTextEditor will insert a <br> tag and will not create a <p/> tag, so the styles will still apply to everything. I suppose you could alter the KeyActionMapping of the Enter key to use a <p> tag, or handle the KeyDown yourself to perform this logic.