private static void UpdateByTemplate(string path, IDocumentProperties template)
        {
            IPresentationInfo toUpdate = PresentationFactory.Instance.GetPresentationInfo(path);

            toUpdate.UpdateDocumentProperties(template);
            toUpdate.WriteBindedPresentation(path);
        }
Example #2
0
        public static void Run()
        {
            //Path for source presentation
            string pptxFile = Path.Combine(RunExamples.GetDataDir_PresentationProperties(), "modify_pass2.pptx");
            string pptFile  = Path.Combine(RunExamples.GetDataDir_PresentationProperties(), "open_pass1.ppt");

            // Check the Write Protection Password via IPresentationInfo Interface
            IPresentationInfo presentationInfo = PresentationFactory.Instance.GetPresentationInfo(pptxFile);
            bool isWriteProtectedByPassword    = presentationInfo.IsWriteProtected == NullableBool.True && presentationInfo.CheckWriteProtection("pass2");

            Console.WriteLine("Is presentation write protected by password = "******"pass2");
                Console.WriteLine("Is presentation write protected = " + isWriteProtected);
            }

            // Check Presentation Open Protection via IPresentationInfo Interface
            presentationInfo = PresentationFactory.Instance.GetPresentationInfo(pptFile);
            if (presentationInfo.IsPasswordProtected)
            {
                Console.WriteLine("The presentation '" + pptxFile + "' is protected by password to open.");
            }
        }
        public static void Run()
        {
            // For complete examples and data files, please go to https:// Github.com/aspose-slides/Aspose.Slides-for-.NET

            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PresentationProperties();

            DocumentProperties template;
            IPresentationInfo  info = PresentationFactory.Instance.GetPresentationInfo(dataDir + "template.pptx");

            template = (DocumentProperties)info.ReadDocumentProperties();

            template.Author      = "Template Author";
            template.Title       = "Template Title";
            template.Category    = "Template Category";
            template.Keywords    = "Keyword1, Keyword2, Keyword3";
            template.Company     = "Our Company";
            template.Comments    = "Created from template";
            template.ContentType = "Template Content";
            template.Subject     = "Template Subject";

            UpdateByTemplate(dataDir + "doc1.pptx", template);
            UpdateByTemplate(dataDir + "doc2.odp", template);
            UpdateByTemplate(dataDir + "doc3.ppt", template);
        }
Example #4
0
        // The example below demonstrates how to check a password to open a presentation

        public static void Run()
        {
            //Path for source presentation
            string pptFile = Path.Combine(RunExamples.GetDataDir_PresentationProperties(), "open_pass1.ppt");

            // Check the Password via IPresentationInfo Interface
            IPresentationInfo presentationInfo = PresentationFactory.Instance.GetPresentationInfo(pptFile);
            bool isPasswordCorrect             = presentationInfo.CheckPassword("my_password");

            Console.WriteLine("The password \"my_password\" for the presentation is " + isPasswordCorrect);

            isPasswordCorrect = presentationInfo.CheckPassword("pass1");
            Console.WriteLine("The password \"pass1\" for the presentation is " + isPasswordCorrect);
        }
Example #5
0
        public static void Run()
        {
            //ExStart:CheckPresentationCreatedorModifed

            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PresentationProperties();

            IPresentationInfo info =
                PresentationFactory.Instance.GetPresentationInfo(Path.Combine(RootFolder, "props.pptx"));

            IDocumentProperties props = info.ReadDocumentProperties();

            string app = props.NameOfApplication;
            string ver = props.AppVersion;
            //ExEnd:CheckPresentationCreatedorModifed
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PresentationOpening();

            IPresentationInfo info = PresentationFactory.Instance.GetPresentationInfo(dataDir + "HelloWorld.pptx");

            switch (info.LoadFormat)
            {
            case LoadFormat.Pptx:
            {
                break;
            }

            case LoadFormat.Unknown:
            {
                break;
            }
            }
        }
        public static void Run()
        {
            // For complete examples and data files, please go to https:// Github.com/aspose-slides/Aspose.Slides-for-.NET

            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PresentationProperties();

            // read the info of presentation
            IPresentationInfo info = PresentationFactory.Instance.GetPresentationInfo(dataDir + "ModifyBuiltinProperties1.pptx");

            // obtain the current properties
            IDocumentProperties props = info.ReadDocumentProperties();

            // set the new values of Author and Title fields
            props.Author = "New Author";
            props.Title  = "New Title";

            // update the presentation with a new values
            info.UpdateDocumentProperties(props);
            info.WriteBindedPresentation(dataDir + "ModifyBuiltinProperties1.pptx");
        }
        public static void Run()
        {
            //ExStart:UpdatePresentationProperties

            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PresentationProperties();

            // read the info of presentation
            IPresentationInfo info = PresentationFactory.Instance.GetPresentationInfo(dataDir + "ModifyBuiltinProperties1.pptx");

            // obtain the current properties
            IDocumentProperties props = info.ReadDocumentProperties();

            // set the new values of Author and Title fields
            props.Author = "New Author";
            props.Title  = "New Title";

            // update the presentation with a new values
            info.UpdateDocumentProperties(props);
            info.WriteBindedPresentation(dataDir + "ModifyBuiltinProperties1.pptx");
            //ExEnd:UpdatePresentationProperties
        }