示例#1
0
        /// <summary>
        /// Verifying of People part element.
        /// </summary>
        /// <param name="filePath">Target file path.</param>
        /// <param name="log">Logger.</param>
        public void VerifyElements(string filePath, VerifiableLog log)
        {
            using (WordprocessingDocument package = WordprocessingDocument.Open(filePath, false))
            {
                WordprocessingPeoplePart peoplePart = package.MainDocumentPart.WordprocessingPeoplePart;
                W15.Person       person             = peoplePart.People.Descendants <W15.Person>().First();
                W15.PresenceInfo presenceInfo       = peoplePart.RootElement.Descendants <W15.PresenceInfo>().First();

                log.VerifyValue(person.Author.Value, this.editAuthor, "Person Author attribute is matched. Author={0}", person.Author);
                log.VerifyValue(presenceInfo.ProviderId.Value, this.editProviderId, "PresenceInfo ProviderId attribute is matched. ProviderId={0}", presenceInfo.ProviderId);
                log.VerifyValue(presenceInfo.UserId.Value, this.editUserId, "PresenceInfo UserId attribute is matched. UserId={0}", presenceInfo.UserId);
            }
        }
示例#2
0
        /// <summary>
        /// Reading of People part element.
        /// </summary>
        public void ReadElements(Stream stream, VerifiableLog log)
        {
            using (WordprocessingDocument package = WordprocessingDocument.Open(stream, true))
            {
                WordprocessingPeoplePart peoplePart = package.MainDocumentPart.WordprocessingPeoplePart;
                W15.Person       person             = peoplePart.People.Descendants <W15.Person>().First();
                W15.PresenceInfo presenceInfo       = person.Descendants <W15.PresenceInfo>().First();

                log.VerifyValue(person.Author.Value, verifyAuthor, "Person Author attribute is matched. Author={0}", person.Author);
                log.VerifyValue(presenceInfo.ProviderId.Value, verifyProviderId, "PresenceInfo ProviderId attribute is matched. ProviderId={0}", presenceInfo.ProviderId);
                log.VerifyValue(presenceInfo.UserId.Value, verifyUserId, "PresenceInfo UserId attribute is matched. UserId={0}", presenceInfo.UserId);
            }
        }
示例#3
0
        /// <summary>
        /// Editing of People part element.
        /// </summary>
        /// <param name="filePath">Target file path.</param>
        /// <param name="log">Logger.</param>
        public void EditElements(string filePath, VerifiableLog log)
        {
            using (WordprocessingDocument package = WordprocessingDocument.Open(filePath, true))
            {
                WordprocessingPeoplePart peoplePart = package.MainDocumentPart.WordprocessingPeoplePart;
                W15.Person       person             = peoplePart.People.Descendants <W15.Person>().First();
                W15.PresenceInfo presenceInfo       = person.Descendants <W15.PresenceInfo>().First();

                person.Author.Value           = this.editAuthor;
                presenceInfo.ProviderId.Value = this.editProviderId;
                presenceInfo.UserId.Value     = this.editUserId;

                log.Pass("PresenceInfo in PeoplePart is updated");
            }
        }
示例#4
0
        // Generates content of wordprocessingPeoplePart1.
        private void GenerateWordprocessingPeoplePart1Content(WordprocessingPeoplePart wordprocessingPeoplePart1)
        {
            W15.People people1 = new W15.People(){ MCAttributes = new MarkupCompatibilityAttributes(){ Ignorable = "w14 w15 wp14" }  };
            people1.AddNamespaceDeclaration("wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
            people1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            people1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
            people1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            people1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
            people1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
            people1.AddNamespaceDeclaration("wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
            people1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
            people1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
            people1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
            people1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
            people1.AddNamespaceDeclaration("w15", "http://schemas.microsoft.com/office/word/2012/wordml");
            people1.AddNamespaceDeclaration("wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
            people1.AddNamespaceDeclaration("wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
            people1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
            people1.AddNamespaceDeclaration("wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");

            W15.Person person1 = new W15.Person(){ Author = "Masaki Tamura (Pasona Tech)" };
            W15.PresenceInfo presenceInfo1 = new W15.PresenceInfo(){ ProviderId = "AD", UserId = "S-1-5-21-2146773085-903363285-719344707-1318535" };

            person1.Append(presenceInfo1);

            people1.Append(person1);

            wordprocessingPeoplePart1.People = people1;
        }