コード例 #1
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PresentationProperties();

            // Instanciate the Presentation class that represents the PPTX
            Presentation presentation = new Presentation(dataDir + "AccessModifyingProperties.pptx");

            // Create a reference to DocumentProperties object associated with Prsentation
            IDocumentProperties documentProperties = presentation.DocumentProperties;

            // Access and modify custom properties
            for (int i = 0; i < documentProperties.CountOfCustomProperties; i++)
            {
                // Display names and values of custom properties
                System.Console.WriteLine("Custom Property Name : " + documentProperties.GetCustomPropertyName(i));
                System.Console.WriteLine("Custom Property Value : " + documentProperties[documentProperties.GetCustomPropertyName(i)]);

                // Modify values of custom properties
                documentProperties[documentProperties.GetCustomPropertyName(i)] = "New Value " + (i + 1);
            }

            // Save your presentation to a file
            presentation.Save(dataDir + "CustomDemoModified_out.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
        }
コード例 #2
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PresentationProperties();

            // Instantiate the Presentation class
            Presentation presentation = new Presentation();

            // Getting Document Properties
            IDocumentProperties documentProperties = presentation.DocumentProperties;

            // Adding Custom properties
            documentProperties["New Custom"] = 12;
            documentProperties["My Name"]    = "Mudassir";
            documentProperties["Custom"]     = 124;

            // Getting property name at particular index
            String getPropertyName = documentProperties.GetCustomPropertyName(2);

            // Removing selected property
            documentProperties.RemoveCustomProperty(getPropertyName);

            // Saving presentation
            presentation.Save(dataDir + "CustomDocumentProperties_out.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
        }
コード例 #3
0
            public PropertiesResponse(string path)
            {
                Aspose.Slides.Presentation presentation = new Aspose.Slides.Presentation(path);
                IDocumentProperties        properties   = presentation.DocumentProperties;

                BuiltIn = new List <DocProperty>();
                Custom  = new List <DocProperty>();

                BuiltIn.Add(new DocProperty()
                {
                    Name = "ApplicationTemplate", Value = properties.ApplicationTemplate, Type = PropertyType.String
                });
                BuiltIn.Add(new DocProperty()
                {
                    Name = "AppVersion", Value = properties.AppVersion, Type = PropertyType.String
                });
                BuiltIn.Add(new DocProperty()
                {
                    Name = "Author", Value = properties.Author, Type = PropertyType.String
                });
                BuiltIn.Add(new DocProperty()
                {
                    Name = "Category", Value = properties.Category, Type = PropertyType.String
                });
                BuiltIn.Add(new DocProperty()
                {
                    Name = "Comments", Value = properties.Comments, Type = PropertyType.String
                });
                BuiltIn.Add(new DocProperty()
                {
                    Name = "Company", Value = properties.Company, Type = PropertyType.String
                });
                BuiltIn.Add(new DocProperty()
                {
                    Name = "ContentStatus", Value = properties.ContentStatus, Type = PropertyType.String
                });
                BuiltIn.Add(new DocProperty()
                {
                    Name = "ContentType", Value = properties.ContentType, Type = PropertyType.String
                });
                BuiltIn.Add(new DocProperty()
                {
                    Name = "HyperlinkBase", Value = properties.HyperlinkBase, Type = PropertyType.String
                });

                BuiltIn.Add(new DocProperty()
                {
                    Name = "Keywords", Value = properties.Keywords, Type = PropertyType.String
                });
                BuiltIn.Add(new DocProperty()
                {
                    Name = "LastSavedBy", Value = properties.LastSavedBy, Type = PropertyType.String
                });
                BuiltIn.Add(new DocProperty()
                {
                    Name = "Manager", Value = properties.Manager, Type = PropertyType.String
                });
                BuiltIn.Add(new DocProperty()
                {
                    Name = "NameOfApplication", Value = properties.NameOfApplication, Type = PropertyType.String
                });
                BuiltIn.Add(new DocProperty()
                {
                    Name = "PresentationFormat", Value = properties.PresentationFormat, Type = PropertyType.String
                });
                BuiltIn.Add(new DocProperty()
                {
                    Name = "Subject", Value = properties.Subject, Type = PropertyType.String
                });

                BuiltIn.Add(new DocProperty()
                {
                    Name = "Title", Value = properties.Title, Type = PropertyType.String
                });
                BuiltIn.Add(new DocProperty()
                {
                    Name = "CreatedTime", Value = properties.CreatedTime, Type = PropertyType.DateTime
                });
                BuiltIn.Add(new DocProperty()
                {
                    Name = "LastPrinted", Value = properties.LastPrinted, Type = PropertyType.DateTime
                });
                BuiltIn.Add(new DocProperty()
                {
                    Name = "LastSavedTime", Value = properties.LastSavedTime, Type = PropertyType.DateTime
                });
                BuiltIn.Add(new DocProperty()
                {
                    Name = "RevisionNumber", Value = properties.RevisionNumber, Type = PropertyType.Number
                });
                BuiltIn.Add(new DocProperty()
                {
                    Name = "SharedDoc", Value = properties.SharedDoc, Type = PropertyType.Boolean
                });
                BuiltIn.Add(new DocProperty()
                {
                    Name = "TotalEditingTime", Value = properties.TotalEditingTime, Type = PropertyType.Time
                });

                for (int i = 0; i < properties.CountOfCustomProperties; ++i)
                {
                    string name           = properties.GetCustomPropertyName(i);
                    string _propertyValue = "";
                    properties.GetCustomPropertyValue(name, out _propertyValue);
                    Custom.Add(new DocProperty()
                    {
                        Name = name, Value = _propertyValue, Type = PropertyType.String
                    });
                }
            }