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 communicate with Excel in the clipboard?

Status
Not open for further replies.

coolago

Programmer
Apr 24, 2001
22
CN
Now we have an equipment maintenance module that helps our guests to store and track all the equipments they had, but now the problem is that our guests require the Equipment Paste function. E.g. every month they will receive an excel document from their colleagues which describes the latest equitments information. So they maybe copy some of the rows from the excel sheet and paste it into our system. We have a web page that displays all the equipments and we'll put a 'Paste from Excel' button/function in this page to meet our client's need.

But how can we read the excel cells in the clipboard so that we can insert them into the database?

Btw as it showed upon, it's a web based B/S system, and all the users access our system by Microsoft's Internet Explorer.

Thank you very much for your reviewing my problem and for your so kind help! Thx!
 
hi Coolago.
To make this, you can directly export Excel cells data to a web page using activeX controls in a javascript.
example :

--------------------------------
<script language=&quot;JavaScript&quot;>

var Excel_File_Obj; //variant declaration
var cell_value; //variant declaration

Excel_File_Obj=new ActiveXObject(&quot;excel.application&quot;);
//Activex Object creation//

Excel_File_Obj.visible=false;
//ActiveX parameter to show or hide the Excel file during operation//

function data_cell_export(y,x){
Excel_File_Obj.Workbooks.Open(&quot;C:\\fiche.xls&quot;);
var cell_value = Excel_File_Obj.ActiveSheet.Cells(y,x).Value
document.write(cell_value);
}
//the function : opens the file then gets the value of a cell then writes it in the web page.//

</script>
</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;
onload=&quot;data_cell_export(18,2)&quot;>
//launches the function with the coordinates of the cells to be exported to the web page.
--------------------------------

My english is not very good, so if you do not understand everyting, do not hesitate to mail me.
If you search &quot;Workbooks.Open&quot; or &quot;ActiveSheet.Cells&quot; in an internet search engine you may find all the properties concerning these activeX controls.
good luck.
Pierre.
 
lntk:
Thank you very much! It looks like that we cannt implement the just Equipment Paste function in b/s pages but ur article is very helpful to us.

Now our client has to save the upon copied excel rows as an independent excel file firstly, e.g. C:\\InsertEquip24Jun2003.xls. Then the system'll popup a file selection dialogue when he click the EquipInsertFromExcel function/button. When this done and the form submitted we'll upload the excel document to the server firstly, then parse it and insert related equipments into the database lastly.

So, we're now planing to adopt your advice and display the whole rows in the client firstly instead of uploading it. Thanq very much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top