473,396 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Help with Dynamic document generator

Hi All,
I have a general question. I'm in the process of designing a app that will
allow user to enter data for Medical forms and print the corresponding word
doc. I have about 100 forms I have to do this for. And I'm looking for ideas
that will help with my design. I'm trying to make this code as general as
possible, so that as they add/delete forms, it will make it as simple as
possible for both me and the user.
What I have so far:
I've created a xml file (still have not gotten the final design of the xml
file) that contains the the following:
<LookUp>
<ControlType>C1ComboBox</ControlType>
<DBField>PatientName</DBField>
<BookMark>PatientName</BookMark>
<ControlName>cmbPatient</ControlName>
<ColumnIndex>1</ColumnIndex> 'Optional
<Values VALUE="0" BookMark="Goal1Progress"/>'Optional
<Values VALUE="1" BookMark="Goal1Progress"/>'Optional
</LookUp>
I have a Lookup key for each field on the word document. The ControlType is
the type of control assigned to the word field. DBField would be the database
field (not used yet). ControlName is the name of the control on the data
entery form. ColumIndex is for special use. The Value keys are used with
comboboxs when using the SelectedIndex of the control to match up with the
bookmarks in the word doc. If a textbox was used, the Values key would be
replaced with one Bookmark key.
What the class does so far is to read in the xml file and based on the
values in the xml file, grabs the data off the form and inserts the values
into the corresponding bookmarks in the word doc. The class has a Print
function that does most of the work as follows:
Public Sub Print(frm as Form, ConfigFile as String, WordDoc as String )
Dim al As New clsReportElements
Dim ReportElement As New clsReportElement
Dim wdApp As Word.Application
Dim ReadXmlFile As NarcoFreedom.MTTP.clsReadXmlFile
Dim Ghost As New Control
Dim tCombo As AxTrueOleDBList80.AxTDBCombo ' C1ComboBox
Dim tTextbox As TextBox
Dim tCheckbox As CheckBox
Dim tDatePicker As AxMSComCtl2.AxDTPicker

ReadXmlFile = New NarcoFreedom.MTTP.clsReadXmlFile
al = ReadXmlFile.Run(ConfigFile)
doc = ThisApplication.Documents.Open(FileName:=WordDoc)
ThisApplication.Visible = True
ThisApplication.WindowState = Word.WdWindowState.wdWindowStateMaximize

For Each ReportElement In al
Select Case ReportElement.ControlType
Case "C1ComboBox"
Ghost = FindControl2(ReportElement.ControlName, frm)
If Not Ghost Is Nothing Then
tCombo = CType(Ghost, AxTrueOleDBList80.AxTDBCombo)
doc.FormFields.Item(ReportElement.BookMark).Result = tCombo.Text
End If
Case "Textbox"
Ghost = FindControl2(ReportElement.ControlName, frm)
If Not Ghost Is Nothing Then
tTextbox = CType(Ghost, TextBox)
doc.FormFields.Item(ReportElement.BookMark).Result = tTextbox.Text
End If
Case "CheckBox"
Ghost = FindControl2(ReportElement.ControlName, frm)
If Not Ghost Is Nothing Then
tCheckbox = CType(Ghost, CheckBox)
doc.FormFields.Item(ReportElement.BookMark).Result = tCheckbox.Checked()
End If
Case "DTPicker"
Ghost = FindControl2(ReportElement.ControlName, frm)
tDatePicker = CType(Ghost, AxMSComCtl2.AxDTPicker)
doc.FormFields.Item(ReportElement.BookMark).Result = tDatePicker.Text
End Select
Next ReportElement
doc.Activate
doc = Nothing
End Sub

What do you all think of what I have so far. With the creation of this
class, I'm hoping that it will make it easier to work with, reduce duplicate
code (by not needing all that code in every form) and make it quicker to
setup a new data enter form.
Has anyone seen any articles on doing things like this. I could use any help
on the subject. Thanks again.
Michael Lee
Nov 21 '05 #1
0 2420

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Timothy Stark | last post by:
Hello folks, I am working on my program and was trying to implement 'dynamic' classes by using virtual function calls but it did not work. I want to convert from 'class test1' to 'class test2'...
9
by: Gb | last post by:
Hi, just a quick (maybe stupid) question .. Can be possible to link a table dynamically using this logic?: --@@@ SQL START SELECT Value as myvar, m.field1,m.field2,m.field3 FROM -- I want to...
0
by: serge calderara | last post by:
Dear all, I am new in asp .net, the whole de of course is making web site. Then I have question relatif to the content of a web site. I have heard people talking about "dynamic content" what dos...
4
by: Mr. Smith | last post by:
Hi. What's the correct syntax here: (given the recordset myRS with x records do until myRS.EOF txtvar & myRS("serial_number") = myRS("serial_name") myRS.movenext loop ..asp will not build...
13
by: Raja Raman Sundararajan | last post by:
Hello guys, Is there any nice library to generate word documents using Python. As of today I am generating a HTML document and then open it with MS Word. But the problem is that I am not able...
2
by: Christina | last post by:
Hello !! I am creating a dynamic textbox and want to validate it using the requiredfieldvalidator. These are the steps which I tried: ==================================================== 1)...
0
by: Bruce | last post by:
Can the XML Document Generator ignore selected header files? Can I somehow keep it from crawling in to selected header files? If so how? -- Bruce E. Stemplewski GarXface OCX and C++ Class...
1
by: Velvet | last post by:
I have been developing ASP.NET applications. In 1.1 I added a <remarktag for each class and inside it I added my modification history (HTML formatted). With the built-in function that allowed me...
4
by: Sep410 | last post by:
Hi all, I have to create a dynamic report in vb.net. I never had done something like this before.Users want to see tables name and when they choose the table they will select which fields should...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.