Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 15th, 2007, 09:32 PM
Registered User
 
Join Date: Mar 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Export excel error fomula

        Microsoft.Office.Interop.Excel.Application oExcel = null;
        //Microsoft.Office.Interop.Excel.Workbook oBook = null;
        Microsoft.Office.Interop.Excel._Workbook oBook = null;
        Microsoft.Office.Interop.Excel.Worksheet oSheet = null;
        Microsoft.Office.Interop.Excel.Range oRng;
        object missing = Type.Missing;

        try
        {
            oExcel = new Microsoft.Office.Interop.Excel.Application();

            oBook = oExcel.Workbooks.Open("E:\\demo\\11-3-07\\FasterServices\\WebSite\\bill\\bill.xls", missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing);
            //oExcel.Visible = true;

            oBook.Activate();
            oSheet = (Microsoft.Office.Interop.Excel.Worksheet)oBook.Wo rksheets["gen"];
            oSheet.get_Range("D33", "D33").Formula = "=BAHTTEXT(I31)";
            //oSheet.get_Range("D33", "D33").set_Value(Type.Missing, "=BAHTTEXT(I31)");



            oSheet.SaveAs("C:\\Documents and Settings\\Administrator\\Desktop\\NMDS1.xls", Microsoft.Office.Interop.Excel.XlFileFormat.xlExce l7, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
            oExcel.Quit();
            System.Runtime.InteropServices.Marshal.ReleaseComO bject(oExcel);
            System.Runtime.InteropServices.Marshal.ReleaseComO bject(oBook);

            System.GC.Collect();

        }
        catch (Exception ex)
        {
            //Response.Write("Error accessing Excel: " + ex.ToString());
        }

I use that code obove for export data to excel but I have got this error below about formula please help or suggest.


"A formula in a cell could not be converted because it contains a function that is not available in the file formate to which you are saving. "






Similar Threads
Thread Thread Starter Forum Replies Last Post
Export to Excel Suresh62 Access 0 May 19th, 2008 06:38 AM
Export Excel abdou Classic ASP Basics 6 February 18th, 2007 09:18 PM
Export To Excel JaCkSoN Tay VS.NET 2002/2003 2 June 30th, 2005 07:57 PM
excel export giving memory error msrnivas .NET Web Services 0 September 6th, 2004 12:09 AM
excel export msrnivas .NET Web Services 1 June 10th, 2004 08:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.