Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to get rid of excel

Status
Not open for further replies.

VBakias

MIS
May 24, 2005
219
GR
Hi all

I 'm about to start an app that the user will enter some text and numbers. There is also a mask that i've made with excel. The purpose of the app is: As all data are valid they will be entered in the excel sheet and printed.

This requires user to have excel installed on the pc.

Is there any way to copy the output mask (that in excel which will be printed) in a report or somehow to create the "mask" differently so i don't need excel?

Tnx
 
Hi,

you did not understand me. :)

I want to print a page. I'll use excel to create the interface of it because it is very simple and with excel i can create a very good to_be_printed form. So my app will need this xls file to open it add data to some cells and then print it (and quit discarding changes). The app won't work if the user have not installed the MS Excel.

What i'd like is: Create the form or report that i'll print in excel and then copy and paste it in the app, so as to get rid of excel.

Tnx
 
You could load the Excel worksheet into a datatable using OLEDB, then bind the datatable to a grid, and use the grid for editing and printing.

Andrea
 
Tnx for the reply.

If it is not trouble for you or anyone else, i'd need some help on this. I've never worked with databases, or better data*


According to your post, excel's installation is not required?
 
Yes, if you use OLEDB, you don't have to have Excel installed. You can use something like this to load the worksheet into a datatable.
Code:
Dim cnnString As String
Dim cnnExcel As New OleDbConnection
Dim daExcel As OleDbDataAdapter
Dim dtTemp As New DataTable

cnnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & ExcelFileName & ";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"""

cnnExcel.ConnectionString = cnnString
cnnExcel.Open()
selectCommand = "SELECT * FROM [" & WorkSheet.Text & "]"
daExcel = New OleDbDataAdapter(selectCommand, cnnExcel)
daExcel.Fill(dtTemp)

You can find more information about the connection string's extended properties at
Visual Studio help is a good place to start if you need information about working with datatables.

Andrea
 
andreas,

i somehow will run this code.
I'll have to run it every time so to fill the data table... so i need the excelsheet at any case. Please tell me i'm wrong
 
I'm not sure what you mean. If you want to read the Excel worksheet, you have to have the Excel file stored in some place that is accessible by your app, but you do not have to have Excel installed to read the file.

Andrea
 
I wish the excel sheet not to be available.

Anyway...

Example: If i create a crystalreport project and compile it, the exe file will contail the report (.rpt file). I had thought of somehow to create the same interface of the excel's sheet as a crystal report. Then fill in the user data and print it.

This may not be possible. Any other way/ideas ?

I would like:
- my app to print the page without involving any other programs like excel.
- the file not to be available.

(I mentioned excel as a way to design the page that will be printed because it is eazy to use)


Tnx :)
 
I don't know of a way to use Excel to design a form in VB. If you're not reading any Excel data, why not just use a grid control for entry and print from the grid? I use Developer Express XtraGrid and XtraPrinting for things like this ( Other grid components probably have similar functionality.

Andrea
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top