-1

我正在尝试将饼图导出到 powerpoint slide uisng c#,但没有找到任何可以帮助我的类似文章...

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

谢谢,阿曼

4

2 回答 2

1

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

于 2012-10-04T10:54:41.387 回答
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" %>
于 2012-08-08T05:10:00.230 回答