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?
.