471,854 Members | 1,577 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

how to paste datagrid data into excel sheet

TM
I have an Excel sheet where I setup my needed formatting, page settings,
ect, and would like to take my data from a datagrid and paste it into the
excel file and print the excel file.

Any idea how to do this ?

But. my other problem is my excel sheet if setup for two columns of
formatting, and I would like to paste the data into column 1 until it gets
to cell 30, then if there is more than 30 records, paste them into the
second column starting at the first cell.

Kind of hard to explain. But is there any way that I can do this ?
--
Tony


Nov 20 '05 #1
2 2697
Cor
Hi TM,

You can read the Excel sheet using Oledbd in a dataset.
Here I have 2 rough samples, (never tested)

sample connection string "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=xxxxxx;Extended Properties=""Excel 8.0;HDR=No"""
sample select string "Select * from [sheet1$]"
To get the Excel file from the dataset, is the most easy way is to write
the underlaying dataset from the datagrid as an XML file

\\\
dataset.writeXML("xmlfileTodisk")
///

And read that into your Excel spreadsheet.

I hope this helps a little bit?

Cor

I have an Excel sheet where I setup my needed formatting, page settings,
ect, and would like to take my data from a datagrid and paste it into the
excel file and print the excel file.

Any idea how to do this ?

But. my other problem is my excel sheet if setup for two columns of
formatting, and I would like to paste the data into column 1 until it gets
to cell 30, then if there is more than 30 records, paste them into the
second column starting at the first cell.

Kind of hard to explain. But is there any way that I can do this ?
--
Tony

Nov 20 '05 #2
TM
Oh sorry, I may have not explained properly.

My data is in an access database, read into a datagrid. I would like to
paste that into the excel file.

--
Tony

"Cor" <no*@non.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
Hi TM,

You can read the Excel sheet using Oledbd in a dataset.
Here I have 2 rough samples, (never tested)

sample connection string "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=xxxxxx;Extended Properties=""Excel 8.0;HDR=No"""
sample select string "Select * from [sheet1$]"
To get the Excel file from the dataset, is the most easy way is to write
the underlaying dataset from the datagrid as an XML file

\\\
dataset.writeXML("xmlfileTodisk")
///

And read that into your Excel spreadsheet.

I hope this helps a little bit?

Cor

I have an Excel sheet where I setup my needed formatting, page settings,
ect, and would like to take my data from a datagrid and paste it into the excel file and print the excel file.

Any idea how to do this ?

But. my other problem is my excel sheet if setup for two columns of
formatting, and I would like to paste the data into column 1 until it gets to cell 30, then if there is more than 30 records, paste them into the
second column starting at the first cell.

Kind of hard to explain. But is there any way that I can do this ?
--
Tony


Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Faith | last post: by
3 posts views Thread by EMW | last post: by
1 post views Thread by http://www.visual-basic-data-mining.net/forum | last post: by
1 post views Thread by dom_perron | last post: by
NeoPa
reply views Thread by NeoPa | last post: by
reply views Thread by YellowAndGreen | last post: by

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.