Hello, I have a template presentation in which there is a Chart.
The formating of the chart in my template is perfect but when I modify the data in the sexcel sheets, I'm losing the marhertype I originally identified.
Can you tell me what am I doing wrong and/or how to set the markertype of my line in my chart.
Thank you
PS: I'm using Aspose Slide Net2.0 date 2011-02-07
Here is my code:
public void GeneratePpt(List variables)
{
var fichier = Server.MapPath(@"\\Files\PowerPoint\Template\ExecutiveKpiWithChartAndTable.pptx");
var fs = new FileStream(fichier, FileMode.Open, FileAccess.Read);
var myPres = new PresentationEx(fs);
fs.Close();
// Accessing a slide
var mySlide = myPres.Slides[0];
foreach (var var in variables)
{
var shapes = mySlide.Shapes;
for (int i = 0; i < shapes.Count; i++)
{
var shape = shapes[i];
if (shape is ChartEx)
{
var ch = (ChartEx)shape;
var ws = ch.ChartData.Workbook.Worksheets[0];
for (var j = 0; j < 12; j++)
{
var cell = ws.Cells[1, j + 1];
cell.PutValue(var.Data[0].MonthlyActual[j]);
var style = cell.GetStyle();
style.Number = AsposeTools.ReturnCellType(var.Format);
cell.SetStyle(style);
var cell2 = ws.Cells[2, j + 1];
cell2.PutValue(var.Data[0].MonthlyTarget[j]);
var style2 = cell.GetStyle();
style2.Number = AsposeTools.ReturnCellType(var.Format);
cell.SetStyle(style2);
var cell3 = ws.Cells[3, j + 1];
cell3.PutValue(var.Data[0].MonthlyActual[j + 12]);
var style3 = cell.GetStyle();
style3.Number = AsposeTools.ReturnCellType(var.Format);
cell.SetStyle(style3);
}
//ch.ChartData.AddSeries("A2:M2", ws);
//var series1 = ch.ChartData.GetSeries(0);
//series1.GetType().MakePointerType().m
//series1.Name = "PREAPPROVED";
//series1.Line.Weight = WeightType.SingleLine;
//series1.MarkerStyle = ChartMarkerType.None;
//series1.MarkerSize = 8;
//series1.MarkerForegroundColor = System.Drawing.Color.Blue;
//series1.Line.Color = System.Drawing.Color.FromArgb(79, 129, 189);
//series1.MarkerBackgroundColor = System.Drawing.Color.Transparent;
}
}
}
// Prepare output stream to receive a PowerPoint Presentation
Response.ContentType = "application/vnd.ms-powerpoint";
Response.AppendHeader("Content-Disposition", "attachment; filename=ExecutiveKpi.ppt");
var st = Response.OutputStream;
// Send the finished presentation to the page output stream
myPres.Write(st);
Response.End();
}