The following flags exist on Content Controls: cannotEdit, cannotDelete and removeWhenEdited.
cannotDelete = true results in a Content Control which can be edited but cannot be deleted.
cannotEdit = true results in a Content Control which can be neither edited nor deleted.
removeWhenEdited = true results in a Content Control which, upon editing, removes the Content Control while leaving the contained text.
I'm looking for a way to make a Content Control whose underlying text cannot be edited but where the entire control can be deleted somehow, perhaps by selecting the control itself and hitting delete. Does such a configuration exist?
Thanks!
No, Word does not provide that option. It would need to be completely coded in the add-in and the interface for the user to choose that would also need to be part of the add-in.
My recommendation would be to assign (copy) the content control's Rangeto a point just before or after the content control, enable deletion of the content control then delete it.
Related
I've got a script that finds all matching bits of text and puts them in a content control. I noticed there was a functionality to remove the content control if the text was edited ContentControl.removeWhenEdited = true. Is there a way to run this same trigger/event of when the text content changes, but instead of removing the content control trigger some custom code instead?
I figured since there's already functionality to trigger on the exact event I need, it surely can't be too complicated. I tried ContentControl.onDataChanged = MyFunction() but this only ran the function when the content control was added and couldn't rerun it when the data was infact changed.
Any and all help greatly appreciated!
I have a document-level (dotx) customization, with a custom ribbon, and one of the controls in that ribbon is this:
<gallery idMso="CustomGallery1" label="Building Blocks" size="large" />
The only other part that makes this work is the creation of entries under Custom1 in the Building Blocks Organizer. In Word 2010, this would show all the building blocks under the Custom1 category. In Word 2013, it shows the name of each building block briefly, and then all of them are removed and the list is empty:
The building blocks themselves all contain either a document property or document variable.
I have tried the following to resolve this but without success:
Ensured that they are still present by opening the template outside of Visual Studio; they are.
Upgraded the template to the 2013 dotx format.
Re-created the building blocks.
Re-created the entire dotx file, and then re-created the building blocks.
I also tried using other ribbon IDs, they are empty too (they do all have entries) but they display it differently:
There should be four entries there, they exist in my Normal.dotm. The last two controls there, for equations and content controls, do work, except the content control that is inserted displays similar behavior as the Autotext gallery:
I don't know what should be shown in this case but I doubt it's nothing.
Right now I'm assuming that this is just a broken feature in 2013 and will have to replace it with something else. Does anyone know anything to the contrary?
I don't think it is a broken feature, after some struggle, I did get to understand how to use it:
The gallery button in the "toolbar" of a newly added Building Block Gallery Content Control indeed seems empty at first, because it is set to list QuickParts. You have to change it in the properties of the control so that it lists the content of the AutoText Gallery instead (or any other Gallery of Building Blocks you'd like). To do so, either directly click on the Properties button in the Developper tab while the control is selected, or switch to Design Mode so that the Properties appears in the context menu (right-click on the control):
AutoText is "Insertion automatique" in French, the rest you can guess ;)
As far as I could find, it's just a broken feature. There's also a ridiculous memory leak the first time you do a Find and add fields during that find.
In the SAPUI5 control explorer in the busy dialog section there is mention of a sap.m.sample.BusyDialogLight.C control. Essentially this is an unframed dialog with the busy indicator 3-blue blobs image over it. I intend to use this whilst long JSON fetches are running.
My version of OpenUI5 which is v1.40.10 does not have a file or folder with that name in the sap.m.* folders. It only has sap.m.BusyDialog.js which I read (dbg version) and see no obvious mention of a light model.
So can anyone tell me if there is actually a BusyDialogLight control and how to define it?
This is just the controller which handles the view. The name used there is the same as in the view's controllerName attribute. And light is in this context just the BusyDialog without text and buttons.
Update: Manually losing the form and re-opening it also causes editing to be allowed, please see Step 4 below and "Additional Notes" section below. Thanks!
An MS-Access 2007 database that I have simplified a great deal during troubleshooting still has the same problem:
Restart Access and open the database
The autoexec calls a vba function that initializes some TempVars, then opens a form with: `DoCmd.OpenForm FormName:="MainEditor"
All Bound and Un-Bound Text Boxes and Combo Boxes display their data
correctly, but NONE of them can be edited. Keystrokes are ignored, pull-downs on Combo Boxes display lists of choices correctly but no choice can be selected.
Change the form's view to Design View, then immediately change it back to Form View. Alternatively, manually close the Form and then re-open it.
All the controls continue to display their data correctly, but now ALL of
them can be edited normally.
After changing to Design View and back to Form View, the Form is editable normally until Access is shut down and restarted.
Additional Notes:
I tried adding a DoCmd.Close and a DoCmd.FormOpen immediately after the original DoCmd.FormOpen in the startup function called by the Autoexec macro, but the Form remained unable to accept edits. Manually closing the form, and then manually re-opening it, seems to work every time. Is there any chance that Access needs a delay to process before opening the form, and manually doing the close/open cycle provides that time window?
Here's some background:
The Table has a primary index, 4 other indexes, and one-to-many relations to 7 other tables.
The Form's Record Source is the Table, and Allow Edits = Yes.
All the controls on the Form are set: Enabled = Yes, and Locked = No.
There are no sub-forms, only the one Form.
This isn't much to go on. If you ask for further specifics I'd be glad to provide them.
Thank you. Dave
Instead of using an Autoexec macro, specify a startup form.
I have a MS Word document and that document has multiple content control. When user copies entire data from one content control to another sometimes it copies content control itself with data and when user pastes data it creates nested content control.
Question:
Somehow I need to restrict Word document so that user can only modify data and additional content control cannot be created. How can I achieve this.
I don't think there is a setting in Word that can control this; there isn't a content control property that does.
So I think you're looking at a VSTO Word Add-In, or possibly a VBA macro.
With VSTO, have a look at the content control event model. Maybe Document.ContentControlAfterAdd fires on paste? Googling .. apparently it does, subject to an issue
when the content controls are in table cells, and the user chooses to
insert a column: the BeforeDelete is fired for all the content
controls in the table, but AfterAdd is not raised when the column
insertion completes.
Check out the other content control related events as well - start by seeing which fire when the user does what you are concerned about, and of course, what other situations they fire in (which your code will have to ignore).
Otherwise, you could try a more generic way of capturing paste. There is:
this thread
and the keyboard hook approach