grazie alle vostre indicazioni ho risolto in parte... cioè adesso mi segnala questo errore, cosa significa?:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Error HRESULT E_FAIL has been returned from a call to a COM component.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
La pagina aspx è la seguente:
codice:
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
OdbcConnection myConnectionString = new OdbcConnection(ConfigurationManager.ConnectionStrings["ConnMySQL"].ConnectionString);
try
{
myConnectionString.Open();
string GraficoPNG = @"D:\\Inetpub\\wwwroot\\public\\chart.png";
Chart1.Series["Default"].ChartType = SeriesChartType.Column;
Chart1.Series["Default"]["PointWidth"] = "0.3";
Chart1.Series["Default"].IsValueShownAsLabel = true;
Chart1.Series["Default"]["BarLabelStyle"] = "Center";
Chart1.Series["Default"]["PixelPointDepth"] = "20";
Chart1.Series["Default"]["DrawingStyle"] = "Cylinder";
Chart1.ChartAreas["ChartArea1"].Area3DStyle.Inclination = 30;
Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true;
this.Chart1.SaveImage(GraficoPNG, ChartImageFormat.Png);
string FilePPTDaSalvare = @"D:\\Inetpub\\wwwroot\\MAC\\public\\temp.ppt";
Microsoft.Office.Interop.PowerPoint.Application
objApp = new Microsoft.Office.Interop.PowerPoint.Application();
objApp.Visible = MsoTriState.msoTrue;
Microsoft.Office.Interop.PowerPoint.Presentations
objPresSet = objApp.Presentations;
Microsoft.Office.Interop.PowerPoint._Presentation
objPres = objPresSet.Open(FilePPTDaSalvare, MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoTrue);
Microsoft.Office.Interop.PowerPoint.Slide objSlides = default(Microsoft.Office.Interop.PowerPoint.Slide);
objApp.Visible = Microsoft.Office.Core.MsoTriState.msoTrue;
objSlides = objPres.Slides.Add(1, Microsoft.Office.Interop.PowerPoint.PpSlideLayout.ppLayoutTitleOnly);
objSlides.Shapes.AddPicture(GraficoPNG, MsoTriState.msoCTrue, MsoTriState.msoCTrue, 0, 0);
objSlides.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 100, 100, 300, 300);
objSlides = objPres.Slides.Add(2, Microsoft.Office.Interop.PowerPoint.PpSlideLayout.ppLayoutTitleOnly);
objSlides.Shapes.AddPicture(GraficoPNG, MsoTriState.msoCTrue, MsoTriState.msoCTrue, 100, 100);
objSlides.Comments.Add(1, 1, "v", "g", "c");
objSlides = objPres.Slides.Add(3, Microsoft.Office.Interop.PowerPoint.PpSlideLayout.ppLayoutVerticalTitleAndText);
objSlides.Shapes.AddTextEffect(MsoPresetTextEffect.msoTextEffect17, "The end", "Impact", 99, MsoTriState.msoFalse, MsoTriState.msoFalse, 200, 230);
objPres.SaveAs(FilePPTDaSalvare, PpSaveAsFileType.ppSaveAsPresentation, MsoTriState.msoTrue);
objPres.Close();
objApp.Quit();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
finally
{
myConnectionString.Close();
myConnectionString.Dispose();
}
}
</script>