Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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");
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Reading of People part element.
        /// </summary>
        /// <param name="filePath">Target file path.</param>
        /// <param name="log">Logger.</param>
        public void ReadElements(string filePath, VerifiableLog log)
        {
            using (WordprocessingDocument package = WordprocessingDocument.Open(filePath, true))
            {
                try
                {
                    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, this.verifyAuthor, "Person Author attribute is matched. Author={0}", person.Author);
                    log.VerifyValue(presenceInfo.ProviderId.Value, this.verifyProviderId, "PresenceInfo ProviderId attribute is matched. ProviderId={0}", presenceInfo.ProviderId);
                    log.VerifyValue(presenceInfo.UserId.Value, this.verifyUserId, "PresenceInfo UserId attribute is matched. UserId={0}", presenceInfo.UserId);
                }
                catch (Exception e)
                {
                    log.Fail(e.Message);
                }
            }
        }
 /// <summary>
 /// Loads the DOM from the WordprocessingPeoplePart.
 /// </summary>
 /// <param name="openXmlPart">Specifies the part to be loaded.</param>
 public void Load(WordprocessingPeoplePart openXmlPart)
 {
     LoadFromPart(openXmlPart);
 }
 internal People(WordprocessingPeoplePart ownerPart) : base(ownerPart)
 {
 }