前台定义:
<body>
<form id="form1" runat="server">
<div>
<object id="sheet" classid="clsid:0002E559-0000-0000-C000-000000000046" name="sheet">
</object>
</div>
</form>
</body>后台: protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Microsoft.Office.Interop.Owc11.SpreadsheetClass sheet = new Microsoft.Office.Interop.Owc11.SpreadsheetClass();
sheet.ActiveCell[1,1] = "1";
}
}为什么运行后页面上的excel单元格里没有得到在后台赋的值?另求关于owc的资料,谢谢
<body>
<form id="form1" runat="server">
<div>
<object id="sheet" classid="clsid:0002E559-0000-0000-C000-000000000046" name="sheet">
</object>
</div>
</form>
</body>后台: protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Microsoft.Office.Interop.Owc11.SpreadsheetClass sheet = new Microsoft.Office.Interop.Owc11.SpreadsheetClass();
sheet.ActiveCell[1,1] = "1";
}
}为什么运行后页面上的excel单元格里没有得到在后台赋的值?另求关于owc的资料,谢谢
解决方案 »
- 无刷新下拉框取值
- 怎样在IIS虚拟目录下配置伪静态
- 为gridview中的一个dropdownlist添加事件出错
- 求含有定义HtmlTableBodySection,HtmlTableHeaderSection 和 HtmlTableFooterSection的system.web.dll
- gridview排序不好使呀?对数字排序只安第一个数字进行排序!
- 请问在DataGrid中内容缩略的方法,比如“遵守中华人民共和国有关法律”,显示为“遵守中华人民共和国。。。”
- 哪位兄弟有treeview控件,iewencontrols.exe下载,请赶快发给兄弟一份.谢谢
- 麻烦大虾传授.NET源代码的研究方法,推荐一些适合初学者研究的asp.net代码
- 单击 某行 改变gridview颜色
- 谁能给我一个根据xml动态生成treeview的简单例子?
- 字符串小问题,请大家帮忙?
- 打开一个网站的时候如何才能得到页面正在加载中的效果?
IE里把相关的权限都放开吧,这东西现在浏览器很限制的.
{
//创建ChartSpace对象来放置图表
Microsoft.Office.Interop.Owc11.ChartSpace objCSpace = new Microsoft.Office.Interop.Owc11.ChartSpaceClass(); //在ChartSpace对象中添加图表,Add方法返回chart对象
Microsoft.Office.Interop.Owc11.ChChart objChart = objCSpace.Charts.Add(0); //指定图表的类型。类型由OWC.ChartChartTypeEnum枚举值得到
objChart.Type = Microsoft.Office.Interop.Owc11.ChartChartTypeEnum.chChartTypeColumnClustered; //指定图表是否需要图例
objChart.HasLegend = true; //给定标题
objChart.HasTitle = true;
objChart.Title.Caption = "分析图"; //给定x,y轴的图示说明
objChart.Axes[0].HasTitle = true;
objChart.Axes[0].Title.Caption = " X: 單位名稱";
objChart.Axes[1].HasTitle = true; objChart.Axes[1].Title.Caption = " Y: 金額"; //取得部門和金額
string arryStrDeprt=string.Empty;
string arryStrMoney = string.Empty;
for (int a = 0; a < _JcOrderVig.Rows.Count; a++)
{
arryStrDeprt = arryStrDeprt + ";" + _JcOrderVig.Rows[a].Cells[0].Text.ToString();
arryStrMoney = arryStrMoney + ";" + _JcOrderVig.Rows[a].Cells[2].Text.ToString();
}
string[] arryDeprt = arryStrDeprt.Split(';');
string[] arryMoney = arryStrMoney.Split(';');
string strCategory ="";
string strValue = "";
for (int i = 1; i < arryDeprt.Length; i++)
{
strCategory =strCategory+ arryDeprt[i] + '\t';
strValue =strValue+ arryMoney[i] + '\t';
}
string strSeriesName = "图例";
//添加一个series
objChart.SeriesCollection.Add(0); //给定series的名字
objChart.SeriesCollection[0].SetData(Microsoft.Office.Interop.Owc11.ChartDimensionsEnum.chDimSeriesNames,
+(int)Microsoft.Office.Interop.Owc11.ChartSpecialDataSourcesEnum.chDataLiteral, strSeriesName); //给定分类
objChart.SeriesCollection[0].SetData(Microsoft.Office.Interop.Owc11.ChartDimensionsEnum.chDimCategories,
+(int)Microsoft.Office.Interop.Owc11.ChartSpecialDataSourcesEnum.chDataLiteral, strCategory); //给定值
objChart.SeriesCollection[0].SetData
(Microsoft.Office.Interop.Owc11.ChartDimensionsEnum.chDimValues,
(int)Microsoft.Office.Interop.Owc11.ChartSpecialDataSourcesEnum.chDataLiteral, strValue);
//输出成GIF文件.
string strAbsolutePath = (Server.MapPath(".")) + "\\test.gif";
objCSpace.ExportPicture(strAbsolutePath, "GIF", 600, 500); //创建GIF文件的相对路径.
string strRelativePath = "./test.gif"; //把图片添加到placeholder.
string strImageTag = "<IMG SRC='" + strRelativePath + "'/>";
ChartHolder.Controls.Add(new LiteralControl(strImageTag));
}