OWC11 and Visual Studio 2005 web application

J

John Eiford

I have started a new web application project with the intention of using the
OWC11 spreadsheet component only to discover that VS2005 and OWC11 don't play
nice.
My imediate goal is just have a button to put text into the spreadsheet
using ASP.NET 2.0 Is this possible?

I added the spreadsheet object, two buttons, and a textbox.
The button should put the contents of the textbox into cell A1 of the
spreadsheet but the project will not compile because of an error about the
object clsid. Can anyone shed some light on this problem? Error, and all
code is below.

Error 1 Guid should contain 32 digits with 4 dashes
(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx). C:\Documents and Settings\jhopping\My
Documents\Visual Studio 2005\WebSites\WebSite5\Default.aspx 31


The aspx file:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"
Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<object id="myOWC" runat="server"
classid="CLSID:0002E559-0000-0000-C000-000000000046" style="width:
760px; height: 424px">
</object>
<br /><br />

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" />
</div>
</form>

</body>
</html>


The aspx.vb file:

Partial Class _Default
Inherits System.Web.UI.Page
Private myOWC As Microsoft.Office.Interop.Owc11.Spreadsheet

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
myOWC.ActiveSheet.Cells(1, 1) = TextBox1.Text

End Sub
End Class
 
A

Alvin Bruney [MVP]

The OWC is a client side object, it does not run on the server so you code
will never compile successfully. You need a suitable resource to guide you
thru understanding the components. Currently, there are three books and lots
of code snippets in this newsgroup and the office website that will help you
learn to use the OWC effectively.

--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
 

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