Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Anyone using MS Word 'Forms' as input documents?
Message
From
25/09/2006 10:15:42
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
25/09/2006 09:25:41
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01156885
Message ID:
01156906
Views:
25
This message has been marked as the solution to the initial question of the thread.
>NOTE: I am repeating this in the VFP forum and the Office forum.
>
>I have a requirement that would be best addressed by using MS Word's "Forms" capability (or possibly a similar feature of MS Excel if it exists) as the input method for the users.
>
>I believe that Word's "Forms" feature allows output to a .CSV file that I could pick up and process. I suppose that I might even be able to simply scan through all of the form 'fields' and pick up the content that way.
>
>I am a complete NOVICE when it comes to this stuff... I don't know the characteristics/limitations of Word's "Forms" especially.
>
>I have 4 basic requirements:
>1) The user must be able to revise the general layout of the document without changing the 'content' of the "fileds" defined.
> - I am prepared to simply tell them that "fields" are sacrosanct as regards content (names, defaults, lists content, etc)
>2) I must be able to transfer any "fields" 'answered' into my database.
>3) I must be able to fill in their (prior) 'answers' if they re-display the form.
>4) I must be able to display the form and its 'answers' but PREVENT further changes if they have "signed off" the form in question.
>
>Note, too, that this "form" would be used multiple times for either the same 'entity' of the database or different entities.
>
>What are my chances? ... Is this worthy of further development or are there some gotchas that preclude this approach?
>
>Thanks

Jim,
Word forms handling is simple. ie:
Assuming you created a wordforms.dot as a template with one textinput,checkbox,dropdown on it (default names) and saved. Later saved a wforms1.doc based on that template:
CLEAR
LOCAL oWord,ix
oWord = Createobject("Word.Application")
With oWord
	*.Documents.Add("c:\temp\wordforms.dot") && if is new
	.Documents.Open("c:\temp\wforms1.doc") && open existing
	.Visible = .T.
	.Activate
	With .ActiveDocument

		* Get
		For ix = 1 To .FormFields.Count
			? .FormFields(m.ix).Name,.FormFields(m.ix).Result
		Endfor
		* Set
		.FormFields("Text1").Result = "My Text"
		.FormFields("Check1").Checkbox.Value = .T.
		.FormFields("DropDown1").Result = "My DD" && auto added if not in list
		
		For ix = 1 To .FormFields.Count
			? .FormFields(m.ix).Name,.FormFields(m.ix).Result
		Endfor
	Endwith
Endwith
As you can see fieldnames serve as "bookmarks" for form fields and you use result/checkbox.value to get/set them. If users wouldn't save the docs then you could bind to word events and get form field contents.

However, IMHO HTML management is easier and have rich content. Word could open HTM and you don't need word to be installed with HTM approach.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform