473,396 Members | 1,995 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.

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 2827
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Faith | last post by:
Hello. I need to take a column from Excel(unknown amount of rows) that will be selected by the user and copy those cells. Then I will need to paste those cells into the first column in a Data...
3
by: EMW | last post by:
How can I put everything that is in a datagrid into a SQL server database (which should be readable by an PocketPC program)? There is probably a simple solution for it, but as always it is...
3
by: zxo102 | last post by:
Hi there, I need your help for python <--> excel. I want to paste selected cells (range) to different location on the same sheet in Excel through python. I have tried it for a while but could not...
1
by: http://www.visual-basic-data-mining.net/forum | last post by:
I have a web form in which I have a datagrid, I need to export this data to a Microsoft Excel sheet. I'm doing it thus: Response.Clear();
0
by: madhavit | last post by:
hi, i am able to export datagrid data to excel sheet but the problem is i am not able to export datagrid within datagrid data to excel. can anybody help me. thanx.
0
by: Sridhar | last post by:
Hi, I am having trouble renaming the excel sheet while exporting to excel. we have a datagrid that contains some analytical data. I have the name to the excel file as "temp.xls" inside the code....
1
by: dom_perron | last post by:
Hi, I have a problem when I want to paste data from a workbook to another in excel using the clipboard. Each time a try to paste the data in the active sheet I got an exception "Microsoft Office...
0
by: six888 | last post by:
i need to make a report using excel. im given a few data in excel document for a 1 month report (1 document for each week). each data document have a few work sheet.i need only certain information in...
2
by: deve8ore | last post by:
Hello, I'm working with Adobe Reader 8.0, working on a project for work, so not allowed to download any other software/ freeware. We receive PDF files frequently with about 20 sheets. I'd like...
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
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.