使用c#将饼图导出到powerpoint

时间:2012-08-08 04:18:19

标签: asp.net c#-4.0 powerpoint pie-chart

我正在尝试将饼图导出到幻灯片uisng c#但未找到任何可以帮助我的类似文章......

请提供一些示例或提供一些有用的链接,以帮助我轻松实现此功能...

感谢, 阿曼

2 个答案:

答案 0 :(得分:1)

我们正在使用hipdf库,但这是付费的,我们首先将html转换为图片,然后在ppt幻灯片上显示此图片。您也可以使用inkscape exe文件

来完成

答案 1 :(得分:0)

在button_click事件中编写以下代码。

GridView1.AllowPaging = false; //write this code only if paging is enabled.
GridView1.DataBind(); //write this code only if paging is enabled.

Response.Clear();

Response.AddHeader("content-disposition", "attachment;filename=FileName.ppt");//for text file write FileName.txt

Response.Charset = "";

// If you want the option to open the Excel file without saving than comment out the line below
// Response.Cache.SetCacheability(HttpCacheability.NoCache);

Response.ContentType = "application/vnd.ppt";\\for text file write vnd.txt

System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
GridView1.RenderControl(htmlWrite);

Response.Write(stringWrite.ToString());

Response.End();

GridView1.AllowPaging = true; //write this code only if paging is enabled.

GridView1.DataBind();//write this code only if paging is enabled.

你必须像这样覆盖VerifyRenderingInServerForm的功能

public override void VerifyRenderingInServerForm(Control control)
{
    //Keep it empty
}

为避免异常,您必须设置

的属性
<%@ Page Language="C#" EnableEventValidation="false" %>