 |
|
ASP.Net สอบถามการเซฟรูป Chart เป็น ไฟล์ .ppt ครับ ^ ^" |
|
 |
|
|
 |
 |
|
ตอนนี้ใช้ Library ตัวไหนครับ 
|
 |
 |
 |
 |
Date :
2013-06-18 16:41:36 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ต้องขอโทษด้วยนะครับ ผมพึ่งทดลองเขียนครั้งแรกเลยยังไม่ค่อยทราบว่าต้องดตรงไหนหรือครับ ^ ^"
Code (C#)
<%@ Page Language="C#" Debug="true" %>
<%@ Import Namespace="ChartDirector" %>
<%@ Register TagPrefix="chart" Namespace="ChartDirector" Assembly="netchartdir" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
double[] dataX0 = {1000};
double[] dataY0 = {25};
double[] dataZX0 = {350};
double[] dataZY0 = {8};
double[] dataX1 = {500};
double[] dataY1 = {35};
double[] dataZX1 = {350};
double[] dataZY1 = {8};
double[] dataX2 = {250};
double[] dataY2 = {10};
double[] dataZX2 = {350};
double[] dataZY2 = {8};
XYChart c = new XYChart(450, 420);
c.setPlotArea(55, 65, 350, 300, -1, -1, 0xc0c0c0, 0xc0c0c0, -1);
c.addLegend(50, 30, false, "Times New Roman Bold Italic", 12).setBackground(
Chart.Transparent);
c.addTitle("ทดสอบ", "Times New Roman Bold Italic", 18);
c.xAxis().setWidth(3);
c.yAxis().setWidth(3);
c.addScatterLayer(dataX0, dataY0, "", Chart.CircleSymbol, 9,
unchecked((int)0xff3333), unchecked((int)0xff3333)).setSymbolScale(
dataZX0, Chart.XAxisScale, dataZY0, Chart.YAxisScale);
c.addScatterLayer(dataX1, dataY1, "", Chart.CircleSymbol, 9,
unchecked((int)0x3333ff), unchecked((int)0x3333ff)).setSymbolScale(
dataZX1, Chart.XAxisScale, dataZY1, Chart.YAxisScale);
c.addScatterLayer(dataX2, dataY2, "", Chart.CircleSymbol, 9,
unchecked((int)0x00ff00), unchecked((int)0x00ff00)).setSymbolScale(
dataZX2, Chart.XAxisScale, dataZY2, Chart.YAxisScale);
WebChartViewer1.Image = c.makeWebImage(Chart.PNG);
}
</script>
<html>
<body>
<chart:WebChartViewer id="WebChartViewer1" runat="server" />
</body>
</html>
อันนี้คือโค้ดผมครับ อาจารย์อยากให้ผมเซฟรูปChart เเล้วเปิดโปรแกรม Powerpoint ออกมาน่ะครับ พอจะมีเเนวทางที่เป็นไปได้ไหมครับ ^ ^"
|
 |
 |
 |
 |
Date :
2013-06-18 17:01:12 |
By :
Spada_555 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
และก็
Code (C#)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ChartDirector;
น่ะครับ ^ ^"
|
ประวัติการแก้ไข 2013-06-19 15:19:31 2013-06-19 15:19:54
 |
 |
 |
 |
Date :
2013-06-19 13:20:55 |
By :
Spada_555 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตอนนี้ผมลอง ใส่โค้ดพวกนี้เข้าไปเพิ่มน่ะครับ
protected void Button1_Click(object sender, EventArgs e)
{
//GridView1.AllowPaging = false; //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";
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.
}
public override void VerifyRenderingInServerForm(Control control)
{
//Keep it empty
}
ทำให้เมื่อแสดงผลกราฟแล้วมีปุ่มข้างๆ กด Button เเล้วัมนเซฟเป็น .ppt ไว้ พอกดเปิดไฟล์ .ppt ขึ้นมา กลับเป็นหน้าว่างๆอะครับ

Edit ----> ตอนนี้ผมเปลี่ยนเป้าหมายการดำเนินงานเเล้วครับ คือไม่จำเป็ฯต้องใช้โค้ดก็ได้ครับ ขอแค่มีโปรแกรมหรือtools ที่สามารถConvert Chart ไปเป็น ppt ก็พอครับ พอจะมีคำแนะนำหรือแหล่งศึกษาเพิ่มเติมบ้างไหมครับ ^ ^"
|
ประวัติการแก้ไข 2013-06-19 15:25:44 2013-06-19 16:59:57
 |
 |
 |
 |
Date :
2013-06-19 15:23:32 |
By :
Spada_555 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมลองค้นๆดู ใช้อันนี้อะครับ Microsoft Power point 11.0 Object Library
|
 |
 |
 |
 |
Date :
2013-06-20 09:57:15 |
By :
Spada_555 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|