?
Solved

Document Generator?

Posted on 2003-02-27
4
Medium Priority
?
191 Views
Last Modified: 2013-12-03
Hello

I'm trying to make a document generator. What I want to be able to do is have a user have 3 options from the start, Make a new document, Load a saved document, and Delete an Old Document. If the user makes a new document (the main part of the program) then a wizard pops up and walks them through it. They'd be able to write the document title in a textbox, the author, etc. All in text boxes. When the wizard is complete, it takes all the data from those text boxes and puts it into a document that can be printed/saved. Any ideas on how to implement this?

One other thing I should note. The main part of the document is structured around dates. I've already programmed this, but when a user clicks a date on a calendar, it adds the date to the data and would then put that on the document. So if the user clicks 5 dates: 2/1, 2/2, 2/3, 2/4, and 2/5; it would put the following on the document:

2/1:
etc

2/2:
etc

2/3:
etc

2/4:
etc

2/5:
etc

What I'd like to do is create forms at runtime for however many dates the user clicked, so that they can edit the "etc" data for each date. So, using the above example, if they clicked 5 dates, 5 forms would be created at runtime that had textboxes on them to edit what went under that date.

Any help would be great.
-Veniferx
0
Comment
Question by:Veniferx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 

Expert Comment

by:RMatzka
ID: 8036620
It is not quite clear for me what exactly your problem is. Obviously, you have these tasks to solve:
1. Code the wizard user interface
2. Format the data as they are needed in the document
3. Write the document
Maybe you could state in which area your problem is. Or is it in all of them?

As to your specific question at the end, you need to understand that coding a form is more or less the same as coding a class, and that at runtime you create one or more instances of this class. So once you have coded the  form for editing the "etc" stuff, let us say you called the form "fEtc", at runtime you create and display as many instances of this form as you like through code like
dim f as fEtc
set f=new fEtc
show f
where f holds a pointer to an instance of the fEtc form.
0
 

Author Comment

by:Veniferx
ID: 8036688
Thanks RMatzka.

What my problem is is
1 2 and 3. I've written simple documents before, but nothing on the scale of what I want to do, with formatting and all. I'd like some pointers or maybe code examples on how to do it. Has a similar program been made that's open source so I could take a look there and learn from it?

I have most of the wizard coded already, I just need to know how to transfer the data from the textboxes to some kind of temporary file to be loaded into the document, or just loaded directly into the document. I also need to know how to format it. Should I create a template and then replace things with the data that the user put it? Or should I create it on the fly?

I guess you could say I'm just inexperienced and maybe have bitten off more than I can chew, but I need to start somewhere. Like I said, any help would be appreciated.
0
 

Accepted Solution

by:
RMatzka earned 300 total points
ID: 8037314
I Don't know about examples, but can try and give you a few hints.
1. The best way to code a wizard UI is as a wizard loop. Each time the user clicks Next or Back, another round of the loop starts. You could e.g. have an array of frames without border, all of the same size and position, and the simplest way to  control which one is visible is by calling its ZOrder method. And you have an index variable which is incremented when the user clicks "Next" and decremented when she clicks "Back", so you know which page should be shown in the next round of the loop.
2. Let me assume your document is going to be a .txt file. If it were to be a Word document, things are more complex. The easeast way to prepare the contents of a text file is to have a string array, and prepare it thus that each field in this array is meant to be one line in the file. Use ReDim Preserve if you don't know the number of lines in advance. Formatting a line is then not much more than simple string manipulation, using "&" and string manipulation functions such as "String": e.g. you use String(10," ") if you need to insert 10 blanks, or you use s=s & String(10-len(s)," ") if you need to fill up the string in s with blanks such that the whole thing fills 10 character positions. Also, for dates and other numeric data, the Format function is very useful, although it has its intricacies.
3. That's the easy part.
Dim sFile as String
Dim iFile as Integer
Dim iLineNo as Integer
Dim sLines()as String
... assume sLines() has been prepared as explained above
... assume sFile contains the path and filename to write
iFile=Freefile
Open sFile For Output As iFile
iLineNo=0
For iLineNo = 0 To UBound(sLines)
 Print #iFile,sLines(iLineNo)
Next iLineNo
Close iFile
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 8983839
Hi Veniferx,
It appears that you have forgotten to close this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept RMatzka's comment(s) as an answer.

Veniferx, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept THIS comment as an answer.
==========
DanRollins -- EE database cleanup volunteer
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month7 days, 23 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question