OWC Events in .Net

  • Thread starter WebComponentFlunky
  • Start date
W

WebComponentFlunky

I am trying to add a spreadsheet component to my web page
in .NET (c#). When I add the spreadsheet to my form I
cannot use its methods from within my .net code.
I found a Microsoft article #328275 'How to handle events
for the Office Web Components in Visual Studio .NET'
which basically walks you through the process of
recompling a DLL which is part of the OWC controls...
when I tried these steps, I always get compilied errors
on step 11 (compile the source file, AxOWC10.cs). I have
tried this on two different machines... same result...
I am just trying to get the spreadsheet control so that I
can use its methods from my .net c# code... any ideas?
 
A

Alvin Bruney [MVP]

give me the exact error information and the line you followed to get that.
this needs to be corrected in the documentation and I keep forgetting to
submit it.

the office web components are client-side controls. they run on the client,
not on the server. they do not have a handle on the server so you will not
be able to manipulate these controls from the server. However, you can use
attributes to attain some semblance of server-side automation. Have a look
at my website, it details some examples about the process.
http://tinyurl.com/27cok
 
G

Guest

First of all, the step #7 mark the classes as
ClassInterfaceType.None... I could never find a line in
the existing code that had
[System.Runtime.InteropServices.ClassInterface(...
I did Step #6 just fine...
Compile errors....
axOWC10.cs(4372,24): error CS0246: The type or namespace
name "OWC10' could not be found (are you missing a using
directive or an assembly reference?)
axOWC10.cs(4334,24): error CS0246: The type or namespace
name "OWC10' could not be found (are you missing a using
directive or an assembly reference?)
....etc... repeats with different numbers for the axOWC10cs
(###,##)...

I originally was trying to use the spreadsheet control to
show data to users and allow them to edit the spreadsheet
and then when they click on a button, I would save the
spreadsheet...The only way I have found I can do this is
via vbscript... My whole site is c#...
Also, I noticed when I tried to use the ss.Save method (I
believe it is save... not looking at the code right
now... ) the browser ALWAYS prompts me asking if I want
to save the file...is there a way to remove this also?
Thanks for helping...
-----Original Message-----
give me the exact error information and the line you followed to get that.
this needs to be corrected in the documentation and I keep forgetting to
submit it.

the office web components are client-side controls. they run on the client,
not on the server. they do not have a handle on the server so you will not
be able to manipulate these controls from the server. However, you can use
attributes to attain some semblance of server-side automation. Have a look
at my website, it details some examples about the process.
http://tinyurl.com/27cok

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
I am trying to add a spreadsheet component to my web page
in .NET (c#). When I add the spreadsheet to my form I
cannot use its methods from within my .net code.
I found a Microsoft article #328275 'How to handle events
for the Office Web Components in Visual Studio .NET'
which basically walks you through the process of
recompling a DLL which is part of the OWC controls...
when I tried these steps, I always get compilied errors
on step 11 (compile the source file, AxOWC10.cs). I have
tried this on two different machines... same result...
I am just trying to get the spreadsheet control so that I
can use its methods from my .net c# code... any ideas?


.
 
J

Jeff

I started looking at this article because I was trying to
get intell-i-sense prompting in Visual Studio c# for my
spreadsheet control...Trying to use a few methods...
Save, etc
-----Original Message-----
give me the exact error information and the line you followed to get that.
this needs to be corrected in the documentation and I keep forgetting to
submit it.

the office web components are client-side controls. they run on the client,
not on the server. they do not have a handle on the server so you will not
be able to manipulate these controls from the server. However, you can use
attributes to attain some semblance of server-side automation. Have a look
at my website, it details some examples about the process.
http://tinyurl.com/27cok

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
I am trying to add a spreadsheet component to my web page
in .NET (c#). When I add the spreadsheet to my form I
cannot use its methods from within my .net code.
I found a Microsoft article #328275 'How to handle events
for the Office Web Components in Visual Studio .NET'
which basically walks you through the process of
recompling a DLL which is part of the OWC controls...
when I tried these steps, I always get compilied errors
on step 11 (compile the source file, AxOWC10.cs). I have
tried this on two different machines... same result...
I am just trying to get the spreadsheet control so that I
can use its methods from my .net c# code... any ideas?


.
 
J

Jeff Copeland

Alvin,
Can you point me in the right direction? I have spent
too much time on this and I want to get a working
solution.
I have been able to write some vbscript to SS1.Export
command for the spreadsheet but I want to do this via c#
code if possible...Also when I do the export command I am
always prompted if I want to save the file... is there a
way to supress this?
I want to control the spreadsheet via my c# code and not
have to use vbscript. Since I haven't been able to use
the online Doc to recompile the dll I don't know if that
will help me or not... Is there a way to just get a
compiled DLL sent to me? Frustrated...
-----Original Message-----
give me the exact error information and the line you followed to get that.
this needs to be corrected in the documentation and I keep forgetting to
submit it.

the office web components are client-side controls. they run on the client,
not on the server. they do not have a handle on the server so you will not
be able to manipulate these controls from the server. However, you can use
attributes to attain some semblance of server-side automation. Have a look
at my website, it details some examples about the process.
http://tinyurl.com/27cok

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
I am trying to add a spreadsheet component to my web page
in .NET (c#). When I add the spreadsheet to my form I
cannot use its methods from within my .net code.
I found a Microsoft article #328275 'How to handle events
for the Office Web Components in Visual Studio .NET'
which basically walks you through the process of
recompling a DLL which is part of the OWC controls...
when I tried these steps, I always get compilied errors
on step 11 (compile the source file, AxOWC10.cs). I have
tried this on two different machines... same result...
I am just trying to get the spreadsheet control so that I
can use its methods from my .net c# code... any ideas?


.
 
A

Alvin Bruney [MVP]

You took a couple wrong turns. Events always work on the client. There is no
need to go thru the event set up process. This is only needed for
server-side applications. Basically, drag a spreadsheet component onto the
webform. You will be responsible for writing javascript code to load and
unload the control. The manipulation must be done from the client because it
is a client control.

For the unload process, place a text box on the form, set it's visible
property to false. Put a webserver button on the form. Set its click event
to a loadData function that you will write next.

For the loadData function, unload the contents of the spreadsheet into the
server textbox control. texdbox1.text = sp1.CSVDATA;

The idea so far is that clicking on the webserver control will first execute
the client side function that causes the spreadsheet to unload its contents
to the textbox, then the webserver control will fire the page_load event
followed by the button_click event on the server. Ignore the button click
event. In your page_load event, test the contents of the textbox control and
iterate its contents to extract the data.
Here is the bulk of the code.


Page_Load

if(TextBox1.Text.Trim() != string.Empty)
{
string[] rows = TextBox1.Text.ToString().Split(Environtment.Newline);
//or '\n'
foreach(string str in rows)
{
string[] columns = rows.ToString().Split(',');
foreach(string col in columns)
{
//collect your data per row here and do what you must
}
}
//re-initialize
TextBox1.Text = string.Empty;
}

Your load function follows roughly the same script idea, except that it
loads data
--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Jeff Copeland said:
Alvin,
Can you point me in the right direction? I have spent
too much time on this and I want to get a working
solution.
I have been able to write some vbscript to SS1.Export
command for the spreadsheet but I want to do this via c#
code if possible...Also when I do the export command I am
always prompted if I want to save the file... is there a
way to supress this?
I want to control the spreadsheet via my c# code and not
have to use vbscript. Since I haven't been able to use
the online Doc to recompile the dll I don't know if that
will help me or not... Is there a way to just get a
compiled DLL sent to me? Frustrated...
-----Original Message-----
give me the exact error information and the line you followed to get that.
this needs to be corrected in the documentation and I keep forgetting to
submit it.

the office web components are client-side controls. they run on the client,
not on the server. they do not have a handle on the server so you will not
be able to manipulate these controls from the server. However, you can use
attributes to attain some semblance of server-side automation. Have a look
at my website, it details some examples about the process.
http://tinyurl.com/27cok

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
I am trying to add a spreadsheet component to my web page
in .NET (c#). When I add the spreadsheet to my form I
cannot use its methods from within my .net code.
I found a Microsoft article #328275 'How to handle events
for the Office Web Components in Visual Studio .NET'
which basically walks you through the process of
recompling a DLL which is part of the OWC controls...
when I tried these steps, I always get compilied errors
on step 11 (compile the source file, AxOWC10.cs). I have
tried this on two different machines... same result...
I am just trying to get the spreadsheet control so that I
can use its methods from my .net c# code... any ideas?


.
 
J

Jeff Copeland

Alvin,
k, thanks I will try this...question though...going this route I can't use
any of my c# routines? Database connectivity routines, variables, etc? I
will be saving 'header' information about the spreadsheet, etc. Also I was
thinking when I saved the spreadsheet I would be writing the file using the
export method...what is the best method for saving the spreadsheet's data...
I don't really need to know specifics about it (specific data in a specific
row), I just want to be able to save it completely and pull it back up in
spreadsheet form...can I save as XML and pull it in as XML?
Thank you for helping...
Alvin Bruney said:
You took a couple wrong turns. Events always work on the client. There is no
need to go thru the event set up process. This is only needed for
server-side applications. Basically, drag a spreadsheet component onto the
webform. You will be responsible for writing javascript code to load and
unload the control. The manipulation must be done from the client because it
is a client control.

For the unload process, place a text box on the form, set it's visible
property to false. Put a webserver button on the form. Set its click event
to a loadData function that you will write next.

For the loadData function, unload the contents of the spreadsheet into the
server textbox control. texdbox1.text = sp1.CSVDATA;

The idea so far is that clicking on the webserver control will first execute
the client side function that causes the spreadsheet to unload its contents
to the textbox, then the webserver control will fire the page_load event
followed by the button_click event on the server. Ignore the button click
event. In your page_load event, test the contents of the textbox control and
iterate its contents to extract the data.
Here is the bulk of the code.


Page_Load

if(TextBox1.Text.Trim() != string.Empty)
{
string[] rows = TextBox1.Text.ToString().Split(Environtment.Newline);
//or '\n'
foreach(string str in rows)
{
string[] columns = rows.ToString().Split(',');
foreach(string col in columns)
{
//collect your data per row here and do what you must
}
}
//re-initialize
TextBox1.Text = string.Empty;
}

Your load function follows roughly the same script idea, except that it
loads data
--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Jeff Copeland said:
Alvin,
Can you point me in the right direction? I have spent
too much time on this and I want to get a working
solution.
I have been able to write some vbscript to SS1.Export
command for the spreadsheet but I want to do this via c#
code if possible...Also when I do the export command I am
always prompted if I want to save the file... is there a
way to supress this?
I want to control the spreadsheet via my c# code and not
have to use vbscript. Since I haven't been able to use
the online Doc to recompile the dll I don't know if that
will help me or not... Is there a way to just get a
compiled DLL sent to me? Frustrated...
-----Original Message-----
give me the exact error information and the line you followed to get that.
this needs to be corrected in the documentation and I keep forgetting to
submit it.

the office web components are client-side controls. they run on the client,
not on the server. they do not have a handle on the server so you will not
be able to manipulate these controls from the server. However, you can use
attributes to attain some semblance of server-side automation. Have a look
at my website, it details some examples about the process.
http://tinyurl.com/27cok

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
I am trying to add a spreadsheet component to my web page
in .NET (c#). When I add the spreadsheet to my form I
cannot use its methods from within my .net code.
I found a Microsoft article #328275 'How to handle events
for the Office Web Components in Visual Studio .NET'
which basically walks you through the process of
recompling a DLL which is part of the OWC controls...
when I tried these steps, I always get compilied errors
on step 11 (compile the source file, AxOWC10.cs). I have
tried this on two different machines... same result...
I am just trying to get the spreadsheet control so that I
can use its methods from my .net c# code... any ideas?



.
 
J

Jeff Copeland

Alvin,
k, thanks I will try this...question though...going this route I can't use
any of my c# routines? Database connectivity routines, variables, etc? I
will be saving 'header' information about the spreadsheet, etc. Also I was
thinking when I saved the spreadsheet I would be writing the file using the
export method...what is the best method for saving the spreadsheet's data...
I don't really need to know specifics about it (specific data in a specific
row), I just want to be able to save it completely and pull it back up in
spreadsheet form...can I save as XML and pull it in as XML?
Thank you for helping...
Alvin Bruney said:
You took a couple wrong turns. Events always work on the client. There is no
need to go thru the event set up process. This is only needed for
server-side applications. Basically, drag a spreadsheet component onto the
webform. You will be responsible for writing javascript code to load and
unload the control. The manipulation must be done from the client because it
is a client control.

For the unload process, place a text box on the form, set it's visible
property to false. Put a webserver button on the form. Set its click event
to a loadData function that you will write next.

For the loadData function, unload the contents of the spreadsheet into the
server textbox control. texdbox1.text = sp1.CSVDATA;

The idea so far is that clicking on the webserver control will first execute
the client side function that causes the spreadsheet to unload its contents
to the textbox, then the webserver control will fire the page_load event
followed by the button_click event on the server. Ignore the button click
event. In your page_load event, test the contents of the textbox control and
iterate its contents to extract the data.
Here is the bulk of the code.


Page_Load

if(TextBox1.Text.Trim() != string.Empty)
{
string[] rows = TextBox1.Text.ToString().Split(Environtment.Newline);
//or '\n'
foreach(string str in rows)
{
string[] columns = rows.ToString().Split(',');
foreach(string col in columns)
{
//collect your data per row here and do what you must
}
}
//re-initialize
TextBox1.Text = string.Empty;
}

Your load function follows roughly the same script idea, except that it
loads data
--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Jeff Copeland said:
Alvin,
Can you point me in the right direction? I have spent
too much time on this and I want to get a working
solution.
I have been able to write some vbscript to SS1.Export
command for the spreadsheet but I want to do this via c#
code if possible...Also when I do the export command I am
always prompted if I want to save the file... is there a
way to supress this?
I want to control the spreadsheet via my c# code and not
have to use vbscript. Since I haven't been able to use
the online Doc to recompile the dll I don't know if that
will help me or not... Is there a way to just get a
compiled DLL sent to me? Frustrated...
-----Original Message-----
give me the exact error information and the line you followed to get that.
this needs to be corrected in the documentation and I keep forgetting to
submit it.

the office web components are client-side controls. they run on the client,
not on the server. they do not have a handle on the server so you will not
be able to manipulate these controls from the server. However, you can use
attributes to attain some semblance of server-side automation. Have a look
at my website, it details some examples about the process.
http://tinyurl.com/27cok

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
I am trying to add a spreadsheet component to my web page
in .NET (c#). When I add the spreadsheet to my form I
cannot use its methods from within my .net code.
I found a Microsoft article #328275 'How to handle events
for the Office Web Components in Visual Studio .NET'
which basically walks you through the process of
recompling a DLL which is part of the OWC controls...
when I tried these steps, I always get compilied errors
on step 11 (compile the source file, AxOWC10.cs). I have
tried this on two different machines... same result...
I am just trying to get the spreadsheet control so that I
can use its methods from my .net c# code... any ideas?



.
 
J

Jeff Copeland

Alvin,
k I will try this...But a question.. with this method I can't use any of my
c# routines for database activity, etc? I will be saving some 'header info'
about the spreadsheet to my database...Also, when I write the spreadsheet and
need to pull it up, I don't need to store any specific detail in the
spreadsheet by col, row, etc. I just want to save it as a spreadsheet and
pull it back up as a spreadsheet...can I save and read as xml or something
like that? giving it a file path name, etc?
Thanks for helping

Alvin Bruney said:
You took a couple wrong turns. Events always work on the client. There is no
need to go thru the event set up process. This is only needed for
server-side applications. Basically, drag a spreadsheet component onto the
webform. You will be responsible for writing javascript code to load and
unload the control. The manipulation must be done from the client because it
is a client control.

For the unload process, place a text box on the form, set it's visible
property to false. Put a webserver button on the form. Set its click event
to a loadData function that you will write next.

For the loadData function, unload the contents of the spreadsheet into the
server textbox control. texdbox1.text = sp1.CSVDATA;

The idea so far is that clicking on the webserver control will first execute
the client side function that causes the spreadsheet to unload its contents
to the textbox, then the webserver control will fire the page_load event
followed by the button_click event on the server. Ignore the button click
event. In your page_load event, test the contents of the textbox control and
iterate its contents to extract the data.
Here is the bulk of the code.


Page_Load

if(TextBox1.Text.Trim() != string.Empty)
{
string[] rows = TextBox1.Text.ToString().Split(Environtment.Newline);
//or '\n'
foreach(string str in rows)
{
string[] columns = rows.ToString().Split(',');
foreach(string col in columns)
{
//collect your data per row here and do what you must
}
}
//re-initialize
TextBox1.Text = string.Empty;
}

Your load function follows roughly the same script idea, except that it
loads data
--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Jeff Copeland said:
Alvin,
Can you point me in the right direction? I have spent
too much time on this and I want to get a working
solution.
I have been able to write some vbscript to SS1.Export
command for the spreadsheet but I want to do this via c#
code if possible...Also when I do the export command I am
always prompted if I want to save the file... is there a
way to supress this?
I want to control the spreadsheet via my c# code and not
have to use vbscript. Since I haven't been able to use
the online Doc to recompile the dll I don't know if that
will help me or not... Is there a way to just get a
compiled DLL sent to me? Frustrated...
-----Original Message-----
give me the exact error information and the line you followed to get that.
this needs to be corrected in the documentation and I keep forgetting to
submit it.

the office web components are client-side controls. they run on the client,
not on the server. they do not have a handle on the server so you will not
be able to manipulate these controls from the server. However, you can use
attributes to attain some semblance of server-side automation. Have a look
at my website, it details some examples about the process.
http://tinyurl.com/27cok

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
I am trying to add a spreadsheet component to my web page
in .NET (c#). When I add the spreadsheet to my form I
cannot use its methods from within my .net code.
I found a Microsoft article #328275 'How to handle events
for the Office Web Components in Visual Studio .NET'
which basically walks you through the process of
recompling a DLL which is part of the OWC controls...
when I tried these steps, I always get compilied errors
on step 11 (compile the source file, AxOWC10.cs). I have
tried this on two different machines... same result...
I am just trying to get the spreadsheet control so that I
can use its methods from my .net c# code... any ideas?



.
 
A

Alvin Bruney [MVP]

the spreadsheet contains an xmldata property that you can use to write and
read xml data.
the spreadsheet can only read specially formatted xml data by the way.
the export method exports the spreadsheet to the desktop

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Jeff Copeland said:
Alvin,
k I will try this...But a question.. with this method I can't use any of
my
c# routines for database activity, etc? I will be saving some 'header
info'
about the spreadsheet to my database...Also, when I write the spreadsheet
and
need to pull it up, I don't need to store any specific detail in the
spreadsheet by col, row, etc. I just want to save it as a spreadsheet and
pull it back up as a spreadsheet...can I save and read as xml or something
like that? giving it a file path name, etc?
Thanks for helping

Alvin Bruney said:
You took a couple wrong turns. Events always work on the client. There is
no
need to go thru the event set up process. This is only needed for
server-side applications. Basically, drag a spreadsheet component onto
the
webform. You will be responsible for writing javascript code to load and
unload the control. The manipulation must be done from the client because
it
is a client control.

For the unload process, place a text box on the form, set it's visible
property to false. Put a webserver button on the form. Set its click
event
to a loadData function that you will write next.

For the loadData function, unload the contents of the spreadsheet into
the
server textbox control. texdbox1.text = sp1.CSVDATA;

The idea so far is that clicking on the webserver control will first
execute
the client side function that causes the spreadsheet to unload its
contents
to the textbox, then the webserver control will fire the page_load event
followed by the button_click event on the server. Ignore the button click
event. In your page_load event, test the contents of the textbox control
and
iterate its contents to extract the data.
Here is the bulk of the code.


Page_Load

if(TextBox1.Text.Trim() != string.Empty)
{
string[] rows = TextBox1.Text.ToString().Split(Environtment.Newline);
//or '\n'
foreach(string str in rows)
{
string[] columns = rows.ToString().Split(',');
foreach(string col in columns)
{
//collect your data per row here and do what you must
}
}
//re-initialize
TextBox1.Text = string.Empty;
}

Your load function follows roughly the same script idea, except that it
loads data
--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Jeff Copeland said:
Alvin,
Can you point me in the right direction? I have spent
too much time on this and I want to get a working
solution.
I have been able to write some vbscript to SS1.Export
command for the spreadsheet but I want to do this via c#
code if possible...Also when I do the export command I am
always prompted if I want to save the file... is there a
way to supress this?
I want to control the spreadsheet via my c# code and not
have to use vbscript. Since I haven't been able to use
the online Doc to recompile the dll I don't know if that
will help me or not... Is there a way to just get a
compiled DLL sent to me? Frustrated...
-----Original Message-----
give me the exact error information and the line you
followed to get that.
this needs to be corrected in the documentation and I
keep forgetting to
submit it.

the office web components are client-side controls. they
run on the client,
not on the server. they do not have a handle on the
server so you will not
be able to manipulate these controls from the server.
However, you can use
attributes to attain some semblance of server-side
automation. Have a look
at my website, it details some examples about the
process.
http://tinyurl.com/27cok

--
Regards,
Alvin Bruney
[ASP.NET MVP
http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
in message
I am trying to add a spreadsheet component to my web
page
in .NET (c#). When I add the spreadsheet to my form I
cannot use its methods from within my .net code.
I found a Microsoft article #328275 'How to handle
events
for the Office Web Components in Visual Studio .NET'
which basically walks you through the process of
recompling a DLL which is part of the OWC controls...
when I tried these steps, I always get compilied errors
on step 11 (compile the source file, AxOWC10.cs). I
have
tried this on two different machines... same result...
I am just trying to get the spreadsheet control so
that I
can use its methods from my .net c# code... any ideas?



.
 
J

Jeff Copeland

Alvin,
k,thank you for helping...if you don't mind I will explain the 'app' that I
am trying to develop and maybe you can steer me in the correct 'method'...
Our whole site is written in c# using .Net. We use classes, etc for
everything. We have a specific area we call calculators where we have three
different forms that have form fields a user enters data into and they click
on the calculate button which uses the form fieldse to make specific
calculations. When the user is finished they click on the save button which
saves all of the form fields in the the database. Well all of the form fields
and their calculations started from excel spreadsheets and from time to time
these calculations change so we have to go back and recode the form...I was
thinking that it would be so much easier if we could just use the original
spreadsheets within the web page. That is when I started looking at the OWC
control. I want to save the spreadsheet files on the web server and also save
some database info about each file (filename, user, etc). I think what you
are telling me is that I will have to write javascript to work with the
spreadsheet and cannot use my C# code?...is this correct? So the best way to
'transfer' info from my c# code (database access, etc)...put it into hidden
fields on the form?
Just trying to determine the best way to read-write the spreadsheet and how
to get info from my c# code into the javascript routines...
Thanks...
"Alvin Bruney [MVP]" wrote:e]
the spreadsheet contains an xmldata property that you can use to write and
read xml data.
the spreadsheet can only read specially formatted xml data by the way.
the export method exports the spreadsheet to the desktop

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Jeff Copeland said:
Alvin,
k I will try this...But a question.. with this method I can't use any of
my
c# routines for database activity, etc? I will be saving some 'header
info'
about the spreadsheet to my database...Also, when I write the spreadsheet
and
need to pull it up, I don't need to store any specific detail in the
spreadsheet by col, row, etc. I just want to save it as a spreadsheet and
pull it back up as a spreadsheet...can I save and read as xml or something
like that? giving it a file path name, etc?
Thanks for helping

Alvin Bruney said:
You took a couple wrong turns. Events always work on the client. There is
no
need to go thru the event set up process. This is only needed for
server-side applications. Basically, drag a spreadsheet component onto
the
webform. You will be responsible for writing javascript code to load and
unload the control. The manipulation must be done from the client because
it
is a client control.

For the unload process, place a text box on the form, set it's visible
property to false. Put a webserver button on the form. Set its click
event
to a loadData function that you will write next.

For the loadData function, unload the contents of the spreadsheet into
the
server textbox control. texdbox1.text = sp1.CSVDATA;

The idea so far is that clicking on the webserver control will first
execute
the client side function that causes the spreadsheet to unload its
contents
to the textbox, then the webserver control will fire the page_load event
followed by the button_click event on the server. Ignore the button click
event. In your page_load event, test the contents of the textbox control
and
iterate its contents to extract the data.
Here is the bulk of the code.


Page_Load

if(TextBox1.Text.Trim() != string.Empty)
{
string[] rows = TextBox1.Text.ToString().Split(Environtment.Newline);
//or '\n'
foreach(string str in rows)
{
string[] columns = rows.ToString().Split(',');
foreach(string col in columns)
{
//collect your data per row here and do what you must
}
}
//re-initialize
TextBox1.Text = string.Empty;
}

Your load function follows roughly the same script idea, except that it
loads data
--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Alvin,
Can you point me in the right direction? I have spent
too much time on this and I want to get a working
solution.
I have been able to write some vbscript to SS1.Export
command for the spreadsheet but I want to do this via c#
code if possible...Also when I do the export command I am
always prompted if I want to save the file... is there a
way to supress this?
I want to control the spreadsheet via my c# code and not
have to use vbscript. Since I haven't been able to use
the online Doc to recompile the dll I don't know if that
will help me or not... Is there a way to just get a
compiled DLL sent to me? Frustrated...
-----Original Message-----
give me the exact error information and the line you
followed to get that.
this needs to be corrected in the documentation and I
keep forgetting to
submit it.

the office web components are client-side controls. they
run on the client,
not on the server. they do not have a handle on the
server so you will not
be able to manipulate these controls from the server.
However, you can use
attributes to attain some semblance of server-side
automation. Have a look
at my website, it details some examples about the
process.
http://tinyurl.com/27cok

--
Regards,
Alvin Bruney
[ASP.NET MVP
http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
in message
I am trying to add a spreadsheet component to my web
page
in .NET (c#). When I add the spreadsheet to my form I
cannot use its methods from within my .net code.
I found a Microsoft article #328275 'How to handle
events
for the Office Web Components in Visual Studio .NET'
which basically walks you through the process of
recompling a DLL which is part of the OWC controls...
when I tried these steps, I always get compilied errors
on step 11 (compile the source file, AxOWC10.cs). I
have
tried this on two different machines... same result...
I am just trying to get the spreadsheet control so
that I
can use its methods from my .net c# code... any ideas?



.
 
J

Jeff Copeland

Alvin,
So basically, I want to pull up a specific excel spreadsheet from the web
server into a web page, let the user enter info into that spreadsheet, then
save that spreadsheet 'file' back to the server. Along with a form field or
two (spreadsheet name, maybe.. entered by the user) into my database. So
after it is done, I would have a database record that contains the user's
spreadsheet name they specified, file path, etc.. and also a spreadsheet file
located on my webserver...obviously, the user might pull this back up and
save it again...
JC
Alvin Bruney said:
the spreadsheet contains an xmldata property that you can use to write and
read xml data.
the spreadsheet can only read specially formatted xml data by the way.
the export method exports the spreadsheet to the desktop

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Jeff Copeland said:
Alvin,
k I will try this...But a question.. with this method I can't use any of
my
c# routines for database activity, etc? I will be saving some 'header
info'
about the spreadsheet to my database...Also, when I write the spreadsheet
and
need to pull it up, I don't need to store any specific detail in the
spreadsheet by col, row, etc. I just want to save it as a spreadsheet and
pull it back up as a spreadsheet...can I save and read as xml or something
like that? giving it a file path name, etc?
Thanks for helping

Alvin Bruney said:
You took a couple wrong turns. Events always work on the client. There is
no
need to go thru the event set up process. This is only needed for
server-side applications. Basically, drag a spreadsheet component onto
the
webform. You will be responsible for writing javascript code to load and
unload the control. The manipulation must be done from the client because
it
is a client control.

For the unload process, place a text box on the form, set it's visible
property to false. Put a webserver button on the form. Set its click
event
to a loadData function that you will write next.

For the loadData function, unload the contents of the spreadsheet into
the
server textbox control. texdbox1.text = sp1.CSVDATA;

The idea so far is that clicking on the webserver control will first
execute
the client side function that causes the spreadsheet to unload its
contents
to the textbox, then the webserver control will fire the page_load event
followed by the button_click event on the server. Ignore the button click
event. In your page_load event, test the contents of the textbox control
and
iterate its contents to extract the data.
Here is the bulk of the code.


Page_Load

if(TextBox1.Text.Trim() != string.Empty)
{
string[] rows = TextBox1.Text.ToString().Split(Environtment.Newline);
//or '\n'
foreach(string str in rows)
{
string[] columns = rows.ToString().Split(',');
foreach(string col in columns)
{
//collect your data per row here and do what you must
}
}
//re-initialize
TextBox1.Text = string.Empty;
}

Your load function follows roughly the same script idea, except that it
loads data
--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Alvin,
Can you point me in the right direction? I have spent
too much time on this and I want to get a working
solution.
I have been able to write some vbscript to SS1.Export
command for the spreadsheet but I want to do this via c#
code if possible...Also when I do the export command I am
always prompted if I want to save the file... is there a
way to supress this?
I want to control the spreadsheet via my c# code and not
have to use vbscript. Since I haven't been able to use
the online Doc to recompile the dll I don't know if that
will help me or not... Is there a way to just get a
compiled DLL sent to me? Frustrated...
-----Original Message-----
give me the exact error information and the line you
followed to get that.
this needs to be corrected in the documentation and I
keep forgetting to
submit it.

the office web components are client-side controls. they
run on the client,
not on the server. they do not have a handle on the
server so you will not
be able to manipulate these controls from the server.
However, you can use
attributes to attain some semblance of server-side
automation. Have a look
at my website, it details some examples about the
process.
http://tinyurl.com/27cok

--
Regards,
Alvin Bruney
[ASP.NET MVP
http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
in message
I am trying to add a spreadsheet component to my web
page
in .NET (c#). When I add the spreadsheet to my form I
cannot use its methods from within my .net code.
I found a Microsoft article #328275 'How to handle
events
for the Office Web Components in Visual Studio .NET'
which basically walks you through the process of
recompling a DLL which is part of the OWC controls...
when I tried these steps, I always get compilied errors
on step 11 (compile the source file, AxOWC10.cs). I
have
tried this on two different machines... same result...
I am just trying to get the spreadsheet control so
that I
can use its methods from my .net c# code... any ideas?



.
 
A

Alvin Bruney [MVP]

In that case, you can write the contents of the spreadsheet to the server
disk. You will need to make sure that the file names are unique. When the
user is ready for the file, re-load it using the xmldata property load. it
should contain all the formulas etc and changes made by the user on the last
save.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Jeff Copeland said:
Alvin,
k,thank you for helping...if you don't mind I will explain the 'app' that
I
am trying to develop and maybe you can steer me in the correct 'method'...
Our whole site is written in c# using .Net. We use classes, etc for
everything. We have a specific area we call calculators where we have
three
different forms that have form fields a user enters data into and they
click
on the calculate button which uses the form fieldse to make specific
calculations. When the user is finished they click on the save button
which
saves all of the form fields in the the database. Well all of the form
fields
and their calculations started from excel spreadsheets and from time to
time
these calculations change so we have to go back and recode the form...I
was
thinking that it would be so much easier if we could just use the original
spreadsheets within the web page. That is when I started looking at the
OWC
control. I want to save the spreadsheet files on the web server and also
save
some database info about each file (filename, user, etc). I think what
you
are telling me is that I will have to write javascript to work with the
spreadsheet and cannot use my C# code?...is this correct? So the best way
to
'transfer' info from my c# code (database access, etc)...put it into
hidden
fields on the form?
Just trying to determine the best way to read-write the spreadsheet and
how
to get info from my c# code into the javascript routines...
Thanks...
"Alvin Bruney [MVP]" wrote:e]
the spreadsheet contains an xmldata property that you can use to write
and
read xml data.
the spreadsheet can only read specially formatted xml data by the way.
the export method exports the spreadsheet to the desktop

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Jeff Copeland said:
Alvin,
k I will try this...But a question.. with this method I can't use any
of
my
c# routines for database activity, etc? I will be saving some 'header
info'
about the spreadsheet to my database...Also, when I write the
spreadsheet
and
need to pull it up, I don't need to store any specific detail in the
spreadsheet by col, row, etc. I just want to save it as a spreadsheet
and
pull it back up as a spreadsheet...can I save and read as xml or
something
like that? giving it a file path name, etc?
Thanks for helping

:

You took a couple wrong turns. Events always work on the client. There
is
no
need to go thru the event set up process. This is only needed for
server-side applications. Basically, drag a spreadsheet component onto
the
webform. You will be responsible for writing javascript code to load
and
unload the control. The manipulation must be done from the client
because
it
is a client control.

For the unload process, place a text box on the form, set it's visible
property to false. Put a webserver button on the form. Set its click
event
to a loadData function that you will write next.

For the loadData function, unload the contents of the spreadsheet into
the
server textbox control. texdbox1.text = sp1.CSVDATA;

The idea so far is that clicking on the webserver control will first
execute
the client side function that causes the spreadsheet to unload its
contents
to the textbox, then the webserver control will fire the page_load
event
followed by the button_click event on the server. Ignore the button
click
event. In your page_load event, test the contents of the textbox
control
and
iterate its contents to extract the data.
Here is the bulk of the code.


Page_Load

if(TextBox1.Text.Trim() != string.Empty)
{
string[] rows =
TextBox1.Text.ToString().Split(Environtment.Newline);
//or '\n'
foreach(string str in rows)
{
string[] columns = rows.ToString().Split(',');
foreach(string col in columns)
{
//collect your data per row here and do what you must
}
}
//re-initialize
TextBox1.Text = string.Empty;
}

Your load function follows roughly the same script idea, except that
it
loads data
--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Alvin,
Can you point me in the right direction? I have spent
too much time on this and I want to get a working
solution.
I have been able to write some vbscript to SS1.Export
command for the spreadsheet but I want to do this via c#
code if possible...Also when I do the export command I am
always prompted if I want to save the file... is there a
way to supress this?
I want to control the spreadsheet via my c# code and not
have to use vbscript. Since I haven't been able to use
the online Doc to recompile the dll I don't know if that
will help me or not... Is there a way to just get a
compiled DLL sent to me? Frustrated...
-----Original Message-----
give me the exact error information and the line you
followed to get that.
this needs to be corrected in the documentation and I
keep forgetting to
submit it.

the office web components are client-side controls. they
run on the client,
not on the server. they do not have a handle on the
server so you will not
be able to manipulate these controls from the server.
However, you can use
attributes to attain some semblance of server-side
automation. Have a look
at my website, it details some examples about the
process.
http://tinyurl.com/27cok

--
Regards,
Alvin Bruney
[ASP.NET MVP
http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
in message
I am trying to add a spreadsheet component to my web
page
in .NET (c#). When I add the spreadsheet to my form I
cannot use its methods from within my .net code.
I found a Microsoft article #328275 'How to handle
events
for the Office Web Components in Visual Studio .NET'
which basically walks you through the process of
recompling a DLL which is part of the OWC controls...
when I tried these steps, I always get compilied errors
on step 11 (compile the source file, AxOWC10.cs). I
have
tried this on two different machines... same result...
I am just trying to get the spreadsheet control so
that I
can use its methods from my .net c# code... any ideas?



.
 
J

Jeff Copeland

Alvin,
Is there a way to reference mmy configuration.AppSettings from within
javascript? Write now I am throwing my connection string data into a hidden
field...I was wondering if I could just reference it directly?

Alvin Bruney said:
In that case, you can write the contents of the spreadsheet to the server
disk. You will need to make sure that the file names are unique. When the
user is ready for the file, re-load it using the xmldata property load. it
should contain all the formulas etc and changes made by the user on the last
save.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Jeff Copeland said:
Alvin,
k,thank you for helping...if you don't mind I will explain the 'app' that
I
am trying to develop and maybe you can steer me in the correct 'method'...
Our whole site is written in c# using .Net. We use classes, etc for
everything. We have a specific area we call calculators where we have
three
different forms that have form fields a user enters data into and they
click
on the calculate button which uses the form fieldse to make specific
calculations. When the user is finished they click on the save button
which
saves all of the form fields in the the database. Well all of the form
fields
and their calculations started from excel spreadsheets and from time to
time
these calculations change so we have to go back and recode the form...I
was
thinking that it would be so much easier if we could just use the original
spreadsheets within the web page. That is when I started looking at the
OWC
control. I want to save the spreadsheet files on the web server and also
save
some database info about each file (filename, user, etc). I think what
you
are telling me is that I will have to write javascript to work with the
spreadsheet and cannot use my C# code?...is this correct? So the best way
to
'transfer' info from my c# code (database access, etc)...put it into
hidden
fields on the form?
Just trying to determine the best way to read-write the spreadsheet and
how
to get info from my c# code into the javascript routines...
Thanks...
"Alvin Bruney [MVP]" wrote:e]
the spreadsheet contains an xmldata property that you can use to write
and
read xml data.
the spreadsheet can only read specially formatted xml data by the way.
the export method exports the spreadsheet to the desktop

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Alvin,
k I will try this...But a question.. with this method I can't use any
of
my
c# routines for database activity, etc? I will be saving some 'header
info'
about the spreadsheet to my database...Also, when I write the
spreadsheet
and
need to pull it up, I don't need to store any specific detail in the
spreadsheet by col, row, etc. I just want to save it as a spreadsheet
and
pull it back up as a spreadsheet...can I save and read as xml or
something
like that? giving it a file path name, etc?
Thanks for helping

:

You took a couple wrong turns. Events always work on the client. There
is
no
need to go thru the event set up process. This is only needed for
server-side applications. Basically, drag a spreadsheet component onto
the
webform. You will be responsible for writing javascript code to load
and
unload the control. The manipulation must be done from the client
because
it
is a client control.

For the unload process, place a text box on the form, set it's visible
property to false. Put a webserver button on the form. Set its click
event
to a loadData function that you will write next.

For the loadData function, unload the contents of the spreadsheet into
the
server textbox control. texdbox1.text = sp1.CSVDATA;

The idea so far is that clicking on the webserver control will first
execute
the client side function that causes the spreadsheet to unload its
contents
to the textbox, then the webserver control will fire the page_load
event
followed by the button_click event on the server. Ignore the button
click
event. In your page_load event, test the contents of the textbox
control
and
iterate its contents to extract the data.
Here is the bulk of the code.


Page_Load

if(TextBox1.Text.Trim() != string.Empty)
{
string[] rows =
TextBox1.Text.ToString().Split(Environtment.Newline);
//or '\n'
foreach(string str in rows)
{
string[] columns = rows.ToString().Split(',');
foreach(string col in columns)
{
//collect your data per row here and do what you must
}
}
//re-initialize
TextBox1.Text = string.Empty;
}

Your load function follows roughly the same script idea, except that
it
loads data
--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Alvin,
Can you point me in the right direction? I have spent
too much time on this and I want to get a working
solution.
I have been able to write some vbscript to SS1.Export
command for the spreadsheet but I want to do this via c#
code if possible...Also when I do the export command I am
always prompted if I want to save the file... is there a
way to supress this?
I want to control the spreadsheet via my c# code and not
have to use vbscript. Since I haven't been able to use
the online Doc to recompile the dll I don't know if that
will help me or not... Is there a way to just get a
compiled DLL sent to me? Frustrated...
-----Original Message-----
give me the exact error information and the line you
followed to get that.
this needs to be corrected in the documentation and I
keep forgetting to
submit it.

the office web components are client-side controls. they
run on the client,
not on the server. they do not have a handle on the
server so you will not
be able to manipulate these controls from the server.
However, you can use
attributes to attain some semblance of server-side
automation. Have a look
at my website, it details some examples about the
process.
http://tinyurl.com/27cok

--
Regards,
Alvin Bruney
[ASP.NET MVP
http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
in message
I am trying to add a spreadsheet component to my web
page
in .NET (c#). When I add the spreadsheet to my form I
cannot use its methods from within my .net code.
I found a Microsoft article #328275 'How to handle
events
for the Office Web Components in Visual Studio .NET'
which basically walks you through the process of
recompling a DLL which is part of the OWC controls...
when I tried these steps, I always get compilied errors
on step 11 (compile the source file, AxOWC10.cs). I
have
tried this on two different machines... same result...
I am just trying to get the spreadsheet control so
that I
can use its methods from my .net c# code... any ideas?



.
 
J

Jeff Copeland

Alvin,
Also, since I have to save my spreadsheet data on the server... all of my
users will not have network access...so shouldn't I be doing all of this on
the server?
I think I am getting all confused here...


Jeff Copeland said:
Alvin,
So basically, I want to pull up a specific excel spreadsheet from the web
server into a web page, let the user enter info into that spreadsheet, then
save that spreadsheet 'file' back to the server. Along with a form field or
two (spreadsheet name, maybe.. entered by the user) into my database. So
after it is done, I would have a database record that contains the user's
spreadsheet name they specified, file path, etc.. and also a spreadsheet file
located on my webserver...obviously, the user might pull this back up and
save it again...
JC
Alvin Bruney said:
the spreadsheet contains an xmldata property that you can use to write and
read xml data.
the spreadsheet can only read specially formatted xml data by the way.
the export method exports the spreadsheet to the desktop

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Jeff Copeland said:
Alvin,
k I will try this...But a question.. with this method I can't use any of
my
c# routines for database activity, etc? I will be saving some 'header
info'
about the spreadsheet to my database...Also, when I write the spreadsheet
and
need to pull it up, I don't need to store any specific detail in the
spreadsheet by col, row, etc. I just want to save it as a spreadsheet and
pull it back up as a spreadsheet...can I save and read as xml or something
like that? giving it a file path name, etc?
Thanks for helping

:

You took a couple wrong turns. Events always work on the client. There is
no
need to go thru the event set up process. This is only needed for
server-side applications. Basically, drag a spreadsheet component onto
the
webform. You will be responsible for writing javascript code to load and
unload the control. The manipulation must be done from the client because
it
is a client control.

For the unload process, place a text box on the form, set it's visible
property to false. Put a webserver button on the form. Set its click
event
to a loadData function that you will write next.

For the loadData function, unload the contents of the spreadsheet into
the
server textbox control. texdbox1.text = sp1.CSVDATA;

The idea so far is that clicking on the webserver control will first
execute
the client side function that causes the spreadsheet to unload its
contents
to the textbox, then the webserver control will fire the page_load event
followed by the button_click event on the server. Ignore the button click
event. In your page_load event, test the contents of the textbox control
and
iterate its contents to extract the data.
Here is the bulk of the code.


Page_Load

if(TextBox1.Text.Trim() != string.Empty)
{
string[] rows = TextBox1.Text.ToString().Split(Environtment.Newline);
//or '\n'
foreach(string str in rows)
{
string[] columns = rows.ToString().Split(',');
foreach(string col in columns)
{
//collect your data per row here and do what you must
}
}
//re-initialize
TextBox1.Text = string.Empty;
}

Your load function follows roughly the same script idea, except that it
loads data
--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Alvin,
Can you point me in the right direction? I have spent
too much time on this and I want to get a working
solution.
I have been able to write some vbscript to SS1.Export
command for the spreadsheet but I want to do this via c#
code if possible...Also when I do the export command I am
always prompted if I want to save the file... is there a
way to supress this?
I want to control the spreadsheet via my c# code and not
have to use vbscript. Since I haven't been able to use
the online Doc to recompile the dll I don't know if that
will help me or not... Is there a way to just get a
compiled DLL sent to me? Frustrated...
-----Original Message-----
give me the exact error information and the line you
followed to get that.
this needs to be corrected in the documentation and I
keep forgetting to
submit it.

the office web components are client-side controls. they
run on the client,
not on the server. they do not have a handle on the
server so you will not
be able to manipulate these controls from the server.
However, you can use
attributes to attain some semblance of server-side
automation. Have a look
at my website, it details some examples about the
process.
http://tinyurl.com/27cok

--
Regards,
Alvin Bruney
[ASP.NET MVP
http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
in message
I am trying to add a spreadsheet component to my web
page
in .NET (c#). When I add the spreadsheet to my form I
cannot use its methods from within my .net code.
I found a Microsoft article #328275 'How to handle
events
for the Office Web Components in Visual Studio .NET'
which basically walks you through the process of
recompling a DLL which is part of the OWC controls...
when I tried these steps, I always get compilied errors
on step 11 (compile the source file, AxOWC10.cs). I
have
tried this on two different machines... same result...
I am just trying to get the spreadsheet control so
that I
can use its methods from my .net c# code... any ideas?



.
 
J

Jeff Copeland

Alvin,
k, looking at your 'psuedo-code',... can you write me something similiar
that I can use the xmldata method for ss? I want to put the data on the
webserver from the server not from client...Users may not have network
access...
Also, I have a connectionstring in a global variable in c#, is there a way
to use that to save data to the database that would be data ABOUT the
spreadsheet. I still want to save the spreadsheet data as xml on the
webserver...
Thanks
JC

Alvin Bruney said:
In that case, you can write the contents of the spreadsheet to the server
disk. You will need to make sure that the file names are unique. When the
user is ready for the file, re-load it using the xmldata property load. it
should contain all the formulas etc and changes made by the user on the last
save.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Jeff Copeland said:
Alvin,
k,thank you for helping...if you don't mind I will explain the 'app' that
I
am trying to develop and maybe you can steer me in the correct 'method'...
Our whole site is written in c# using .Net. We use classes, etc for
everything. We have a specific area we call calculators where we have
three
different forms that have form fields a user enters data into and they
click
on the calculate button which uses the form fieldse to make specific
calculations. When the user is finished they click on the save button
which
saves all of the form fields in the the database. Well all of the form
fields
and their calculations started from excel spreadsheets and from time to
time
these calculations change so we have to go back and recode the form...I
was
thinking that it would be so much easier if we could just use the original
spreadsheets within the web page. That is when I started looking at the
OWC
control. I want to save the spreadsheet files on the web server and also
save
some database info about each file (filename, user, etc). I think what
you
are telling me is that I will have to write javascript to work with the
spreadsheet and cannot use my C# code?...is this correct? So the best way
to
'transfer' info from my c# code (database access, etc)...put it into
hidden
fields on the form?
Just trying to determine the best way to read-write the spreadsheet and
how
to get info from my c# code into the javascript routines...
Thanks...
"Alvin Bruney [MVP]" wrote:e]
the spreadsheet contains an xmldata property that you can use to write
and
read xml data.
the spreadsheet can only read specially formatted xml data by the way.
the export method exports the spreadsheet to the desktop

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Alvin,
k I will try this...But a question.. with this method I can't use any
of
my
c# routines for database activity, etc? I will be saving some 'header
info'
about the spreadsheet to my database...Also, when I write the
spreadsheet
and
need to pull it up, I don't need to store any specific detail in the
spreadsheet by col, row, etc. I just want to save it as a spreadsheet
and
pull it back up as a spreadsheet...can I save and read as xml or
something
like that? giving it a file path name, etc?
Thanks for helping

:

You took a couple wrong turns. Events always work on the client. There
is
no
need to go thru the event set up process. This is only needed for
server-side applications. Basically, drag a spreadsheet component onto
the
webform. You will be responsible for writing javascript code to load
and
unload the control. The manipulation must be done from the client
because
it
is a client control.

For the unload process, place a text box on the form, set it's visible
property to false. Put a webserver button on the form. Set its click
event
to a loadData function that you will write next.

For the loadData function, unload the contents of the spreadsheet into
the
server textbox control. texdbox1.text = sp1.CSVDATA;

The idea so far is that clicking on the webserver control will first
execute
the client side function that causes the spreadsheet to unload its
contents
to the textbox, then the webserver control will fire the page_load
event
followed by the button_click event on the server. Ignore the button
click
event. In your page_load event, test the contents of the textbox
control
and
iterate its contents to extract the data.
Here is the bulk of the code.


Page_Load

if(TextBox1.Text.Trim() != string.Empty)
{
string[] rows =
TextBox1.Text.ToString().Split(Environtment.Newline);
//or '\n'
foreach(string str in rows)
{
string[] columns = rows.ToString().Split(',');
foreach(string col in columns)
{
//collect your data per row here and do what you must
}
}
//re-initialize
TextBox1.Text = string.Empty;
}

Your load function follows roughly the same script idea, except that
it
loads data
--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Alvin,
Can you point me in the right direction? I have spent
too much time on this and I want to get a working
solution.
I have been able to write some vbscript to SS1.Export
command for the spreadsheet but I want to do this via c#
code if possible...Also when I do the export command I am
always prompted if I want to save the file... is there a
way to supress this?
I want to control the spreadsheet via my c# code and not
have to use vbscript. Since I haven't been able to use
the online Doc to recompile the dll I don't know if that
will help me or not... Is there a way to just get a
compiled DLL sent to me? Frustrated...
-----Original Message-----
give me the exact error information and the line you
followed to get that.
this needs to be corrected in the documentation and I
keep forgetting to
submit it.

the office web components are client-side controls. they
run on the client,
not on the server. they do not have a handle on the
server so you will not
be able to manipulate these controls from the server.
However, you can use
attributes to attain some semblance of server-side
automation. Have a look
at my website, it details some examples about the
process.
http://tinyurl.com/27cok

--
Regards,
Alvin Bruney
[ASP.NET MVP
http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
in message
I am trying to add a spreadsheet component to my web
page
in .NET (c#). When I add the spreadsheet to my form I
cannot use its methods from within my .net code.
I found a Microsoft article #328275 'How to handle
events
for the Office Web Components in Visual Studio .NET'
which basically walks you through the process of
recompling a DLL which is part of the OWC controls...
when I tried these steps, I always get compilied errors
on step 11 (compile the source file, AxOWC10.cs). I
have
tried this on two different machines... same result...
I am just trying to get the spreadsheet control so
that I
can use its methods from my .net c# code... any ideas?



.
 
A

Alvin Bruney [MVP]

well, the config file is just another file. point the javascript to a uri
ending in web.config. you will need to tweak IIS to allow it to serve up the
file. scratch that. that's a security risk. put the connection strings into
a txt file and use javascript to a uri: https://webserver/conn.txt

you have a lot of options from where you stand. it just depends on your
architecture. if you do server side manipulation, you might be better off
reading the data from the server and streaming it to the client or putting
it in a hidden field for instance

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Jeff Copeland said:
Alvin,
Is there a way to reference mmy configuration.AppSettings from within
javascript? Write now I am throwing my connection string data into a
hidden
field...I was wondering if I could just reference it directly?

Alvin Bruney said:
In that case, you can write the contents of the spreadsheet to the server
disk. You will need to make sure that the file names are unique. When the
user is ready for the file, re-load it using the xmldata property load.
it
should contain all the formulas etc and changes made by the user on the
last
save.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Jeff Copeland said:
Alvin,
k,thank you for helping...if you don't mind I will explain the 'app'
that
I
am trying to develop and maybe you can steer me in the correct
'method'...
Our whole site is written in c# using .Net. We use classes, etc for
everything. We have a specific area we call calculators where we have
three
different forms that have form fields a user enters data into and they
click
on the calculate button which uses the form fieldse to make specific
calculations. When the user is finished they click on the save button
which
saves all of the form fields in the the database. Well all of the form
fields
and their calculations started from excel spreadsheets and from time to
time
these calculations change so we have to go back and recode the form...I
was
thinking that it would be so much easier if we could just use the
original
spreadsheets within the web page. That is when I started looking at the
OWC
control. I want to save the spreadsheet files on the web server and
also
save
some database info about each file (filename, user, etc). I think what
you
are telling me is that I will have to write javascript to work with the
spreadsheet and cannot use my C# code?...is this correct? So the best
way
to
'transfer' info from my c# code (database access, etc)...put it into
hidden
fields on the form?
Just trying to determine the best way to read-write the spreadsheet and
how
to get info from my c# code into the javascript routines...
Thanks...
"Alvin Bruney [MVP]" wrote:e]

the spreadsheet contains an xmldata property that you can use to write
and
read xml data.
the spreadsheet can only read specially formatted xml data by the way.
the export method exports the spreadsheet to the desktop

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
message
Alvin,
k I will try this...But a question.. with this method I can't use
any
of
my
c# routines for database activity, etc? I will be saving some
'header
info'
about the spreadsheet to my database...Also, when I write the
spreadsheet
and
need to pull it up, I don't need to store any specific detail in the
spreadsheet by col, row, etc. I just want to save it as a
spreadsheet
and
pull it back up as a spreadsheet...can I save and read as xml or
something
like that? giving it a file path name, etc?
Thanks for helping

:

You took a couple wrong turns. Events always work on the client.
There
is
no
need to go thru the event set up process. This is only needed for
server-side applications. Basically, drag a spreadsheet component
onto
the
webform. You will be responsible for writing javascript code to
load
and
unload the control. The manipulation must be done from the client
because
it
is a client control.

For the unload process, place a text box on the form, set it's
visible
property to false. Put a webserver button on the form. Set its
click
event
to a loadData function that you will write next.

For the loadData function, unload the contents of the spreadsheet
into
the
server textbox control. texdbox1.text = sp1.CSVDATA;

The idea so far is that clicking on the webserver control will
first
execute
the client side function that causes the spreadsheet to unload its
contents
to the textbox, then the webserver control will fire the page_load
event
followed by the button_click event on the server. Ignore the button
click
event. In your page_load event, test the contents of the textbox
control
and
iterate its contents to extract the data.
Here is the bulk of the code.


Page_Load

if(TextBox1.Text.Trim() != string.Empty)
{
string[] rows =
TextBox1.Text.ToString().Split(Environtment.Newline);
//or '\n'
foreach(string str in rows)
{
string[] columns = rows.ToString().Split(',');
foreach(string col in columns)
{
//collect your data per row here and do what you must
}
}
//re-initialize
TextBox1.Text = string.Empty;
}

Your load function follows roughly the same script idea, except
that
it
loads data
--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
message
Alvin,
Can you point me in the right direction? I have spent
too much time on this and I want to get a working
solution.
I have been able to write some vbscript to SS1.Export
command for the spreadsheet but I want to do this via c#
code if possible...Also when I do the export command I am
always prompted if I want to save the file... is there a
way to supress this?
I want to control the spreadsheet via my c# code and not
have to use vbscript. Since I haven't been able to use
the online Doc to recompile the dll I don't know if that
will help me or not... Is there a way to just get a
compiled DLL sent to me? Frustrated...
-----Original Message-----
give me the exact error information and the line you
followed to get that.
this needs to be corrected in the documentation and I
keep forgetting to
submit it.

the office web components are client-side controls. they
run on the client,
not on the server. they do not have a handle on the
server so you will not
be able to manipulate these controls from the server.
However, you can use
attributes to attain some semblance of server-side
automation. Have a look
at my website, it details some examples about the
process.
http://tinyurl.com/27cok

--
Regards,
Alvin Bruney
[ASP.NET MVP
http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
in message
I am trying to add a spreadsheet component to my web
page
in .NET (c#). When I add the spreadsheet to my form I
cannot use its methods from within my .net code.
I found a Microsoft article #328275 'How to handle
events
for the Office Web Components in Visual Studio .NET'
which basically walks you through the process of
recompling a DLL which is part of the OWC controls...
when I tried these steps, I always get compilied errors
on step 11 (compile the source file, AxOWC10.cs). I
have
tried this on two different machines... same result...
I am just trying to get the spreadsheet control so
that I
can use its methods from my .net c# code... any ideas?



.
 
A

Alvin Bruney [MVP]

if your users have no internet access, all bets are off. it can be done but
it will take some advanced level programming

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Jeff Copeland said:
Alvin,
Also, since I have to save my spreadsheet data on the server... all of my
users will not have network access...so shouldn't I be doing all of this
on
the server?
I think I am getting all confused here...


Jeff Copeland said:
Alvin,
So basically, I want to pull up a specific excel spreadsheet from the web
server into a web page, let the user enter info into that spreadsheet,
then
save that spreadsheet 'file' back to the server. Along with a form field
or
two (spreadsheet name, maybe.. entered by the user) into my database. So
after it is done, I would have a database record that contains the user's
spreadsheet name they specified, file path, etc.. and also a spreadsheet
file
located on my webserver...obviously, the user might pull this back up and
save it again...
JC
Alvin Bruney said:
the spreadsheet contains an xmldata property that you can use to write
and
read xml data.
the spreadsheet can only read specially formatted xml data by the way.
the export method exports the spreadsheet to the desktop

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
message
Alvin,
k I will try this...But a question.. with this method I can't use any
of
my
c# routines for database activity, etc? I will be saving some 'header
info'
about the spreadsheet to my database...Also, when I write the
spreadsheet
and
need to pull it up, I don't need to store any specific detail in the
spreadsheet by col, row, etc. I just want to save it as a
spreadsheet and
pull it back up as a spreadsheet...can I save and read as xml or
something
like that? giving it a file path name, etc?
Thanks for helping

:

You took a couple wrong turns. Events always work on the client.
There is
no
need to go thru the event set up process. This is only needed for
server-side applications. Basically, drag a spreadsheet component
onto
the
webform. You will be responsible for writing javascript code to load
and
unload the control. The manipulation must be done from the client
because
it
is a client control.

For the unload process, place a text box on the form, set it's
visible
property to false. Put a webserver button on the form. Set its click
event
to a loadData function that you will write next.

For the loadData function, unload the contents of the spreadsheet
into
the
server textbox control. texdbox1.text = sp1.CSVDATA;

The idea so far is that clicking on the webserver control will first
execute
the client side function that causes the spreadsheet to unload its
contents
to the textbox, then the webserver control will fire the page_load
event
followed by the button_click event on the server. Ignore the button
click
event. In your page_load event, test the contents of the textbox
control
and
iterate its contents to extract the data.
Here is the bulk of the code.


Page_Load

if(TextBox1.Text.Trim() != string.Empty)
{
string[] rows =
TextBox1.Text.ToString().Split(Environtment.Newline);
//or '\n'
foreach(string str in rows)
{
string[] columns = rows.ToString().Split(',');
foreach(string col in columns)
{
//collect your data per row here and do what you must
}
}
//re-initialize
TextBox1.Text = string.Empty;
}

Your load function follows roughly the same script idea, except that
it
loads data
--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
message
Alvin,
Can you point me in the right direction? I have spent
too much time on this and I want to get a working
solution.
I have been able to write some vbscript to SS1.Export
command for the spreadsheet but I want to do this via c#
code if possible...Also when I do the export command I am
always prompted if I want to save the file... is there a
way to supress this?
I want to control the spreadsheet via my c# code and not
have to use vbscript. Since I haven't been able to use
the online Doc to recompile the dll I don't know if that
will help me or not... Is there a way to just get a
compiled DLL sent to me? Frustrated...
-----Original Message-----
give me the exact error information and the line you
followed to get that.
this needs to be corrected in the documentation and I
keep forgetting to
submit it.

the office web components are client-side controls. they
run on the client,
not on the server. they do not have a handle on the
server so you will not
be able to manipulate these controls from the server.
However, you can use
attributes to attain some semblance of server-side
automation. Have a look
at my website, it details some examples about the
process.
http://tinyurl.com/27cok

--
Regards,
Alvin Bruney
[ASP.NET MVP
http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
in message
I am trying to add a spreadsheet component to my web
page
in .NET (c#). When I add the spreadsheet to my form I
cannot use its methods from within my .net code.
I found a Microsoft article #328275 'How to handle
events
for the Office Web Components in Visual Studio .NET'
which basically walks you through the process of
recompling a DLL which is part of the OWC controls...
when I tried these steps, I always get compilied errors
on step 11 (compile the source file, AxOWC10.cs). I
have
tried this on two different machines... same result...
I am just trying to get the spreadsheet control so
that I
can use its methods from my .net c# code... any ideas?



.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top