excel in silverlight4 RRS feed

  • Question

  • I am makimg the project as coding in c# and designing in silverlight4...

    here is one requirement of making excel sheet in silverlight4..

    this is a coding i have done in designing page..

    <UserControl x:Class="SilverlightExcel.MainPage"
        d:DesignHeight="300" d:DesignWidth="400">

        <Grid x:Name="LayoutRoot" Background="White">
            <Button Content="Create XLS" Width="100" Height="30" Click="Button_Click" />
    and this is the coding in  .cs page

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;
    using System.Windows.Interop;

    namespace SilverlightExcel
        public partial class MainPage : UserControl
            public MainPage()

            private void Button_Click(object sender, RoutedEventArgs e)
                dynamic excel = ComAutomationFactory.CreateObject("Excel.Application");
                excel.Visible = true;

                dynamic workbook = excel.workbooks;
                dynamic sheet = excel.ActiveSheet;

                dynamic range;

                range = sheet.Range("A1");
                range.Value = "Hello from Silverlight";
                range = sheet.Range("A2");
                range.Value = "100";
                range = sheet.Range("A3");
                range.Value = "50";
                range = sheet.Range("A4");
                range.Formula = "=@Sum(A2..A3)";
    Where I am doing the mistake ....when i build this project...it succeeded...but at run time it is not showing anything...
    please help me..
    as soon as possible..
    thanks to all in advance

    Friday, January 8, 2010 11:25 AM