Is it possible to actually build a spreadsheet using SpreadsheetClass,
You want to do something like this [code attached below] to build the
spreadsheet on the server. [This is for a pivot table but you can easily
change it to work with a spreadsheet]. I've used a live spreadsheet instead
of building it from a class. That way, the gui is available to me. I then
source the chart from the pivot table and embed the whole thing in the http
stream and push it to the client. That should be enough to get you started.
section 4.12 black book
C# snippet
if(Request.Browser.ActiveXControls)
{
Response.Write("<OBJECT id='pTable' classid='clsid:0002E55A-0000-0000-C000-000000000046'VIEWASTEXT></OBJECT>"); Response.Write("<OBJECT id='chart1' classid='clsid:0002E55D-0000-
0000-C000-000000000046'VIEWASTEXT></OBJECT>");
//send the load instructions to load client-side data
Response.Write(@"<script>pTable.ConnectionString =
'Provider=MSDASQL.1;Persist Security Info=True;Extended
Properties=\'DSN=MS Access Database;DBQ=C:\\Program Files\\Microsoft
Office\\OFFICE11\\SAMPLES\\ Northwind.mdb;\';Initial Catalog=C:\\Program
Files\\Microsoft Office\\OFFICE11\\SAMPLES\\Northwind'</script>");
//Response.Write(@"<script>pTable.ConnectionString =
'Provider=MSDASQL.1;Persist Security Info=False;Extended
Properties=\'DSN=sampledb;\''</script>");
Response.Write("<script>pTable.DataMember = 'SampleDb'</script>");
Response.Write("<script>chart1.DataMember = 'pTable'</script>");
}
--
Regards,
Alvin Bruney - ASP.NET MVP
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @
www.lulu.com/owc
Gavin Pollock said:
Having had a look slightly more in depth, I've realised that an XML
worksheet can't contain a chart object anyway. So surely it would not be
possible to do as I planned using OWC?
I can see it might be possible to do it using Excel automation itself and
returning a full xls file down the HTTP stream (implications of
server-side excel automation - ouch!), but I can't see any other paths...
Any suggestions would be great!
Gavin Pollock said:
Ah... that black book. Missed that. duh.
Hmmm... slight dilemna as this need is immediate. Anyone out there with
some sample code I could have a look at?
Alvin Bruney said:
Yes it's possible. Some sample code is included in the blackbook.
However, you must be aware of the licensing issues with that approach.
Your clients must have an installed version of Microsoft Office - in a
nutshell.
--
Regards,
Alvin Bruney - ASP.NET MVP
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @
www.lulu.com/owc
Hi there,
Is it possible to actually build a spreadsheet using SpreadsheetClass,
and embed a chart in the spreadsheet, and then return that through the
HTTP stream?
I want to return a document to users that has data and charts in, that
they can then take as a template, and format how they want. Is that
possible?
Cheers
Gavin