B
Brian Campbell
I have a .net web application which generates ppt
documents for users. Everything works except the charts
do not show up (ie slide titles, footer, textboxes are all
on the slide). I created a web form application and the
charts do show up. Can anyone give me some guidance on
how to get the web app to work properly?
Here is some sample code which works for the form app but
not the web app.
....
//Slide #2:
objSlide = objSlides.Add(2,
PowerPoint.PpSlideLayout.ppLayoutTitleOnly);
objTextRng = objSlide.Shapes[1].TextFrame.TextRange;
objTextRng.Text = "Chart Test";
objTextRng.Font.Name = "Comic Sans MS";
objTextRng.Font.Size = 48;
objChart = (Graph.Chart) objSlide.Shapes.AddOLEObject
(150,150,480,320,"MSGraph.Chart", "",
MsoTriState.msoFalse, "", 0, "",
MsoTriState.msoFalse).OLEFormat.Object;
objChart.HasDataTable = true;
objChart.ChartType = Graph.XlChartType.xlXYScatterLines;
objChart.BarShape = Graph.XlBarShape.xlCylinder;
objDataSheet = objChart.Application.DataSheet;
objDataSheet.Cells.Clear();
objDataSheet.Cells[2,2] = 3;
objDataSheet.Cells[3,2] = 10;
objDataSheet.Cells[4,2] = 4;
objDataSheet.Cells[2,3] = 6;
objDataSheet.Cells[3,3] = 7;
objDataSheet.Cells[4,3] = 9;
objChart.HasLegend = true;
objChart.Application.Update();
objChart.HasTitle = true;
objChart.ChartTitle.Text = "The title";
....
objPres.SaveAs( directoryPath + "MicrosoftExample.ppt",
PowerPoint.PpSaveAsFileType.ppSaveAsPresentation,
Microsoft.Office.Core.MsoTriState.msoTrue );
documents for users. Everything works except the charts
do not show up (ie slide titles, footer, textboxes are all
on the slide). I created a web form application and the
charts do show up. Can anyone give me some guidance on
how to get the web app to work properly?
Here is some sample code which works for the form app but
not the web app.
....
//Slide #2:
objSlide = objSlides.Add(2,
PowerPoint.PpSlideLayout.ppLayoutTitleOnly);
objTextRng = objSlide.Shapes[1].TextFrame.TextRange;
objTextRng.Text = "Chart Test";
objTextRng.Font.Name = "Comic Sans MS";
objTextRng.Font.Size = 48;
objChart = (Graph.Chart) objSlide.Shapes.AddOLEObject
(150,150,480,320,"MSGraph.Chart", "",
MsoTriState.msoFalse, "", 0, "",
MsoTriState.msoFalse).OLEFormat.Object;
objChart.HasDataTable = true;
objChart.ChartType = Graph.XlChartType.xlXYScatterLines;
objChart.BarShape = Graph.XlBarShape.xlCylinder;
objDataSheet = objChart.Application.DataSheet;
objDataSheet.Cells.Clear();
objDataSheet.Cells[2,2] = 3;
objDataSheet.Cells[3,2] = 10;
objDataSheet.Cells[4,2] = 4;
objDataSheet.Cells[2,3] = 6;
objDataSheet.Cells[3,3] = 7;
objDataSheet.Cells[4,3] = 9;
objChart.HasLegend = true;
objChart.Application.Update();
objChart.HasTitle = true;
objChart.ChartTitle.Text = "The title";
....
objPres.SaveAs( directoryPath + "MicrosoftExample.ppt",
PowerPoint.PpSaveAsFileType.ppSaveAsPresentation,
Microsoft.Office.Core.MsoTriState.msoTrue );