Silverlight4中的电子表格 [英] spreadsheet in silverlight4

查看:73
本文介绍了Silverlight4中的电子表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将该项目作为c#进行编码并在silverlight4中进行设计...

这是在Silverlight4中制作Excel工作表的一项要求..

这是我在设计页面中完成的编码.
< usercontrol x:class ="SilverlightExcel.MainPage"
=" xmlns ="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x ="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d ="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc =" http://schemas.openxmlformats.org/markup-compatibility/2006"mc:ignorable =" d"d:designheight =" 300 "d:designwidth =" 400>


< grid x:name ="LayoutRoot" background ="White">



****************************************************** ***********************************************

这是.cs页面中的编码



使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用System.Net;
使用System.Windows;
使用System.Windows.Controls;
使用System.Windows.Documents;
使用System.Windows.Input;
使用System.Windows.Media;
使用System.Windows.Media.Animation;
使用System.Windows.Shapes;
使用System.Windows.Interop;


命名空间SilverlightExcel
{
公共局部类MainPage:UserControl
{
公共MainPage()
{
InitializeComponent();
}


私有void Button_Click(对象发送者,RoutedEventArgs e)
{
动态excel = ComAutomationFactory.CreateObject("Excel.Application");
excel.Visible = true;


动态工作簿= excel.workbooks;
workbook.Add();
动态工作表= excel.ActiveSheet;


动态范围;


范围= sheet.Range("A1");
range.Value =你好,来自Silverlight";
范围= sheet.Range("A2");
range.Value ="100";
范围= sheet.Range("A3");
range.Value ="50";
范围= sheet.Range("A4");
range.Formula ="= @ Sum(A2..A3)";
range.Calculate();
}
}
}


我在哪里出错了....当我构建这个项目时...成功了...但是在运行时它什么也没显示...

请帮帮我..
尽快..
感谢所有提前完成的人

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"
="" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d" d:designheight="300" d:designwidth="400">


<grid x:name="LayoutRoot" background="White">



*********************************************************************************************

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()
{
InitializeComponent();
}


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


dynamic workbook = excel.workbooks;
workbook.Add();
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)";
range.Calculate();
}
}
}


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

推荐答案

您是否期望Excel弹出?当然您必须将Excel嵌入到您的silverlight应用程序中吗?这是从MS样本中复制过来的吗?
You''re expecting Excel to just pop up ? Surely you have to embed Excel into your silverlight app ? Is this copied from a MS sample ?


这篇关于Silverlight4中的电子表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆