Foreword: I want to allow users to define high quality document templates and then inject there data from our information system and print the result. I think MS Word is a great starting point, because this work is aimed to business letters etc., not data reports.
Question: Is it possible to add a custom field provider to MS Word?
I don't have English MS Word, so I must try to describe what I mean in a few sentences. Normally we can insert "fields" like author name, current date etc. These fields work seamlessly. We can switch view of fileds between data and definition. Definion of author field looks like this: { AUTHOR \\* MERGEFORMAT }.
Now I want to inject external data into documents and let user specify where to put them. A user should define a document template and mark spots where external data should be injected. Since Word users generally aren't IT experts, the easiest way for them is to use some macros or "insert field" option to do it. So I want to define my own set of fields and connect Word to my custom field and data provider. How to do it? I am unable to find any documentation on this.
I think this approach is better than using sql database connection or something like that, because I want to let the external source define list of known fields and their values, not the docx document itself. Also, data source won't actually be an sql database.
Yes you can do this by using Custom Document Properties as placeholders and then use some VBA code to set those properties to whatever you want. You can get the data via ODBC or from an Excel spreadsheet or from a text file.
First of all, experiment manually by going into File, Properties and creating some custom properties. Give them a value and then, in the document, insert some DocProperty fields. If you can't find DocProperty in your language version of Word then look through a list of the fields like Author etc. Since field names are visible to end users they might have been translated.
Then in order to complete your document template, create a VBA function that uses SetProperty. Read this article for more details. It is up to you whether the VBA is triggered by opening the file or whether you add a menu item to do that.
No need for special controls or any commercial add-ons. I'm going to add a VBA tag to your question since this is really a VBA programming question. In fact, this has been possible since Word for Windows 1.0.
Using SetProperty in VBA is a bit more complex now. I got the following snippet of code from this forum posting.
object docProps = wdDoc.CustomDocumentProperties;
Type docPropsType = docProps.GetType();
object Prop = docPropsType.InvokeMember("Item",
BindingFlags.Default |
BindingFlags.GetProperty,
null, docProps,
new object[] {propName} );
Type PropType = Prop.GetType();
PropType.InvokeMember("Item",
BindingFlags.Default |
BindingFlags.SetProperty,
null, docProps,
new object[] {propName,propValue} );
Absolutely, this is the exact kind of scenario that Content Controls and CustomXMLParts were built for (Word 2007/2010 only, not earlier .doc format).
Most of the Word Developer Center home page deals with these two: Content Controls and CustomXMLParts. If you go this route, you'll find the Word Content Control Toolkit an invaluable resource as well, especially when just starting out.
From an end-user perspective, it could be as simple as just creating buttons on the Ribbon for insertable Content Controls via a template or document add-in (VSTO or VBA).
If you want a fairly decent prebuilt solution, check out Windward reports.
Yeah, the name makes it sound like a reporting tool, but in reality, it's exactly what you're describing. They have a Word add in that allows users to easily mark up a word doc with fields to be inserted from your data source.
I built a very similar system for a law firm. Windward didn't do quite everything I needed it to do, but at the same time, it's pretty powerful.
Related
Similar to the functionality of using a form formula in a view, I would like to figure a way to provide someone with a link to a document via a URL and have it open in an alternate form. I'm trying not to modify the actual form value on the document, that gets messy to keep straight.
The form is a very complicated form with tabbed tables and 90% admin data, but I would like to turn over the maintenance of just one small set of fields to the user community without them seeing everything else.
Is there a way to force a link to open it BY WAY OF A VIEW that has a form formula? That is what I am thinking. Either that or I create/populate some smallish document when providing the link, then send them a link to this smaller document and have it update the 'parent' in it's webquerysave event.
Thanks,
Matt
If you want to open the document in Notes, you could try to send them a notes-URL, in the form of
notes://yourServer/yourDatabase.nsf/yourView/yourKey?OpenDocument
I remember having a conversation about this with one of the original developers of the Domino web server many, many years ago -- but I wasn't 100% certain that I remembered the answer correctly. So, I just searched through my old documents looking for a draft of the article I was writing when I had that conversation (in 1997!). It turns out that I didn't cover it in that particular article, but I did cover it several years later in one of the chapters that I wrote for the Lotus Notes & Domino 6 Programming Bible
You may be wondering why, since a UNID uniquely identifies any note, is it necessary to include both a Document UNID and a View UNID in a URL. The same question actually applies to doclinks, which were discussed above. The truth is that you don’t have to include a View UNID in either case, but it does serve a purpose if you do. You can replace the View UNID in a URL with a zero, retaining the slash characters that surround it. If you do this, Domino will not be able to execute a Form formula, which you may have included in the code of one or more Views in your application. See chapter 15 for more information about Form formulas.
In other words, if you include the UNID of a view that has the Form Formula that you wnat in the ?OpenDocument URL that you are sending to the server. The Form Formula will be respected.
I have an application that lists multiple Word and Excel files so when the user double clicks on one, it opens and can be edited. I want to give the user permission to edit or not.
I searched a lot and what I came up with so far is
ProtectedViewWindows.Open(mFolderPath)
Process.Start(myDocPath)
But it gives me the error:
Reference to a non-shared member requires an object reference.
This error message means, that Open isn't a shared function in the ProtectedViewWindows class, so you have to create a ProtectedViewWindows object, before calling Open on it.
Something like:
Dim pvw As ProtectedViewWindows = New ProtectedViewWindows
pvw.Open(mFolderPath)
Process.Start(myDocPath)
Maybe the constructor of ProtectedViewWindows expects one or several parameters.
ProtecfedViewWindow is not something you're supposed to use to prevent the user from editing the document. This is functionality built into the Office application to open documents from untrusted sources. The explanation in the Excel language reference is somewhat clearer on this point; you might want to read What is Protected View, also.
So the answer to your implied question is: You can't do what you want using this part of the object model.
Neither Word nor Excel is designed to function as a "Reader" - they're editors. If you want users to read, only, then you need to look for a Reader. For example, save the files in PDF format so that they open in Acrobat Reader.
FWIW it's possible to protect all or parts of Word and Excel files using their respective protection mechanisms. This has to be applied to the opened files using the object models (or by editing the Open XML of the closed files).
Document object offers Protect method which take Protect Type argument and this Type derived from WdProtectionType enum which has following protection types can consider to prevent editing in a word document: code reference is taken from Protect document code example
wdAllowOnlyComments
wdAllowOnlyFormFields
wdAllowOnlyReading
wdAllowOnlyRevisions
wdNoProtection
Following is the code example that you may consider based on protection
oDocument.Protect(WdProtectionType.wdAllowOnlyReading,vbNull,"password")
I have to implement a Google Custom Search for a website. The website has different content types. One of them is a "publication". A publication consists of different fields:
Title
Author
Published date
Document
Document type
Document is the URL to a PDF, Text, MS-Word, etc. document. And Document type is, as you can expect, the document type (ie. PDF, DOC, TXT, etc).
I will need this information to be in the Rich Snippet because I have to format the search results differently for each document type (ie. include a different icon, etc).
What schema should I be using for that? I could not find information about how to structure data for that kind of content. Can I use anything from Schema.org? Or should I create my own? Any idea?
Thanks in advance for any input on that.
For customizing results snippets in Google Custom Search, it doesn’t matter which vocabulary you use in your RDFa. You could use an existing one (like Schema.org), or create your own, or use any combination of multiple vocabularies.
You can see the extracted structured data that can be used for this purpose in the Google Structured Data Testing Tool by clicking at "Custom Search Result Filters" (or by changing the results filter from "All data" to "Custom Search Engine").
You can fetch this structured data and create your own presentation layer.
As a tester, I'd like to know whether it is possible to restrict the manual creation of new objects by the user. The restriction should be done programatically in ABAP, not by removal of permissions.
Background information: we have quite complex objects which are hard to set up manually. Therefore we have implemented a wizard, which does all the condition checking etc. when creating the object. Also, if the wizard shall work, the user must have appropriate permissions to create the object.
Is it possible to remove the object type for that complex object from the list which appears when creating a new object (pressing the New button)?
As I'm only a tester for this part of our software, I can't show any existing code. I just got the feedback "It's not possible" and that's hard to believe for me at the moment. Usability really suffers, because people try to create those objects manually and can't make it work.
I also don't need a working code example, just a hint (class or method or setting) for the developer where to find a solution. I'll then insist that he implements it :-)
Update
Today, the user can click the "New" icon. Then, a dialog appears with 4 choices. 3 choices are for simple objects which he shall create like this. However, the first item in that list is for the complex object, which is impossible to create manually (why we have the wizard). I'd like to know whether it is possible to remove that item from the list programatically.
ᵺṓᵯᶏᵴ, the information you have provided is still a bit vague. However, here is an idea that may work for you.
It might not be possible to completely automate this process, but you could ask your developer to enhance the code that processes the New button, so that it would reject any attempt to bypass the wizard for the first item on the list.
Your developer can tell you if it is feasible in your case, to have the enhancement raise an error (message of type E) to stop the user from proceeding.
This would have to be combined with end-user training to tell people to avoid the New button for that item, and use the wizard instead
ᵺṓᵯᶏᵴ, it looks like a custom dialog so it should be possible to remove it the option, alternatively if it is a standard dialog in a SAP app there is always a way to restrict it, it can be as simple as disallow entry from specific transaction codes. for example the developer could set a variable at the start of the wizard and then check for that variable when creating the object, if it not there he can show a dialog "Please use the Wizard we carefully crafted for your use......" Ok maybe you wont say all of that but you get it.
So the answer to your query is yes it can be done but the approach will depend on what it is your changing custom or standard object etc,.
Later..
I was just introduced to the concept of Outlook forms. I don't know if this will solve my problem but here is what I want to do:
I want to be able to have employees who are inside the company fill out some forms. So all I have to do is create the form and PUSH it to their Outlook? After they fill out the form, can I capture the data somehow? Has anyone does this before? Can someone recommend a good tutorial/examples?
Update: The Outlook->Access option seems like a great one, but it seems like the form must be emailed by someone. In other words, if someone wants to fill out any form they first have to be emailed a form. What if a person wants to just fill out a form? How would he do it if he has no access to the Access database?
Here are three options:
This page is a really good jump page for custom forms in Outlook. In fact, that whole site is pretty good with lots of examples and links like Outlook Forms Step-by-Step Tutorial.
However, if you also have Access 2007, I'd actually recommend something simpler and easier to create email forms that can be sent to users and collect back all of the information. Once I discovered this in Access 2007 I never went back to custom Outlook forms.
Basically, you create an Access db with the data you want to collect and then in the "External Data" tab in Access 2007, you click "Create E-mail" and a wizard will walk you through creating an email with the form in the body (which is either HTML or InfoPath, depending on which one you choose). You send this to your users (you can have a recipient list in a table as well in your Access DB) and they fill out the form (I used it for surveys) and then they click submit. It goes back to your Outlook in a special folder and as soon as you open Outlook, it will synch it with the database. Then you can slice and dice all of that database information.
Here are some great tutorials on this:
Demo: Collect data in Access 2007 by
using e-mail
How to integrate Microsoft Access
and Outlook 2007
Finally, if you just want to collect back much simpler information, like "Yes", "No", "Maybe", the easiest way is to create voting buttons. Go to New Message -> Options - Voting Buttons. You can customize this if needed by separating your choices with a semi-colon ;.
In #2 and #3 above, these are scenarios to initiate data collection.
There are other situations where someone doesn't need a prompt via email to fill something out right there, but rather just submit a form (like an expense report, or a gas mileage report). #1 above (Outlook custom forms) is generally better choice in that scenario, but:
Outlook forms have typically been
harder to deploy and teach people to
use (there are things like "public
forms", "private forms", etc.)
Outlook forms have been, in practice,
been replaced by other technologies.
In particular, InfoPath/Forms Server and
Sharepoint Forms. This is because neither
of those two technologies requires
users to do a whole lot other than
follow a link to fill out a form. I used to know, about 10 years ago, many companies who tried to use Outlook forms and most of them gave up development of them in favor of other technologies.
This isn't to say that Outlook forms are bad in any way. If you don't have other technologies available to serve as a Forms Server, then this could be a decent option to consider.
To look at other semi-lightweight ways of form submission, you can use MS Word templates as the front end and have them update an Access DB. Here are a couple of good articles on this:
Import Data Directly from Word
Forms to Access Tables
How do I... Transfer data from a
Word form to an Access database?