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文件