Hi,
I need to take information from two columns of a data grid (all numbers) and
enable the user to create an xls file.
I have already written code so the user can read a text file containing a list
of data (numbers) and place the list in a data grid view
Count is the length of the text file, and lines() is where each line of the
text file was read into a 1 dimensional array
For count = 0 To count - 1
dgv1.Rows.Add()
dgv1(0, count).Value() = count
dgv1(1, count).Value() = lines(count)
next count
How do i create an excel file (*.xls*)
Many Thanks,
ANdy

XLS from data gride view VB.net 1005
Shrek.NET
Hi
There are probably two realistic client-side approaches for creating an excel file, and the one you choose depends on what functionality you require from excel (eg computed cells, graphs etc).
For a straight forward, "take these values and put them in an excel worksheet" I would probably think about writing out a CSV file from your application and shelling that to excel (or for that matter any other application that supports csv). This method removes any requirement for excel to be running on the same machine as your application.
The other option is to reference the excel automation runtime from your application and use its object model just like you would any other referenced assembly. Here's a link to an example ... http://articles.techrepublic.com.com/5100-3513_11-5815515.html
From the contents of your post, I'd go with the csv suggestion ... keeps things very simple for you on the development and deployment fronts.
Good luck
Richard
steve brsk
xplosiv_1,
What is the meaning of create an excel file (*.xls) Do you want to add a reference as a xls file or import data from excel to DataGrid or the opposite Actually your question confuses me with creating xls file.
Because we can create xls file in Microsoft Office Excel, then use the certain VSTO, classes and methods to read/write data in .NET Framework.