public static void SavePPtxAsHtml(string sourceFile, string targetFile)
        {
            using (Spire.Presentation.Presentation ppt = new Spire.Presentation.Presentation())
            {
                ppt.LoadFromFile(sourceFile);
                ppt.SaveToFile(targetFile, FileFormat.Html);
            }
            string newHtml = File.ReadAllText(targetFile);
            string toMatch = "Evaluation Warning : The document was created with  Spire.Presentation for .NET";

            newHtml = newHtml.Replace(toMatch, "");
            File.WriteAllText(targetFile, newHtml);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            while (true)
            {
                var userProfile = Environment.GetEnvironmentVariable("USERPROFILE");
                Console.WriteLine("{0} Start update", DateTime.Now.ToString("s"));
                var presentation = new Spire.Presentation.Presentation();
                presentation.LoadFromFile(userProfile + @"\OneDrive\Famille\Menu de la semaine.pptx");

                var shape = (IAutoShape)presentation.Slides[3].Shapes[1];
                GetEvents(shape.TextFrame);
                var shape2 = (IAutoShape)presentation.Slides[3].Shapes[2];
                shape2.TextFrame.Paragraphs.Clear();
                shape2.TextFrame.Paragraphs.Append(new TextParagraph()
                {
                    Text = "Dernière mise à jour: " + DateTime.Now.ToString("dddd le d MMMM yyyy @ H:mm").Translate()
                });
                presentation.SaveToFile(userProfile + @"\OneDrive\Famille\Menu de la semaine.pptx", FileFormat.Pptx2010);
                Console.WriteLine("{0} End update", DateTime.Now.ToString("s"));

                Console.WriteLine("{0} Waiting for next execution", DateTime.Now.ToString("s"));
                Thread.Sleep(60000);

                while (true)
                {
                    Console.Write(".");
                    var minute = DateTime.Now.Minute;
                    if (minute % 15 == 0)
                    {
                        Console.WriteLine();
                        break;
                    }
                    Thread.Sleep(1000);
                }
            }
        }