Create a new Web Site Project

1.            Launch Visual Studio 2005 or Visual Web Developer Express Edition.

2.            On the File menu, point to New and click Web Site (New Web Site… in Visual Web Developer Express). The New Web Site dialog box appears.

3.            Under Templates, click ASP.NET Web Site.

4.            Change the Location as desired.  Set the Language to Visual C#.

5.            Click OK to create the project.

 

Add a reference to "SpreadsheetGear"

1.            In Solution Explorer, select the Web Site you just created.

2.            On the Website menu, click Add Reference. The Add Reference dialog box appears.

3.            In the Add Reference dialog box, click the .NET tab. A list of .NET components appears.

4.            In the list of .NET components, click SpreadsheetGear.

5.            Click OK to add the reference.

 

Add a label to Default.aspx

1.           Click on the Default.aspx window tab.

2.           On the left-hand side, near the bottom click on Design to switch to Design view.

3.           On the View menu click Toolbox.  The Toolbox appears.

4.           In the Standard tab click and drag a Label onto the Design view of Default.aspx.

 

Add code to create a workbook and calculate a value

1.            In Solution Explorer, right-click Default.aspx and click View Code.

2.            Replace the page’s Load event with:

 

    protected void Page_Load(object sender, EventArgs e)

    {

        // Create a new empty workbook in a new workbook set.

        SpreadsheetGear.IWorkbook workbook = SpreadsheetGear.Factory.GetWorkbook();

        // Get a reference to the first worksheet.

        SpreadsheetGear.IWorksheet worksheet = workbook.Worksheets["Sheet1"];

        // Get a reference to the top left cell of Sheet1.

        SpreadsheetGear.IRange a1 = worksheet.Cells["A1"];

        // Set a formula.

        a1.Formula = "=24901.55 / PI()";

        // Output the result of the formula in a label.

        Label1.Text = "The diameter of the earth is " + a1.Value + " miles.";

    }

 

Build and Run the application

1.            On the Build menu, click Build Solution (Build Web Site in Visual Web Developer Express). The solution builds with no errors.

2.            On the Debug menu, click Start Without Debugging. The application runs in Internet Explorer and displays:

The diameter of the earth is 7926.40954629997 miles.