2012-08-08 76 views
-1

我试图导出一个饼图来PowerPoint幻灯片uisng C#中,但没有发现任何类似的文章,可以帮助我...出口饼图到PowerPoint使用C#

,请给我一些例子,或者提供一些有用的链接这可以帮助我轻松地实现这一功能...

感谢, 阿曼

回答

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的功能一样,你必须设置我们使用hipdf

<%@ Page Language="C#" EnableEventValidation="false" %> 
+0

请加一些细节,这样我们就可以理解你的代码示例 – oberfreak 2012-10-04 13:49:16

+0

@oberfreak如果你能仔细阅读,你会看到它的自我代码的内部细节做到这一点。 – KKP 2012-10-04 22:00:22

1

财产这个

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

,避免异常,但这种支付我们正在第一转换HTML到图像,然后显示在PPT幻灯片这个图像。您也可以通过使用Inkscape的exe文件