inherit
*this CT deserves an achievement*
136400
0
Jun 25, 2021 18:23:00 GMT -8
Trill
hola
6,232
January 2009
ghbraingle
|
Post by Trill on Sept 23, 2010 14:37:19 GMT -8
Hi I'm looking to create a form-type program (not web-based) that will input data from a user-submitted form into a Microsoft Word document automatically. I'm very, very new to creating programs, so if you could, please dumb your answers down a little Basically, the user opens up a program and is given form fields such as "Name 1" "Name 2" "Description", etc. Some are short lines (names), whereas other input fields are like textareas. When the user opens this program and hits the Submit/Save button after completing the form, all the data is inputted into an already-formatted Microsoft Word document (using a macro may be necessary?). When the form data is automatically inputted in the document, the user can then save, print, send, etc just like any other Word document. I really don't know how I'd do this, but maybe if there's an existing document on the server with the formatting and everything done for the doc template, there could be placeholders within the doc that are replaced with the form data once it's submitted. I'm hoping that this could be done in Java or Python (Java has a slight preference, and if another programming language is better, let me know). I know this is a little vague, so let me know if any other details are necessary. Any assistance would be very much appreciated! Thank you!
|
|
#00AF33
14306
0
1
Sept 8, 2023 8:54:17 GMT -8
Jordan
What is truth?
11,838
October 2003
jab2
|
Post by Jordan on Sept 23, 2010 14:47:22 GMT -8
I recommend C# since it's one of Microsoft's languages and you an easily work with word documents, but anyone who uses your program will have to have the .NET framework installed. I got this from a Google search. support.microsoft.com/kb/316384There's more if you just search for "open microsoft word c#" or "microsoft word C#". You could do it with other languages, but it would be easier with a MS language in my opinion. Edit: Here's a link for using Java: j-integra.intrinsyc.com/support/com/doc/other_examples/Word_from_Java.htm
|
|
inherit
*this CT deserves an achievement*
136400
0
Jun 25, 2021 18:23:00 GMT -8
Trill
hola
6,232
January 2009
ghbraingle
|
Post by Trill on Sept 23, 2010 17:52:23 GMT -8
Thank you Jordan. That microsoft link was helpful. C# does seem to be a viable option for the programming language to use for this project. Coincidentally, I came across the same link in your edit for Java but that seems a bit over my head. The Microsoft article seems to do a better job of explaining how it works. I think I'll start with the C# method. I'll let you know how that goes. Hopefully I can at least get the code started before I need more help. Thanks for your help.
|
|
#00AF33
14306
0
1
Sept 8, 2023 8:54:17 GMT -8
Jordan
What is truth?
11,838
October 2003
jab2
|
Post by Jordan on Sept 23, 2010 18:22:30 GMT -8
Edit: You modified your post but I basically gave a brief overview of what you have to do.
First you'll need to download Visual Studio 2010 Express for C# since it's free. Then you'll need to make the form with the form designer which shouldn't be too hard, but if you haven't had any experience it make take a little time to figure it all out.
I currently only have Visual C++ 2008 installed, but it should be similar. Create a new project, then select CLR in the left hand menu, and then select "Windows Form Application". Basically you need the option which creates a windows GUI.
After VS finishes thinking after 20 years you'll be brought to the form designer. Select the toobar from the left or right of the screen and pull over some labels, a text box, and a button. You'll want to set their ID's (name) and other settings (text) by right clicking and going to Properties. Something like titleLbl, messageTextBox, and submitBtn for the name's would be good. That's what you will access them by in your code.
Then double click an item and you will be taken to the call back function which is called when an event occurs for that object.
That's an extremely quick overview of what you have to do so you will probably need to look up some tutorials. .NET has a ton of resources available for you so you won't really have to create anything yourself, you just have to code the callback functions.
Your "submitBtn" callback function would basically take the text from your textarea, create a word document, and then insert that text however you want it to be formatted.
|
|
inherit
*this CT deserves an achievement*
136400
0
Jun 25, 2021 18:23:00 GMT -8
Trill
hola
6,232
January 2009
ghbraingle
|
Post by Trill on Oct 10, 2010 14:27:22 GMT -8
Sorry for the delayed response. I've been working with the program but haven't had enough time to really take a good long time to get everything formatted properly. Thanks for the information. It was really helpful! I currently have a program that can take the submitted data and put it into a word document. However, formatting the document as a whole is difficult as there would be tables and other 'advanced' layout items. Rather than creating these layouts in the program, do you think it would be more beneficial to have a pre-formatted, saved template to use instead of generating a completely new word document? Thanks!
|
|
#00AF33
14306
0
1
Sept 8, 2023 8:54:17 GMT -8
Jordan
What is truth?
11,838
October 2003
jab2
|
Post by Jordan on Oct 11, 2010 13:15:45 GMT -8
Since I haven't worked with the Word API in C# it's hard to say, but I think that if you create a method for each type of format it wouldn't be too bad. createTable(), createList() etc.
If you have a section that needs to be organized into tables, then you'll just need two for loops to generate the table into rows and columns. They key is to set up your form to where you know what is what so you can easily extract the data and place it in its correct place. The .NET framework has a lot of resources available that can help you in this process such as Regular Expressions.
If you post some code or pm me I should be able to help you out. I have two mid terms on Wednesday so I'm going to be a little busy for the next two days, though.
|
|