public string modifica_Grafico(string path, string nomeSlide, string titoloSerie, int nChart, int nSerie)
        {
            PresentationDocument presentationDoc = null;

            try
            {
                presentationDoc = PresentationDocument.Open(path, true);

                SlidePart theSlidePart = PPointDocument.getSlidePart(presentationDoc, nomeSlide);

                if (theSlidePart != null)
                {
                    if (theSlidePart.ChartParts.Count() > 0)
                    {
                        ChartPart chartPart = theSlidePart.ChartParts.Skip(nChart).FirstOrDefault();

                        if (ReplaceValuesInChartInSlide(chartPart, titoloSerie, nSerie) == "ok")
                        {
                            presentationDoc.PresentationPart.Presentation.Save();
                            return(string.Format("ok grafico {0} {1}", nomeSlide, titoloSerie));
                        }
                        else
                        {
                            return(string.Format("non trovo il grafico nella slide '{0}'", nomeSlide));
                        }
                    }
                    else
                    {
                        return(string.Format("non trovo nessun grafico nella slide '{0}'", nomeSlide));
                    }
                }
                else
                {
                    return(string.Format("non trovo la slide '{0}'", nomeSlide));
                }
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
            finally
            {
                if (presentationDoc != null)
                {
                    presentationDoc.Dispose();
                }
            }
        }
Example #2
0
 /// <summary>
 /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
 /// </summary>
 public void Dispose()
 {
     doc.Dispose();
 }
 public void Dispose()
 {
     Presentation.Dispose();
 }
Example #4
0
 public void Dispose()
 {
     _document.Dispose();
     _fileStream.Dispose();
 }