I have a VSTO add-in which has a menu and button. In my infopath form, i have multiple rich-text box which would be edited by user. While editing, if user select a word or sentence in any of the rich-text box and click the button from add-in, i need to add those selected text in a dropdown.
How can i get the selected text from the rich-text box? The selected may be in any one of the available rich text box, so i need to know the context to identify the rich-text box and then get only the selected text.
In your btn_Clicked event, try this code. It should grab the text starting where the mouse is and ending at the end of the current block.
var curCaret = richTextBox1.CaretPosition;
var curBlock = richTextBox1.Document.Blocks.Where(x => x.ContentStart.CompareTo(curCaret) == -1 && x.ContentEnd.CompareTo(curCaret) == 1).FirstOrDefault();
Related
How to create form using Orbeon builder, where user can select value from a drop down and based on the selection the user can see other controls get rendered (probably hidden/shown).
First, give a meaningful name to that dropdown field; say gender.
Click on the Edit Choices icon for that field, just below the Control Details icon, and in the dialog assign meaningful values to each choice. Those are the values you'll refer to in step 3.
Finally, in the Control Details for the other field, under the Formulas tab, if you want that field to only be shown if the value of the gender field is female, enter the XPath expression $gender = 'female'.
I've been developing a programming where the user can select a list of fields from popup buttons, then they press a calculate button and then depending on the choices, a string of text gets outputted to a UIText Field.
However I would like for the text field to be cleared when the user starts selecting other choices in the popup button before pressing the select button.
Is there anyway this is possible?
Just right this code in the place where that happens:
/*You can replace theTextFieldYouAreTalkingAbout with the one you are talking about*/
theTextFieldYouAreTalkingAbout.text = ""
I'm working with a PowerPoint document which annoyingly sets all newly inserted text boxes' color to Red and uses Century Gothic. I believe this is due to the Master Slide being used by the document.
I would like to remove this automatic setting from text boxes in the Master Slide but I cannot figure out how?
I have gone into the Master Slide view and found that there are no text physical text boxes, there are however "Text Placeholders" but no text boxes. I find it strange and wonder:
how are these newly inserted text boxes contain pre-set font type and color?
If you aren't trying to do this in code, StackOverflow isn't really the right place for the question; you want SuperUser for "How do I ..." questions that don't involve code.
But what you want to do is select a text box that's formatted the way you want default text to be, then right click it and choose Set As Default Text Box. You won't get that option if you've clicked WITHIN the text box and have an insertion cursor; in that case press ESC, then rightclick.
If you're trying to do this in code, select a text box formatted to taste then do something like this:
Sub SetMeAsDefault()
Dim oSh As Shape
Set oSh = ActiveWindow.Selection.ShapeRange(1)
With oSh
.SetShapesDefaultProperties
End With
End Sub
The shape and text box defaults are independent of master formatting, which controls only the formatting of placeholders and text within placeholders. Text/shapes inserted via the Insert ribbon/menu follow the defaults set for the presentation as I've described above. Each presentation (and template) can have its own set of defaults.
I am using edit field to enter some text. When I click on edit field, one Highlighting box is showing as in image. I want to hide that box. Please catch the problem using below image:
How to remove this focused box in edit field??
As it's Edit Field, its default nature is to highlight text for editing. If you are going to enter values in the field during application runtime means you have to bare this. If you are going to enter values programatically means use Rich Text Field or your
editfield.setEditable(false);
how can i make a TRibbonComboBox act like a TCombobox with Style of csDropDownList? we don't want the user to be able to edit the choices in the list.
we need to use TRibbonComboBox because we want the current selection to be visible.
Microsoft word shows a combobox where you can select an item but cannot edit the item itself.
should i consider trying a TCombobox in the ribbon? i'd expect it won't look or not work correctly.
thank you for you comments!
You can just use TRibbonComboBox.ReadOnly:
Determines whether the user can change the text of the edit control.
And furthermore:
Setting ReadOnly to true ensures that the text is not altered, while still allowing the user to select text. The selected text can then be manipulated by the application, or copied to the Clipboard.
(see documentation)