Newbie...Advice on best approach needed!!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can anyone tell me if it is possible to produce a MS Word like document in a vb.net application. i.e. i want to produce an invoice in my application. All the data is gathered in my application at runtime via comboboxes and various other controls. All the data is pushed to tables in my dataset. I want the values that are in my dataset to be written out to a document that i can print. This will form my invoice

CAn anyone recommend a good way to do this
I dont know the best way to achieve this objective so any advise would be fantastic.
 
You could just build your page data in an HTML table of a specific width
that you know will fit within a printed page.

Most web sites that offer a "confirmation page" to be printed usually just
do this.


Cantas said:
Can anyone tell me if it is possible to produce a MS Word like document in
a vb.net application. i.e. i want to produce an invoice in my application.
All the data is gathered in my application at runtime via comboboxes and
various other controls. All the data is pushed to tables in my dataset. I
want the values that are in my dataset to be written out to a document that
i can print. This will form my invoice.
CAn anyone recommend a good way to do this?
I dont know the best way to achieve this objective so any advise would be
fantastic.
 
Hi Scott

I am creating a windows application using VB.NET. Is there a similar way to do this for a windows app?
Sorry i forgot to mention this in my previous post :)
 
Oh, sorry. For that, I would use the CrystalReportViewer and/or the
ReportDocument control.
 
Thx scott,

I have just looked into this option.
The problem i have is that i cannot see the dataset that i am creating at runtime in the list of datasets that i can use to create my report. I can only see a list of datasets that are created at design time. Do u know how i could make use of this runtime created dataset to create my report. Do u know of any examples of where this is done?
 
Your original idea was a good one that I have used.

First, create your template invoice in Word. Set up bookmarks at each of the places where you have put in the dummy data. Now record a macro and move to each of your bookmarks and put in a little bit of dummy data, ie 999 or ABC. When you are done recording your macro copy the resultant VB into a VB.NET project subroutine

You will have to create a word object in your VB. Then use VB to fill in the information wherever you put in the dummy data.

This takes a little work but is very flexible and works extremely well

Steven
 
Hello Steven

thx for your input. Do you happen to have an sample of how to go about doing this? I am new to VB.NET and need as much help as i can get :
Any useful material/sample apps etc would be appreciated

I have been killin myself over this problem for ages so would be great to try and get it going

A few questions

I will not know how much data will need to be included in my invoice. i.e a typical invoice may like like so. (i have made up data to simplify example

Addres
Client Nam

Dat

Hotel rooms Booke

RoomNo:1 Days stay: 5 Size: Single Cost: 20 x 5 = 10

Room Service
Coke x 2 Charge: 1.00
DVD x 5 Charge: 10.0

RoomNo:2 Days stay: 5 Size: Double Cost: 30 x 5 = 15

-----------
261.0

As you can see here that the user can book many rooms and may or may not order room service. The word document therefore needs to be flexible
Before i proceed looking into this method, will this level of flexibility be possible
the total's will need to be calculated dynamically
For this would a crystal report or a word document be better suited

Thx
 
I think you need to be VERY careful here.

The code that the macro recorder in Word creates is VBA (based on VB 6.0),
not VB.NET and although it may function in .NET, you may be using older
legacy code rather than new and more efficient VB.NET code. Or, depending
on what you do when recording, it may not work at all in .NET.

Also, you are talking about creating an instance of Word so the machine that
runs this app. must have Word installed on it. If you are talking about a
web application, you are building a memory management nightmare.

There are much better ways to prepare printed output from an application
(crystal reports, rich textbox, web page, .pdf file) etc.


sburns said:
Your original idea was a good one that I have used.

First, create your template invoice in Word. Set up bookmarks at each of
the places where you have put in the dummy data. Now record a macro and
move to each of your bookmarks and put in a little bit of dummy data, ie 999
or ABC. When you are done recording your macro copy the resultant VB into a
VB.NET project subroutine.
You will have to create a word object in your VB. Then use VB to fill in
the information wherever you put in the dummy data.
 
Back
Top