Re: owc not working
From: DC Gringo (dcgringo_at_visiontechnology.net)
Date: 02/16/05
- Next message: SK: "Hashtable"
- Previous message: Bill Borg: "Re: FormsAuthentication.RedirectFromLoginPage"
- In reply to: Chris Calzaretta: "Re: owc not working"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 16 Feb 2005 16:37:57 -0500
Yes, I realize that. The only thing this application is doing is creating
the .xls file then allowing the user to download it. It will be expected
that clients have Excel on their machines. That being said, is there some
wrong with my code?
_____
DC G
"Chris Calzaretta" <ccalzaretta@hotmail.com> wrote in message
news:eprhBPGFFHA.3840@tk2msftngp13.phx.gbl...
> From what I understand about the office ccomponents is that the client
must
> have office installed on there machine. Your not licence to distribute the
> office comopnents.
> You can only use them.
> Not 100% on this only about 90%
>
> Chris
> "DC Gringo" <dcgringo@visiontechnology.net> wrote in message
> news:uoexQ0FFFHA.3376@TK2MSFTNGP12.phx.gbl...
> > Allison (or others), thank you for the advice...a few more questions:
> >
> > - I have tested on my workstation on Excel XP and my application
> > references
> > the Excel 10.0 Object Library. I was told the server has the "Office
> > 2003"
> > components which I'm assuming is OWC11. How do my imports, declarations
> > or
> > other code change to account for the components versus having Excel
> > installed?
> >
> >
> > Imports Microsoft.VisualBasic
> > Imports System.Data
> > Imports System.Runtime.InteropServices.Marshal
> >
> >
> > Private Function DumpData(ByVal _
> > dt As DataTable, ByVal oCells As Excel.Range) As String
> > Dim dr As DataRow, ary() As Object
> > Dim iRow As Integer, iCol As Integer
> >
> > 'Output Column Headers
> > For iCol = 0 To dt.Columns.Count - 1
> > oCells(2, iCol + 1) = dt.Columns(iCol).ToString
> > Next
> >
> > 'Output Data
> > For iRow = 0 To dt.Rows.Count - 1
> > dr = dt.Rows.Item(iRow)
> > ary = dr.ItemArray
> > For iCol = 0 To UBound(ary)
> > oCells(iRow + 3, iCol + 1) = ary(iCol).ToString
> > Response.Write(ary(iCol).ToString & vbTab)
> > Next
> > Next
> > End Function
> >
> > Public Sub btnCommunitiesExcel_OnClick(ByVal sender As System.Object,
> > ByVal e As System.EventArgs)
> > Dim oExcel As New Excel.Application
> > Dim oBooks As Excel.Workbooks, oBook As Excel.Workbook
> > Dim oSheets As Excel.Sheets, oSheet As Excel.Worksheet
> > Dim oCells As Excel.Range
> > Dim sFile As String, sTemplate As String
> > Dim ds As New DataSet
> > Dim da As New SqlDataAdapter(Session("savedCommunitiesSql"),
> > connection1.conString)
> > da.Fill(ds, "CommunitiesExcel")
> > Dim dt As DataTable = ds.Tables("CommunitiesExcel")
> >
> > sFile = Server.MapPath(Request.ApplicationPath) & _
> > "\advanced\ExcelExports\Communities.xls"
> >
> > sTemplate = Server.MapPath(Request.ApplicationPath) & _
> > "\advanced\ExcelExports\CommunitiesTemplate.xls"
> >
> > oExcel.Visible = False : oExcel.DisplayAlerts = False
> >
> > 'Start a new workbook
> > oBooks = oExcel.Workbooks
> > oBooks.Open(Server.MapPath(Request.ApplicationPath) & _
> > "\advanced\ExcelExports\CommunitiesTemplate.xls") 'Load colorful
> > template with chart
> > oBook = oBooks.Item(1)
> > oSheets = oBook.Worksheets
> > oSheet = CType(oSheets.Item(1), Excel.Worksheet)
> > o***.Name = "First ***"
> > oCells = o***.Cells
> >
> > DumpData(dt, oCells) 'Fill in the data
> >
> > o***.SaveAs(sFile) 'Save in a temporary file
> > oBook.Close()
> >
> > 'Quit Excel and thoroughly deallocate everything
> > oExcel.Quit()
> > ReleaseComObject(oCells) : ReleaseComObject(o***)
> > ReleaseComObject(oSheets) : ReleaseComObject(oBook)
> > ReleaseComObject(oBooks) : ReleaseComObject(oExcel)
> > oExcel = Nothing : oBooks = Nothing : oBook = Nothing
> > oSheets = Nothing : oSheet = Nothing : oCells = Nothing
> > System.GC.Collect()
> > Response.Redirect(sFile) 'Send the user to the file
> >
> > 'impersonationContext.Undo()
> >
> > End Sub
> >
> >
> > "allison" <psychatricmeuh@caramail.com> wrote in message
> > news:54578b6e.0502160040.543470c8@posting.google.com...
> >> "DC Gringo" <dcgringo@visiontechnology.net> wrote in message
> > news:<uQByG3rEFHA.3596@TK2MSFTNGP12.phx.gbl>...
> >> > I have some vb.net code that creates an Excel document for download.
> >> > It
> >> > works fine on my workstation (with Excel installed) but fails on the
> > server
> >> > where OWC is installed (latest version). I have a standard reference
> >> > to
> >> > Excel in my project. The error I get is: COM object with CLSID
> >> > {00024500-0000-0000-C000-000000000046} is either not valid or not
> > registered
> >>
> >> hello!
> >> your problem comes from the version of excel. you seem to have develop
> >> your application with owc 10 or 9, and the server may has owc11. to
> >> correct this error, you should developp your app with the same version
> >> of excel than your server.
> >> Excel2000 => owc9
> >> ExcelXP => owc10
> >> Excel2003 => owc11
> >> If you don't want to change the version of office, you can get
> >> owc11.exe on microsoft website.
> >
> >
>
>
- Next message: SK: "Hashtable"
- Previous message: Bill Borg: "Re: FormsAuthentication.RedirectFromLoginPage"
- In reply to: Chris Calzaretta: "Re: owc not working"
- Messages sorted by: [ date ] [ thread ]