Пример #1
0
        public void DocumentMarkerGetCrossedParagraphElementsShouldReturnOne()
        {
            IList <int> result = UniversalDocNoParagraphIdMarker.GetCrossedParagraphElements(WordDocumentPartAttributes.GetParagraphNoIdFormatter(1), WordDocumentPartAttributes.GetParagraphNoIdFormatter(1));

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Count);
            Assert.AreEqual(1, result[0]);
        }
Пример #2
0
        public void DocumentMarkerGetCrossedParagraphElementsShouldReturnThree()
        {
            IList <int> result = UniversalDocParagraphIdMarker.GetCrossedParagraphElements("3CCBE53A", "4424AD34");

            Assert.IsNotNull(result);
            Assert.AreEqual(3, result.Count);
            Assert.AreEqual(17, result[0]);
            Assert.AreEqual(19, result[1]);
            Assert.AreEqual(20, result[2]);
        }
Пример #3
0
        public IList <OpenXMLDocumentPart <OpenXmlElement> > Run()
        {
            IList <OpenXMLDocumentPart <OpenXmlElement> > documentElements = new List <OpenXMLDocumentPart <OpenXmlElement> >();

            if (SplitDocumentObj != null)
            {
                foreach (Person person in SplitDocumentObj.Person)
                {
                    if (person.UniversalMarker != null)
                    {
                        foreach (PersonUniversalMarker marker in person.UniversalMarker)
                        {
                            IList <int> result = UniversalDocMarker.GetCrossedParagraphElements(marker.ElementId, marker.SelectionLastelementId);
                            foreach (int index in result)
                            {
                                if (string.IsNullOrEmpty(SubdividedParagraphs[index]))
                                {
                                    SubdividedParagraphs[index] = person.Email;
                                }
                                else
                                {
                                    throw new ElementToPersonPairException();
                                }
                            }
                        }
                    }

                    if (person.TextMarker != null)
                    {
                    }

                    if (person.PictureMarker != null)
                    {
                    }

                    if (person.TableMarker != null)
                    {
                    }
                }

                string email = string.Empty;
                OpenXMLDocumentPart <OpenXmlElement> part = new OpenXMLDocumentPart <OpenXmlElement>();
                for (int index = 0; index < DocumentBody.ChildElements.Count; index++)
                {
                    //check if parts are neighbours then join into one document
                    if (SubdividedParagraphs[index] != email)
                    {
                        part = new OpenXMLDocumentPart <OpenXmlElement>();
                        part.CompositeElements.Add(DocumentBody.ChildElements[index]);
                        email = SubdividedParagraphs[index];
                        if (string.IsNullOrEmpty(email))
                        {
                            part.PartOwner = "undefined";
                        }
                        else
                        {
                            part.PartOwner = email;
                        }

                        documentElements.Add(part);
                    }
                    else
                    {
                        part.CompositeElements.Add(DocumentBody.ChildElements[index]);
                    }
                }
            }

            return(documentElements);
        }