ComponentOne Excel for .NET
In This Topic
    Excel for .NET Frequently Asked Questions
    In This Topic

    The following questions were compiled from frequently asked user questions about Excel for .NET.

    Does Excel for .NET support creating or adding formulas or named ranges?

    Yes, Excel for .NET supports formulas and named ranges.

    Full support for binary parsing and creating formulas was added in the 2009 v2 release of the ComponentOne Studio. For example, suppose you have the following C# code:

    To write code in C#

    C#
    Copy Code
    private void Form1_Load(object sender, EventArgs e)
            {
                C1.C1Excel.XLSheet sheet = c1XLBook1.Sheets[0];
                sheet[4, 1].Value = "apples and oranges";
                sheet[5, 1].Value = "apples an";       // <-- result of the formula
                sheet[5, 1].Formula = "LEFT(B5,9)";
                c1XLBook1.Save(@"c:\mybook.xls");
                System.Diagnostics.Process.Start(@"c:\mybook.xls");
            }
    

    When the program runs, the resulting spreadsheet looks like the following:


    The formula gets the information stored in column B5 and nine characters starting from the left, or "apples an".

    Can Excel for .NET be used on an ASP.NET 2.0 page?

    Yes it can, but there is an extra step to perform in order to be able to use Excel for .NET and other non GUI .NET controls in an ASP.NET 2.0 page. You must go to View|Component Designer from the main menu, or select "View Component Designer" from the context menu of the design view of an .aspx page. This will display an area where you can drag and drop the C1XLBook component to add it to your Web form.