how can a word add in keep its documents under custody? - ms-word

I am developing a Word add in that is intended to create randomizable test bank documents. I would like the add in to prevent user entry outside content fields where there will be texts of questions and choices. I tried protection applied outside the content controls, but that requires the add in to frequently unprotect and reprotect the documents with the risk of any intervening error leaving the document unprotected.
If anyone can suggest an alternative method, I will appreciate it.
Hurol Aslan

After trying the protect/unprotected approach, I found that it does not let me nest a locked content control (for providing code-defined content) within a content control open to editing. However, I can set LockContents properties of nested content controls independently. That is the approach I will go with.

Related

Access 2010 Form: Including example input for fields?

I have an input form in which users submit multiple types of information to the database.
Is there any way I could provide an example input of what should go in each field, upon the form loading?
Some fields I'd expect a small paragraph of text, others are dropdowns. The dropdown fields I wouldn't need to put an example of course, just the string text fields. If I try and include an example in the Default value for example, it would save the default value, which I wouldn't want.
Any help is greatly appreciated - It's worth noting I'm quite new to Access & coding in general.
I agree you probably don't want to use default values, or actually enter dummy data into the actual controls for the reason you mention: saving dummy values to the table.
A few possibilities:
Use a custom tooltip. You can do this by editing a control's "controltip text" property. Keep in mind that tooltips are only visible to the user when they hover the cursor over the specific control.
Add a label below the input control that describes the information that should be put in the control. This would always be visible, but can quickly cause your form to be cluttered and difficult to read.
I should say though, that you want to attempt to make your forms as intuitive as possible. For example, if you expect a paragraph of text, make the textbox much larger than a control only expecting a 6 character string. The more you are concerned with UX (user experience), the greater the chance that users will pick up on expectations using subtle design hints. I highly recommend researching the topic if you are concerned that your users will be unable to decipher the purpose of your form/controls. Be sure to check out the UX page on SE.
Furthermore, you can utilize a control's "AfterUpdate" event to validate the input placed in the control as soon as the user moves away from it. For example, you could test if the input IsNumeric() to validate that numbers were entered instead of text. If text is found, you can use a message box to alert the user, and move the cursor back to the control that is invalid.
Of course, that's the customized approach to just using the control's validation rules. The only issue I have had with the standard validation rules is user exhaustion. It can be irritating for a user to deal with validation messages when they are already aware that a typo was made. With an unbound entry form that requires a save button, I usually batch all control validation into the save procedure. This allows the user free reign to skip controls in the tab order without being blocked by constant validation exceptions.

filtering out select style attributes and blacklisting attributes

I have tinymce inserting posts into a database where they'll be subsequently pulled and put into a webpage. The problem is that some of the elements are interfering with page elements.
eg. Maybe the HTML that's being copy / pasted will have a table HTML tag with an id that conflicts with another id already on the page. Or maybe in the style attribute there'll be a z-index so the post cover up certain elements of the page.
I don't really want to blacklist attributes because (XSS considerations aside) I'm thinking all should be considered fair game (well maybe not event handlers) and if it interferes with the layout I can disable those specific tags / attributes on a case by case basis.
Any ideas?
There are several ways to filter your content:
use the tinymce paste_preprocess parameter to filter pasted content before insertion
you may use the valid_elements, valid_children and extended_valid_elements setting to allow which elements and attributes tinymce accepts as valid html tags (this is something you don't want?)
you can filter your code before writing it to your database
You could filter it when putting the content from database into another web page

Repeatable data content in umbraco

I am just wondering is there any plugin to create dynamic content for a page i.e something similar to a data repeaters in .net. To make it simple it should be a section that should contains 5 to 6 fields/property like
heading
heading 2
image
content - rich text editor
info
This must be in repeatable control so that the editor can add any number of these section a page and all these should be displayed in a single page.
Is there a plugin for the above functionality or what is the best way to achieve this.Any help would be greatly appreciated.
Thanks
Aneesh
You can achieve this without any plugins.
Create your repeatable section (containing the relevant fields) as a document type, and then use the multi-node picker in another document type to select one or many of the sections.
So for example, I could have a FAQs page (which uses a document type called "FAQs Page"), and I want to be able to add multiple question and answers to this page. I could set up a document type called "Question". This will contain two fields: Question and Answer.
On the "FAQs Page" document type, I would add a multi-node picker field called "Questions". This way, an author could select multiple "Question" nodes to appear on the FAQs page.
You would obviously need the code to output this, and also you would create a data type that inherited from multi-node picker, so that you could limit the selection to only Question nodes.
There is also the Repeatable Custom Content datatype which works well but does not support all data types. But it does support all the ones you need for your stated purpose (textstring, media picker, richtext area, etc).
You can find it here: http://our.umbraco.org/projects/backoffice-extensions/repeatable-custom-content I've used it a few times and it works really well in certain situations (e.g. where the items will not be shared across different pages of your site).
If you are sharing content components across multiple pages then #Digbyswift's solution is perfect.
I've always Digbyswifts method, but whilst looking for an alternate solution tonight I found this plugin, which is excellent for those situations where creating lots of widget nodes feels like overkill. It's licensed but the free older version is also available.
http://inaboxdesign.dk/blog/widget-builder-for-umbraco/

Nested content controls in Word

I'm looking at Word as part of a document generation solution for a law firm. There are different documents that need to show/hide certain clauses/sections based on business rules and logic that can be fairly in depth - things like a specific judge in a specific county requiring certain information, so entire sections of the document may be shown or hidden based on this logic.
I'm aware of the Content Controls in Word, but is it possible to have nested content controls inside each other? For example, let's say I have a dynamic paragraph (i.e. it might be shown or hidden based on some business rule) and that paragraph also needs to display the name of the plaintiff, which is retrieved from a database.
Our current solution uses a pseudo templating language inside of the Word docs that gets parsed out and replaced (something like {FIELD "FIELD_NAME"} which would insert the value of FIELD_NAME) and it seems to work fairly well but I'm curious if it couldn't be improved using built-in features of Word instead of custom software.
Is something like this possible? I've found an article for Word that seems to indicate this exact scenario, but no articles or resources explaining how to actually achieve it.
Sure, you can nest other content controls within a rich text content control.
You can do this programmatically (in Word using VBA, or in a VSTO Add-In).
But first just try it in Word (enable the Developer ribbon, then insert a rich text control, then insert other content controls in that). A rich text content control can contain paragraphs, tables etc (provided that it is block level, not run level).

Is it bad practice to handle the showing of the open file dialog, and other dialogs, from within a custom textbox control?

I am making a custom textbox control and am thinking about adding keybindings in the constructor that execute commands to open and save files. I am also thinking about handling the find and replace dialog from within my textbox control.
Is there a reason I shouldn't do this?
--Edit--
I am planning on only using this control in my current application. One of the reasons I am thinking of doing this is to avoid binding to the textbox's Text property, since this binding seems like it would be just as inefficient as updating a string on the textbox's textchanged event.
Well, flexibility comes to mind. Consider the following scenarios, which would be impossible (or at least difficult) in your control:
You want to handle multiple or different methods of opening a file, but it depends on your application.
You want to use your textbox but limit the functionality -- e.g., Find/Replace is not allowed.
You want to change the behavior of any of that in one application but not the other. For example, in app A you want to tack on an extra slash to the end of the text, but in app B you want to add a custom folder name.
In general, I would consider something more generic. Something like a textbox has a specific purpose; enhancing that purpose is fine, but you're going beyond that. You're taking logic that rightly belongs to the app and putting it on a specific control. That limits what you can do with the control across multiple apps.
Of course, if you're writing a control specifically for one and only one app, you don't need to worry about these things. But I would still consider it a bad practice, myself.