connect to client excel application
I want to open Microsoft Excel on a client machine.
Then add some data to a workbook and save the workbook on the users computer on a predefined place (without the user having to save the document).
I've only been able to write documents to a local path on the webserver, but not on a client. My Boss keeps saying it is possible, but i can't find out how.
Can anybody help me?
Re: connect to client excel application
You can do it one of two ways:
Create the Excel file on the server, then write to the user's machine in a response stream (so that they are prompted to save it).
Or,
Create an ActiveX control which the users must install on their machines which will write the Excel files to their hard drives.
Re: connect to client excel application
Quote:
Originally Posted by mendhak
Create an ActiveX control which the users must install on their machines which will write the Excel files to their hard drives.
I've created my ActiveX control. Is it possible to give me an example how to link the activeX control to the asp.net-page / asp.net-project? Will Internet Explorer ask the user to install this activeX component or should i add special code to do this?
Re: connect to client excel application
IE will prompt the use to install this control. Other browsers will ignore the ActiveX control.
To place an ActiveX control on your web page, first of all, find out its CLSID. You either have this already, or you can run through the registry and find it.
Then,
HTML Code:
<OBJECT ID="MyObject1" CLASSID="CLSID:6F83F556-4DAF-11D2-B06F-0020186313EF"
CODEBASE="MyOCXFileName.OCX">
</OBJECT>
Re: connect to client excel application
Is it possible to access this object from the code-behind-window?
I want to call a public sub that is defined in my activeX.
Re: connect to client excel application
No you cannot. But you could do it with javascript...
HTML Code:
var ax;
ax = new ActiveXObject('object.name');
ax.FunctionName();
Re: connect to client excel application
how can i pass a string-parameter and a date-parameter to my function
Can i do it lile this?
HTML Code:
ax.MaakAgendaPunt('test1', 'test2', #21/03/2006#, #22/03/2003#, 'Here');
Do I use single quotes for strings and "railroad"-marks (#) for dates, or am i mistaking?