public void MoveToSection()
        {
            //ExStart:MoveToSection
            Document doc = new Document();

            doc.AppendChild(new Section(doc));

            // Move a DocumentBuilder to the second section and add text.
            DocumentBuilder builder = new DocumentBuilder(doc);

            builder.MoveToSection(1);
            builder.Writeln("Text added to the 2nd section.");

            // Create document with paragraphs.
            doc = new Document(MyDir + "Paragraphs.docx");
            ParagraphCollection paragraphs = doc.FirstSection.Body.Paragraphs;

            Assert.AreEqual(22, paragraphs.Count);

            // When we create a DocumentBuilder for a document, its cursor is at the very beginning of the document by default,
            // and any content added by the DocumentBuilder will just be prepended to the document.
            builder = new DocumentBuilder(doc);
            Assert.AreEqual(0, paragraphs.IndexOf(builder.CurrentParagraph));

            // You can move the cursor to any position in a paragraph.
            builder.MoveToParagraph(2, 10);
            Assert.AreEqual(2, paragraphs.IndexOf(builder.CurrentParagraph));
            builder.Writeln("This is a new third paragraph. ");
            Assert.AreEqual(3, paragraphs.IndexOf(builder.CurrentParagraph));
            //ExEnd:MoveToSection
        }
Beispiel #2
0
        public void LinesToDrop()
        {
            //ExStart
            //ExFor:ParagraphFormat.LinesToDrop
            //ExSummary:Shows how to set the size of the drop cap text.
            Document        doc     = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            // Setting this attribute will designate the current paragraph as a drop cap,
            // in this case with a height of 4 lines of text
            builder.ParagraphFormat.LinesToDrop = 4;
            builder.Write("H");

            // Any subsequent paragraphs will wrap around the drop cap
            builder.InsertParagraph();
            builder.Write("ello world!");

            doc.Save(ArtifactsDir + "ParagraphFormat.LinesToDrop.odt");
            //ExEnd

            doc = new Document(ArtifactsDir + "ParagraphFormat.LinesToDrop.odt");
            ParagraphCollection paragraphs = doc.FirstSection.Body.Paragraphs;

            Assert.AreEqual(4, paragraphs[0].ParagraphFormat.LinesToDrop);
            Assert.AreEqual(0, paragraphs[1].ParagraphFormat.LinesToDrop);
        }
        public void InformationExtraction()
        {
            string   decMess  = "";
            Document document = new Document();

            document.LoadFromFile(pathSaveReceivedFile);
            ParagraphCollection paragraph = document.Sections[0].Paragraphs;

            foreach (Paragraph par in paragraph)
            {
                foreach (DocumentObject docObj in par.ChildObjects)
                {
                    if (docObj is TextRange)
                    {
                        TextRange textRange = docObj as TextRange;
                        if (textRange.CharacterFormat.CharacterSpacing == singleBitValue)
                        {
                            decMess += '1';
                        }
                        if (textRange.CharacterFormat.CharacterSpacing == zeroBitValue)
                        {
                            decMess += '0';
                        }
                        if (textRange.CharacterFormat.CharacterSpacing == 0.05f)
                        {
                            decMess += ' ';
                        }
                    }
                }
            }
            labelDecryptText.Text = "Извлеченная информация: " + ConvertToMessage(decMess);
        }
        public void Revisions()
        {
            //ExStart
            //ExFor:Paragraph.IsMoveFromRevision
            //ExFor:Paragraph.IsMoveToRevision
            //ExFor:ParagraphCollection
            //ExFor:ParagraphCollection.Item(Int32)
            //ExFor:Story.Paragraphs
            //ExSummary:Shows how to check whether a paragraph is a move revision.
            Document doc = new Document(MyDir + "Revisions.docx");

            // This document contains "Move" revisions, which appear when we highlight text with the cursor,
            // and then drag it to move it to another location
            // while tracking revisions in Microsoft Word via "Review" -> "Track changes".
            Assert.AreEqual(6, doc.Revisions.Count(r => r.RevisionType == RevisionType.Moving));

            ParagraphCollection paragraphs = doc.FirstSection.Body.Paragraphs;

            // Move revisions consist of pairs of "Move from", and "Move to" revisions.
            // These revisions are potential changes to the document that we can either accept or reject.
            // Before we accept/reject a move revision, the document
            // must keep track of both the departure and arrival destinations of the text.
            // The second and the fourth paragraph define one such revision, and thus both have the same contents.
            Assert.AreEqual(paragraphs[1].GetText(), paragraphs[3].GetText());

            // The "Move from" revision is the paragraph where we dragged the text from.
            // If we accept the revision, this paragraph will disappear,
            // and the other will remain and no longer be a revision.
            Assert.True(paragraphs[1].IsMoveFromRevision);

            // The "Move to" revision is the paragraph where we dragged the text to.
            // If we reject the revision, this paragraph instead will disappear, and the other will remain.
            Assert.True(paragraphs[3].IsMoveToRevision);
            //ExEnd
        }
Beispiel #5
0
 internal void method_28()
 {
     if ((this.m_bodyItems != null) && (this.m_bodyItems.Count > 0))
     {
         BodyRegion region = null;
         for (int i = 0; i < this.m_bodyItems.Count; i++)
         {
             region = this.m_bodyItems[i];
             region.Close();
             region = null;
         }
         this.m_bodyItems.Clear();
         this.m_bodyItems = null;
     }
     if (this.paragraphCollection_0 != null)
     {
         this.paragraphCollection_0.Clear();
         this.paragraphCollection_0 = null;
     }
     if (this.tableCollection_0 != null)
     {
         this.tableCollection_0.Clear();
         this.tableCollection_0 = null;
     }
     if (this.formFieldCollection_0 != null)
     {
         this.formFieldCollection_0.InnerList.Clear();
         this.formFieldCollection_0 = null;
     }
 }
        public void HorizontalBorders()
        {
            //ExStart
            //ExFor:BorderCollection.Horizontal
            //ExSummary:Shows how to apply settings to horizontal borders to a paragraph's format.
            Document        doc     = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            // Create a red horizontal border for the paragraph. Any paragraphs created afterwards will inherit these border settings.
            BorderCollection borders = doc.FirstSection.Body.FirstParagraph.ParagraphFormat.Borders;

            borders.Horizontal.Color     = Color.Red;
            borders.Horizontal.LineStyle = LineStyle.DashSmallGap;
            borders.Horizontal.LineWidth = 3;

            // Write text to the document without creating a new paragraph afterward.
            // Since there is no paragraph underneath, the horizontal border will not be visible.
            builder.Write("Paragraph above horizontal border.");

            // Once we add a second paragraph, the border of the first paragraph will become visible.
            builder.InsertParagraph();
            builder.Write("Paragraph below horizontal border.");

            doc.Save(ArtifactsDir + "Border.HorizontalBorders.docx");
            //ExEnd

            doc = new Document(ArtifactsDir + "Border.HorizontalBorders.docx");
            ParagraphCollection paragraphs = doc.FirstSection.Body.Paragraphs;

            Assert.AreEqual(LineStyle.DashSmallGap, paragraphs[0].ParagraphFormat.Borders[BorderType.Horizontal].LineStyle);
            Assert.AreEqual(LineStyle.DashSmallGap, paragraphs[1].ParagraphFormat.Borders[BorderType.Horizontal].LineStyle);
        }
        static void CreateNumberedList(Document document)
        {
            #region #CreateNumberedList
            document.LoadDocument("Documents//List.docx");
            document.BeginUpdate();

            //Create a new pattern object
            AbstractNumberingList abstractListNumberingRoman = document.AbstractNumberingLists.Add();

            //Specify the list's type
            abstractListNumberingRoman.NumberingType = NumberingType.Simple;

            //Define the first level's properties
            ListLevel level = abstractListNumberingRoman.Levels[0];
            level.ParagraphProperties.LeftIndent          = 150;
            level.ParagraphProperties.FirstLineIndentType = ParagraphFirstLineIndent.Hanging;
            level.ParagraphProperties.FirstLineIndent     = 75;
            level.Start = 1;

            //Specify the roman format
            level.NumberingFormat     = NumberingFormat.LowerRoman;
            level.DisplayFormatString = "{0}.";

            //Create a new list based on the specific pattern
            NumberingList numberingList = document.NumberingLists.Add(0);

            document.EndUpdate();

            document.BeginUpdate();
            ParagraphCollection paragraphs = document.Paragraphs;
            //Add paragraphs to the list
            paragraphs.AddParagraphsToList(document.Range, numberingList, 0);
            document.EndUpdate();
            #endregion #CreateNumberedList
        }
        static void CreateBulletedList(Document document)
        {
            #region #CreateBulletedList
            document.LoadDocument("Documents//List.docx");
            document.BeginUpdate();

            // Create a new list pattern object
            AbstractNumberingList list = document.AbstractNumberingLists.Add();

            //Specify the list's type
            list.NumberingType = NumberingType.Bullet;
            ListLevel level = list.Levels[0];
            level.ParagraphProperties.LeftIndent = 100;

            //Specify the bullets' format
            //Without this step, the list is considered as numbered
            level.DisplayFormatString          = "\u00B7";
            level.CharacterProperties.FontName = "Symbol";

            //Create a new list based on the specific pattern
            NumberingList bulletedList = document.NumberingLists.Add(0);

            // Add paragraphs to the list
            ParagraphCollection paragraphs = document.Paragraphs;
            paragraphs.AddParagraphsToList(document.Range, bulletedList, 0);

            document.EndUpdate();
            #endregion #CreateBulletedList
        }
        public void KeepSourceNumbering()
        {
            //ExStart:KeepSourceNumbering
            Document srcDoc = new Document(MyDir + "Document source.docx");
            Document dstDoc = new Document(MyDir + "Northwind traders.docx");

            // Keep source list formatting when importing numbered paragraphs.
            ImportFormatOptions importFormatOptions = new ImportFormatOptions {
                KeepSourceNumbering = true
            };

            NodeImporter importer = new NodeImporter(srcDoc, dstDoc, ImportFormatMode.KeepSourceFormatting,
                                                     importFormatOptions);

            ParagraphCollection srcParas = srcDoc.FirstSection.Body.Paragraphs;

            foreach (Paragraph srcPara in srcParas)
            {
                Node importedNode = importer.ImportNode(srcPara, false);
                dstDoc.FirstSection.Body.AppendChild(importedNode);
            }

            dstDoc.Save(ArtifactsDir + "JoinAndAppendDocuments.KeepSourceNumbering.docx");
            //ExEnd:KeepSourceNumbering
        }
        public void IgnoreTextBoxes()
        {
            //ExStart:IgnoreTextBoxes
            Document srcDoc = new Document(MyDir + "Document source.docx");
            Document dstDoc = new Document(MyDir + "Northwind traders.docx");

            // Keep the source text boxes formatting when importing.
            ImportFormatOptions importFormatOptions = new ImportFormatOptions {
                IgnoreTextBoxes = false
            };

            NodeImporter importer = new NodeImporter(srcDoc, dstDoc, ImportFormatMode.KeepSourceFormatting,
                                                     importFormatOptions);

            ParagraphCollection srcParas = srcDoc.FirstSection.Body.Paragraphs;

            foreach (Paragraph srcPara in srcParas)
            {
                Node importedNode = importer.ImportNode(srcPara, true);
                dstDoc.FirstSection.Body.AppendChild(importedNode);
            }

            dstDoc.Save(ArtifactsDir + "JoinAndAppendDocuments.IgnoreTextBoxes.docx");
            //ExEnd:IgnoreTextBoxes
        }
        public void RevisionHistory()
        {
            //ExStart
            //ExFor:Paragraph.IsMoveFromRevision
            //ExFor:Paragraph.IsMoveToRevision
            //ExFor:ParagraphCollection
            //ExFor:ParagraphCollection.Item(Int32)
            //ExFor:Story.Paragraphs
            //ExSummary:Shows how to get paragraph that was moved (deleted/inserted) in Microsoft Word while change tracking was enabled.
            Document doc = new Document(MyDir + "Revisions.docx");

            // There are two sets of move revisions in this document
            // One moves a small part of a paragraph, while the other moves a whole paragraph
            // Paragraph.IsMoveFromRevision/IsMoveToRevision will only be true if a whole paragraph is moved, as in the latter case
            ParagraphCollection paragraphs = doc.FirstSection.Body.Paragraphs;

            for (int i = 0; i < paragraphs.Count; i++)
            {
                if (paragraphs[i].IsMoveFromRevision)
                {
                    Console.WriteLine("The paragraph {0} has been moved (deleted).", i);
                }
                if (paragraphs[i].IsMoveToRevision)
                {
                    Console.WriteLine("The paragraph {0} has been moved (inserted).", i);
                }
            }
            //ExEnd

            Assert.AreEqual(11, doc.Revisions.Count());
            Assert.AreEqual(6, doc.Revisions.Count(r => r.RevisionType == RevisionType.Moving));
            Assert.AreEqual(1, paragraphs.Count(p => ((Paragraph)p).IsMoveFromRevision));
            Assert.AreEqual(1, paragraphs.Count(p => ((Paragraph)p).IsMoveToRevision));
        }
Beispiel #12
0
        public void IParagraphCollectionBuilderTest()
        {
            //some text e.g read from a TextBox
            string someText = "Max Mustermann\nMustermann Str. 300\n22222 Hamburg\n\n\n\n"
                              + "Heinz Willi\nDorfstr. 1\n22225 Hamburg\n\n\n\n"
                              + "Offer for 200 Intel Pentium 4 CPU's\n\n\n\n"
                              + "Dear Mr. Willi,\n\n\n\n"
                              + "thank you for your request. \tWe can     offer you the 200 Intel Pentium IV 3 Ghz CPU's for a price of 79,80 € per unit."
                              + "This special offer is valid to 31.10.2005. If you accept, we can deliver within 24 hours.\n\n\n\n"
                              + "Best regards \nMax Mustermann";

            //Create new TextDocument
            TextDocument document = new TextDocument();

            document.New();
            //Use the ParagraphBuilder to split the string into ParagraphCollection
            ParagraphCollection pCollection = ParagraphBuilder.CreateParagraphCollection(
                document,
                someText,
                true,
                ParagraphBuilder.ParagraphSeperator);

            //Add the paragraph collection
            foreach (Paragraph paragraph in pCollection)
            {
                document.Content.Add(paragraph);
            }
            //save
            document.SaveTo(AARunMeFirstAndOnce.outPutFolder + "Letter.odt");
        }
Beispiel #13
0
        public void LinesToDrop()
        {
            //ExStart
            //ExFor:ParagraphFormat.LinesToDrop
            //ExSummary:Shows how to set the size of a drop cap.
            Document        doc     = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            // Modify the "LinesToDrop" property to designate a paragraph as a drop cap,
            // which will turn it into a large capital letter that will decorate the next paragraph.
            // Give this property a value of 4 to give the drop cap the height of four text lines.
            builder.ParagraphFormat.LinesToDrop = 4;
            builder.Writeln("H");

            // Reset the "LinesToDrop" property to 0 to turn the next paragraph into an ordinary paragraph.
            // The text in this paragraph will wrap around the drop cap.
            builder.ParagraphFormat.LinesToDrop = 0;
            builder.Writeln("ello world!");

            doc.Save(ArtifactsDir + "ParagraphFormat.LinesToDrop.odt");
            //ExEnd

            doc = new Document(ArtifactsDir + "ParagraphFormat.LinesToDrop.odt");
            ParagraphCollection paragraphs = doc.FirstSection.Body.Paragraphs;

            Assert.AreEqual(4, paragraphs[0].ParagraphFormat.LinesToDrop);
            Assert.AreEqual(0, paragraphs[1].ParagraphFormat.LinesToDrop);
        }
Beispiel #14
0
        public void GetFrameProperties()
        {
            //ExStart
            //ExFor:Paragraph.FrameFormat
            //ExFor:FrameFormat
            //ExFor:FrameFormat.IsFrame
            //ExFor:FrameFormat.Width
            //ExFor:FrameFormat.Height
            //ExFor:FrameFormat.HeightRule
            //ExFor:FrameFormat.HorizontalAlignment
            //ExFor:FrameFormat.VerticalAlignment
            //ExFor:FrameFormat.HorizontalPosition
            //ExFor:FrameFormat.RelativeHorizontalPosition
            //ExFor:FrameFormat.HorizontalDistanceFromText
            //ExFor:FrameFormat.VerticalPosition
            //ExFor:FrameFormat.RelativeVerticalPosition
            //ExFor:FrameFormat.VerticalDistanceFromText
            //ExSummary:Shows how to get information about formatting properties of paragraph as frame.
            Document doc = new Document(MyDir + "Paragraph.Frame.docx");

            ParagraphCollection paragraphs = doc.FirstSection.Body.Paragraphs;

            foreach (Paragraph paragraph in paragraphs.OfType <Paragraph>())
            {
                if (paragraph.FrameFormat.IsFrame)
                {
                    Console.WriteLine("Width: " + paragraph.FrameFormat.Width);
                    Console.WriteLine("Height: " + paragraph.FrameFormat.Height);
                    Console.WriteLine("HeightRule: " + paragraph.FrameFormat.HeightRule);
                    Console.WriteLine("HorizontalAlignment: " + paragraph.FrameFormat.HorizontalAlignment);
                    Console.WriteLine("VerticalAlignment: " + paragraph.FrameFormat.VerticalAlignment);
                    Console.WriteLine("HorizontalPosition: " + paragraph.FrameFormat.HorizontalPosition);
                    Console.WriteLine("RelativeHorizontalPosition: " +
                                      paragraph.FrameFormat.RelativeHorizontalPosition);
                    Console.WriteLine("HorizontalDistanceFromText: " +
                                      paragraph.FrameFormat.HorizontalDistanceFromText);
                    Console.WriteLine("VerticalPosition: " + paragraph.FrameFormat.VerticalPosition);
                    Console.WriteLine("RelativeVerticalPosition: " + paragraph.FrameFormat.RelativeVerticalPosition);
                    Console.WriteLine("VerticalDistanceFromText: " + paragraph.FrameFormat.VerticalDistanceFromText);
                }
            }
            //ExEnd

            if (paragraphs[0].FrameFormat.IsFrame)
            {
                Assert.AreEqual(233.3, paragraphs[0].FrameFormat.Width);
                Assert.AreEqual(138.8, paragraphs[0].FrameFormat.Height);
                Assert.AreEqual(21.05, paragraphs[0].FrameFormat.HorizontalPosition);
                Assert.AreEqual(RelativeHorizontalPosition.Page, paragraphs[0].FrameFormat.RelativeHorizontalPosition);
                Assert.AreEqual(9, paragraphs[0].FrameFormat.HorizontalDistanceFromText);
                Assert.AreEqual(-17.65, paragraphs[0].FrameFormat.VerticalPosition);
                Assert.AreEqual(RelativeVerticalPosition.Paragraph, paragraphs[0].FrameFormat.RelativeVerticalPosition);
                Assert.AreEqual(0, paragraphs[0].FrameFormat.VerticalDistanceFromText);
            }
            else
            {
                Assert.Fail("There are no frames in the document.");
            }
        }
Beispiel #15
0
 public Text(Content container, string key, float rotation) : base(key, container.Parent)
 {
     Paragraphs        = new ParagraphCollection();
     VerticalAlignment = AlignmentType.top;
     _rotation         = rotation;
     Key       = key;
     Container = container;
 }
Beispiel #16
0
        public void LineSpacing()
        {
            //ExStart
            //ExFor:ParagraphFormat.LineSpacing
            //ExFor:ParagraphFormat.LineSpacingRule
            //ExSummary:Shows how to work with line spacing.
            Document        doc     = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            // Below are three line spacing rules that we can define using the
            // paragraph's "LineSpacingRule" property to configure spacing between paragraphs.
            // 1 -  Set a minimum amount of spacing.
            // This will give vertical padding to lines of text of any size
            // that is too small to maintain the minimum line-height.
            builder.ParagraphFormat.LineSpacingRule = LineSpacingRule.AtLeast;
            builder.ParagraphFormat.LineSpacing     = 20;

            builder.Writeln("Minimum line spacing of 20.");
            builder.Writeln("Minimum line spacing of 20.");

            // 2 -  Set exact spacing.
            // Using font sizes that are too large for the spacing will truncate the text.
            builder.ParagraphFormat.LineSpacingRule = LineSpacingRule.Exactly;
            builder.ParagraphFormat.LineSpacing     = 5;

            builder.Writeln("Line spacing of exactly 5.");
            builder.Writeln("Line spacing of exactly 5.");

            // 3 -  Set spacing as a multiple of default line spacing, which is 12 points by default.
            // This kind of spacing will scale to different font sizes.
            builder.ParagraphFormat.LineSpacingRule = LineSpacingRule.Multiple;
            builder.ParagraphFormat.LineSpacing     = 18;

            builder.Writeln("Line spacing of 1.5 default lines.");
            builder.Writeln("Line spacing of 1.5 default lines.");

            doc.Save(ArtifactsDir + "ParagraphFormat.LineSpacing.docx");
            //ExEnd

            doc = new Document(ArtifactsDir + "ParagraphFormat.LineSpacing.docx");
            ParagraphCollection paragraphs = doc.FirstSection.Body.Paragraphs;

            Assert.AreEqual(LineSpacingRule.AtLeast, paragraphs[0].ParagraphFormat.LineSpacingRule);
            Assert.AreEqual(20.0d, paragraphs[0].ParagraphFormat.LineSpacing);
            Assert.AreEqual(LineSpacingRule.AtLeast, paragraphs[1].ParagraphFormat.LineSpacingRule);
            Assert.AreEqual(20.0d, paragraphs[1].ParagraphFormat.LineSpacing);

            Assert.AreEqual(LineSpacingRule.Exactly, paragraphs[2].ParagraphFormat.LineSpacingRule);
            Assert.AreEqual(5.0d, paragraphs[2].ParagraphFormat.LineSpacing);
            Assert.AreEqual(LineSpacingRule.Exactly, paragraphs[3].ParagraphFormat.LineSpacingRule);
            Assert.AreEqual(5.0d, paragraphs[3].ParagraphFormat.LineSpacing);

            Assert.AreEqual(LineSpacingRule.Multiple, paragraphs[4].ParagraphFormat.LineSpacingRule);
            Assert.AreEqual(18.0d, paragraphs[4].ParagraphFormat.LineSpacing);
            Assert.AreEqual(LineSpacingRule.Multiple, paragraphs[5].ParagraphFormat.LineSpacingRule);
            Assert.AreEqual(18.0d, paragraphs[5].ParagraphFormat.LineSpacing);
        }
Beispiel #17
0
        static void CreateMultilevelList(Document document)
        {
            #region #CreateMultilevelList
            document.LoadDocument("Documents//List.docx", DevExpress.XtraRichEdit.DocumentFormat.OpenXml);

            document.BeginUpdate();

            //Create a new pattern object
            AbstractNumberingList list = document.AbstractNumberingLists.Add();

            //Specify the list's type
            list.NumberingType = NumberingType.MultiLevel;

            //Specify parameters for each list level
            ListLevel level = list.Levels[0];
            level.ParagraphProperties.LeftIndent          = 105;
            level.ParagraphProperties.FirstLineIndentType = ParagraphFirstLineIndent.Hanging;
            level.ParagraphProperties.FirstLineIndent     = 55;
            level.Start               = 1;
            level.NumberingFormat     = NumberingFormat.UpperRoman;
            level.DisplayFormatString = "{0}";

            level = list.Levels[1];
            level.ParagraphProperties.LeftIndent          = 125;
            level.ParagraphProperties.FirstLineIndentType = ParagraphFirstLineIndent.Hanging;
            level.ParagraphProperties.FirstLineIndent     = 65;
            level.Start               = 1;
            level.NumberingFormat     = NumberingFormat.LowerRoman;
            level.DisplayFormatString = "{1})";

            level = list.Levels[2];
            level.ParagraphProperties.LeftIndent          = 145;
            level.ParagraphProperties.FirstLineIndentType = ParagraphFirstLineIndent.Hanging;
            level.ParagraphProperties.FirstLineIndent     = 75;
            level.Start               = 1;
            level.NumberingFormat     = NumberingFormat.LowerLetter;
            level.DisplayFormatString = "{2}.";

            //Create a new list object based on the specified pattern
            document.NumberingLists.Add(0);
            document.EndUpdate();


            //Convert all paragraphs to list items
            document.BeginUpdate();
            ParagraphCollection paragraphs = document.Paragraphs;

            foreach (Paragraph pgf in paragraphs)
            {
                pgf.ListIndex = 0;
                pgf.ListLevel = pgf.Index;
            }

            document.EndUpdate();
            #endregion #CreateMultilevelList
        }
Beispiel #18
0
        public void LineSpacing()
        {
            //ExStart
            //ExFor:ParagraphFormat.LineSpacing
            //ExFor:ParagraphFormat.LineSpacingRule
            //ExSummary:Shows how to work with line spacing.
            Document        doc     = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            // Set the paragraph's line spacing to have a minimum value
            // This will give vertical padding to lines of text of any size that's too small to maintain the line height
            builder.ParagraphFormat.LineSpacingRule = LineSpacingRule.AtLeast;
            builder.ParagraphFormat.LineSpacing     = 20.0;

            builder.Writeln("Minimum line spacing of 20.");
            builder.Writeln("Minimum line spacing of 20.");

            // Set the line spacing to always be exactly 5 points
            // If the font size is larger than the spacing, the top of the text will be truncated
            builder.ParagraphFormat.LineSpacingRule = LineSpacingRule.Exactly;
            builder.ParagraphFormat.LineSpacing     = 5.0;

            builder.Writeln("Line spacing of exactly 5.");
            builder.Writeln("Line spacing of exactly 5.");

            // Set the line spacing to a multiple of the default line spacing, which is 12 points by default
            // 18 points will set the spacing to always be 1.5 lines, which will scale with different font sizes
            builder.ParagraphFormat.LineSpacingRule = LineSpacingRule.Multiple;
            builder.ParagraphFormat.LineSpacing     = 18.0;

            builder.Writeln("Line spacing of 1.5 default lines.");
            builder.Writeln("Line spacing of 1.5 default lines.");

            doc.Save(ArtifactsDir + "ParagraphFormat.LineSpacing.docx");
            //ExEnd

            doc = new Document(ArtifactsDir + "ParagraphFormat.LineSpacing.docx");
            ParagraphCollection paragraphs = doc.FirstSection.Body.Paragraphs;

            Assert.AreEqual(LineSpacingRule.AtLeast, paragraphs[0].ParagraphFormat.LineSpacingRule);
            Assert.AreEqual(20.0d, paragraphs[0].ParagraphFormat.LineSpacing);
            Assert.AreEqual(LineSpacingRule.AtLeast, paragraphs[1].ParagraphFormat.LineSpacingRule);
            Assert.AreEqual(20.0d, paragraphs[1].ParagraphFormat.LineSpacing);

            Assert.AreEqual(LineSpacingRule.Exactly, paragraphs[2].ParagraphFormat.LineSpacingRule);
            Assert.AreEqual(5.0d, paragraphs[2].ParagraphFormat.LineSpacing);
            Assert.AreEqual(LineSpacingRule.Exactly, paragraphs[3].ParagraphFormat.LineSpacingRule);
            Assert.AreEqual(5.0d, paragraphs[3].ParagraphFormat.LineSpacing);

            Assert.AreEqual(LineSpacingRule.Multiple, paragraphs[4].ParagraphFormat.LineSpacingRule);
            Assert.AreEqual(18.0d, paragraphs[4].ParagraphFormat.LineSpacing);
            Assert.AreEqual(LineSpacingRule.Multiple, paragraphs[5].ParagraphFormat.LineSpacingRule);
            Assert.AreEqual(18.0d, paragraphs[5].ParagraphFormat.LineSpacing);
        }
        static void CreateNumberedList(RichEditDocumentServer server)
        {
            #region #CreateNumberedList
            Document document = server.Document;
            document.BeginUpdate();
            // Define an abstract list that is the pattern for lists used in the document.
            AbstractNumberingList list = document.AbstractNumberingLists.Add();
            list.NumberingType = NumberingType.MultiLevel;

            // Specify parameters for each list level.

            ListLevel level = list.Levels[0];
            level.ParagraphProperties.LeftIndent          = 150;
            level.ParagraphProperties.FirstLineIndentType = ParagraphFirstLineIndent.Hanging;
            level.ParagraphProperties.FirstLineIndent     = 75;
            level.Start               = 1;
            level.NumberingFormat     = NumberingFormat.Decimal;
            level.DisplayFormatString = "{0}";

            level = list.Levels[1];
            level.ParagraphProperties.LeftIndent          = 300;
            level.ParagraphProperties.FirstLineIndentType = ParagraphFirstLineIndent.Hanging;
            level.ParagraphProperties.FirstLineIndent     = 150;
            level.Start               = 1;
            level.NumberingFormat     = NumberingFormat.DecimalEnclosedParenthses;
            level.DisplayFormatString = "{0}→{1}";

            level = list.Levels[2];
            level.ParagraphProperties.LeftIndent          = 450;
            level.ParagraphProperties.FirstLineIndentType = ParagraphFirstLineIndent.Hanging;
            level.ParagraphProperties.FirstLineIndent     = 220;
            level.Start               = 1;
            level.NumberingFormat     = NumberingFormat.LowerRoman;
            level.DisplayFormatString = "{0}→{1}→{2}";

            // Create a list for use in the document. It is based on a previously defined abstract list with ID = 0.
            document.NumberingLists.Add(0);
            document.EndUpdate();

            document.AppendText("Line one\nLine two\nLine three\nLine four");
            // Convert all paragraphs to list items of level 0.
            document.BeginUpdate();
            ParagraphCollection paragraphs = document.Paragraphs;
            foreach (Paragraph pgf in paragraphs)
            {
                pgf.ListIndex = 0;
                pgf.ListLevel = 0;
            }
            // Specify a different level for a certain paragraph.
            document.Paragraphs[1].ListLevel = 1;
            document.EndUpdate();
            #endregion #CreateNumberedList
        }
        public void TabStops()
        {
            //ExStart
            //ExFor:TabStop.#ctor
            //ExFor:TabStop.#ctor(Double)
            //ExFor:TabStop.#ctor(Double,TabAlignment,TabLeader)
            //ExFor:TabStop.Equals(TabStop)
            //ExFor:TabStop.IsClear
            //ExFor:TabStopCollection
            //ExFor:TabStopCollection.After(Double)
            //ExFor:TabStopCollection.Before(Double)
            //ExFor:TabStopCollection.Count
            //ExFor:TabStopCollection.Equals(TabStopCollection)
            //ExFor:TabStopCollection.Equals(Object)
            //ExFor:TabStopCollection.GetHashCode
            //ExFor:TabStopCollection.Item(Double)
            //ExFor:TabStopCollection.Item(Int32)
            //ExSummary:Shows how to add tab stops to a document.
            Document        doc     = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            // Access the collection of tab stops and add some tab stops to it
            TabStopCollection tabStops = builder.ParagraphFormat.TabStops;

            // 72 points is one "inch" on the Microsoft Word tab stop ruler
            tabStops.Add(new TabStop(72.0));
            tabStops.Add(new TabStop(432.0, TabAlignment.Right, TabLeader.Dashes));

            Assert.AreEqual(2, tabStops.Count);
            Assert.IsFalse(tabStops[0].IsClear);
            Assert.IsFalse(tabStops[0].Equals(tabStops[1]));

            builder.Writeln("Start\tTab 1\tTab 2");

            // Get the collection of paragraphs that we've created
            ParagraphCollection paragraphs = doc.FirstSection.Body.Paragraphs;

            Assert.AreEqual(2, paragraphs.Count);

            // Each paragraph gets its own TabStopCollection which gets values from the DocumentBuilder's collection
            Assert.AreEqual(paragraphs[0].ParagraphFormat.TabStops, paragraphs[1].ParagraphFormat.TabStops);
            Assert.AreNotSame(paragraphs[0].ParagraphFormat.TabStops, paragraphs[1].ParagraphFormat.TabStops);
            Assert.AreNotEqual(paragraphs[0].ParagraphFormat.TabStops.GetHashCode(),
                               paragraphs[1].ParagraphFormat.TabStops.GetHashCode());

            // A TabStopCollection can point us to TabStops before and after certain positions
            Assert.AreEqual(72.0, tabStops.Before(100.0).Position);
            Assert.AreEqual(432.0, tabStops.After(100.0).Position);

            doc.Save(ArtifactsDir + "TabStopCollection.TabStops.docx");
            //ExEnd
        }
Beispiel #21
0
        /// <summary>
        /// Reads the text to document.
        /// </summary>
        /// <param name="text">The text.</param>
        private void ReadTextToDocument(string text)
        {
            ParagraphCollection parCol = ParagraphBuilder.CreateParagraphCollection(
                this._document, text, false, ParagraphBuilder.ParagraphSeperator);

            if (parCol != null)
            {
                foreach (Paragraph paragraph in parCol)
                {
                    this._document.Content.Add(paragraph);
                }
            }
        }
        public void RemoveDuplicateStyles()
        {
            //ExStart
            //ExFor:CleanupOptions.DuplicateStyle
            //ExSummary:Shows how to remove duplicated styles from the document.
            Document doc = new Document();

            // Add two styles to the document with identical properties,
            // but different names. The second style is considered a duplicate of the first.
            Style myStyle = doc.Styles.Add(StyleType.Paragraph, "MyStyle1");

            myStyle.Font.Size  = 14;
            myStyle.Font.Name  = "Courier New";
            myStyle.Font.Color = Color.Blue;

            Style duplicateStyle = doc.Styles.Add(StyleType.Paragraph, "MyStyle2");

            duplicateStyle.Font.Size  = 14;
            duplicateStyle.Font.Name  = "Courier New";
            duplicateStyle.Font.Color = Color.Blue;

            Assert.AreEqual(6, doc.Styles.Count);

            // Apply both styles to different paragraphs within the document.
            DocumentBuilder builder = new DocumentBuilder(doc);

            builder.ParagraphFormat.StyleName = myStyle.Name;
            builder.Writeln("Hello world!");

            builder.ParagraphFormat.StyleName = duplicateStyle.Name;
            builder.Writeln("Hello again!");

            ParagraphCollection paragraphs = doc.FirstSection.Body.Paragraphs;

            Assert.AreEqual(myStyle, paragraphs[0].ParagraphFormat.Style);
            Assert.AreEqual(duplicateStyle, paragraphs[1].ParagraphFormat.Style);

            // Configure a CleanOptions object, then call the Cleanup method to substitute all duplicate styles
            // with the original and remove the duplicates from the document.
            CleanupOptions cleanupOptions = new CleanupOptions();

            cleanupOptions.DuplicateStyle = true;

            doc.Cleanup(cleanupOptions);

            Assert.AreEqual(5, doc.Styles.Count);
            Assert.AreEqual(myStyle, paragraphs[0].ParagraphFormat.Style);
            Assert.AreEqual(myStyle, paragraphs[1].ParagraphFormat.Style);
            //ExEnd
        }
Beispiel #23
0
        void QuoteMessage(RichEditDocumentServer server)
        {
            Document            document   = server.Document;
            ParagraphCollection paragraphs = document.Paragraphs;

            foreach (Paragraph paragraph in paragraphs)
            {
                DocumentRange range = paragraph.Range;
                if (document.GetTableCell(range.Start) == null && !paragraph.IsInList)
                {
                    document.InsertText(range.Start, ">> ");
                }
            }
        }
Beispiel #24
0
        public void IgnoreFootnote(bool isIgnoreFootnotes)
        {
            //ExStart
            //ExFor:FindReplaceOptions.IgnoreFootnotes
            //ExSummary:Shows how to ignore footnotes during a find-and-replace operation.
            Document        doc     = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            builder.Write("Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
            builder.InsertFootnote(FootnoteType.Footnote, "Lorem ipsum dolor sit amet, consectetur adipiscing elit.");

            builder.InsertParagraph();

            builder.Write("Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
            builder.InsertFootnote(FootnoteType.Endnote, "Lorem ipsum dolor sit amet, consectetur adipiscing elit.");

            // Set the "IgnoreFootnotes" flag to "true" to get the find-and-replace
            // operation to ignore text inside footnotes.
            // Set the "IgnoreFootnotes" flag to "false" to get the find-and-replace
            // operation to also search for text inside footnotes.
            FindReplaceOptions options = new FindReplaceOptions {
                IgnoreFootnotes = isIgnoreFootnotes
            };

            doc.Range.Replace("Lorem ipsum", "Replaced Lorem ipsum", options);
            //ExEnd

            ParagraphCollection paragraphs = doc.FirstSection.Body.Paragraphs;

            foreach (Paragraph para in paragraphs)
            {
                Assert.AreEqual("Replaced Lorem ipsum", para.Runs[0].Text);
            }

            List <Footnote> footnotes = doc.GetChildNodes(NodeType.Footnote, true).Cast <Footnote>().ToList();

            Assert.AreEqual(
                isIgnoreFootnotes
                    ? "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
                    : "Replaced Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
                footnotes[0].ToString(SaveFormat.Text).Trim());
            Assert.AreEqual(
                isIgnoreFootnotes
                    ? "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
                    : "Replaced Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
                footnotes[1].ToString(SaveFormat.Text).Trim());
        }
        public void IsRevision()
        {
            //ExStart
            //ExFor:Paragraph.IsDeleteRevision
            //ExFor:Paragraph.IsInsertRevision
            //ExSummary:Shows how to work with revision paragraphs.
            Document  doc  = new Document();
            Body      body = doc.FirstSection.Body;
            Paragraph para = body.FirstParagraph;

            para.AppendChild(new Run(doc, "Paragraph 1. "));
            body.AppendParagraph("Paragraph 2. ");
            body.AppendParagraph("Paragraph 3. ");

            // The above paragraphs are not revisions.
            // Paragraphs that we add after starting revision tracking will register as "Insert" revisions.
            doc.StartTrackRevisions("John Doe", DateTime.Now);

            para = body.AppendParagraph("Paragraph 4. ");

            Assert.True(para.IsInsertRevision);

            // Paragraphs that we remove after starting revision tracking will register as "Delete" revisions.
            ParagraphCollection paragraphs = body.Paragraphs;

            Assert.AreEqual(4, paragraphs.Count);

            para = paragraphs[2];
            para.Remove();

            // Such paragraphs will remain until we either accept or reject the delete revision.
            // Accepting the revision will remove the paragraph for good,
            // and rejecting the revision will leave it in the document as if we never deleted it.
            Assert.AreEqual(4, paragraphs.Count);
            Assert.True(para.IsDeleteRevision);

            // Accept the revision, and then verify that the paragraph is gone.
            doc.AcceptAllRevisions();

            Assert.AreEqual(3, paragraphs.Count);
            Assert.That(para, Is.Empty);
            Assert.AreEqual(
                "Paragraph 1. \r" +
                "Paragraph 2. \r" +
                "Paragraph 4.", doc.GetText().Trim());
            //ExEnd
        }
Beispiel #26
0
        public void DealWord(KeyValuePair <string, string> item)
        {
            string              newContent = string.Empty, text = string.Empty;
            Document            doc         = new Document(item.Value);
            ParagraphCollection pCollection = null;

            if (doc.FirstSection.Body.Paragraphs.Count > 0)
            {
                pCollection = doc.FirstSection.Body.Paragraphs;//word中的所有段落
            }
            foreach (Paragraph pc in pCollection)
            {
                text        = tool.GetUtf8String(tool.StringConvert(pc.GetText())).Replace("\r", "").Replace("\f", "");
                newContent += Translate(text) + "\r\n";
            }
            tool.WriteWord(item.Key, newContent);
        }
Beispiel #27
0
        public void AcceptRevisions()
        {
            //ExStart:AcceptAllRevisions
            Document  doc  = new Document();
            Body      body = doc.FirstSection.Body;
            Paragraph para = body.FirstParagraph;

            // Add text to the first paragraph, then add two more paragraphs.
            para.AppendChild(new Run(doc, "Paragraph 1. "));
            body.AppendParagraph("Paragraph 2. ");
            body.AppendParagraph("Paragraph 3. ");

            // We have three paragraphs, none of which registered as any type of revision
            // If we add/remove any content in the document while tracking revisions,
            // they will be displayed as such in the document and can be accepted/rejected.
            doc.StartTrackRevisions("John Doe", DateTime.Now);

            // This paragraph is a revision and will have the according "IsInsertRevision" flag set.
            para = body.AppendParagraph("Paragraph 4. ");
            Assert.True(para.IsInsertRevision);

            // Get the document's paragraph collection and remove a paragraph.
            ParagraphCollection paragraphs = body.Paragraphs;

            Assert.AreEqual(4, paragraphs.Count);
            para = paragraphs[2];
            para.Remove();

            // Since we are tracking revisions, the paragraph still exists in the document, will have the "IsDeleteRevision" set
            // and will be displayed as a revision in Microsoft Word, until we accept or reject all revisions.
            Assert.AreEqual(4, paragraphs.Count);
            Assert.True(para.IsDeleteRevision);

            // The delete revision paragraph is removed once we accept changes.
            doc.AcceptAllRevisions();
            Assert.AreEqual(3, paragraphs.Count);
            Assert.That(para, Is.Empty);

            // Stopping the tracking of revisions makes this text appear as normal text.
            // Revisions are not counted when the document is changed.
            doc.StopTrackRevisions();

            // Save the document.
            doc.Save(ArtifactsDir + "WorkingWithRevisions.AcceptRevisions.docx");
            //ExEnd:AcceptAllRevisions
        }
Beispiel #28
0
        public void DealWord(KeyValuePair <string, string> item)
        {
            Document            doc         = new Document(item.Value);
            ParagraphCollection pCollection = null;

            if (doc.FirstSection.Body.Paragraphs.Count > 0)
            {
                pCollection = doc.FirstSection.Body.Paragraphs;//word中的所有段落
            }
            string text = string.Empty;

            foreach (Paragraph pc in pCollection)
            {
                text += pc.GetText() + "\r\n";
            }
            string newText = Translate(text);

            tool.WriteWord(item.Key, newText);
        }
        public void IsRevision()
        {
            //ExStart
            //ExFor:Paragraph.IsDeleteRevision
            //ExFor:Paragraph.IsInsertRevision
            //ExSummary:Shows how to work with revision paragraphs.
            // Create a blank document, populate the first paragraph with text and add two more
            Document  doc  = new Document();
            Body      body = doc.FirstSection.Body;
            Paragraph para = body.FirstParagraph;

            para.AppendChild(new Run(doc, "Paragraph 1. "));
            body.AppendParagraph("Paragraph 2. ");
            body.AppendParagraph("Paragraph 3. ");

            // We have three paragraphs, none of which registered as any type of revision
            // If we add/remove any content in the document while tracking revisions,
            // they will be displayed as such in the document and can be accepted/rejected
            doc.StartTrackRevisions("John Doe", DateTime.Now);

            // This paragraph is a revision and will have the according "IsInsertRevision" flag set
            para = body.AppendParagraph("Paragraph 4. ");
            Assert.True(para.IsInsertRevision);

            // Get the document's paragraph collection and remove a paragraph
            ParagraphCollection paragraphs = body.Paragraphs;

            Assert.AreEqual(4, paragraphs.Count);
            para = paragraphs[2];
            para.Remove();

            // Since we are tracking revisions, the paragraph still exists in the document, will have the "IsDeleteRevision" set
            // and will be displayed as a revision in Microsoft Word, until we accept or reject all revisions
            Assert.AreEqual(4, paragraphs.Count);
            Assert.True(para.IsDeleteRevision);

            // The delete revision paragraph is removed once we accept changes
            doc.AcceptAllRevisions();
            Assert.AreEqual(3, paragraphs.Count);
            Assert.That(para, Is.Empty);
            //ExEnd
        }
        static void CreateBulletedList(RichEditDocumentServer server)
        {
            #region #CreateBulletedList
            Document document = server.Document;
            document.BeginUpdate();
            // Define an abstract list that is the pattern for lists used in the document.
            AbstractNumberingList list = document.AbstractNumberingLists.Add();
            list.NumberingType = NumberingType.Bullet;

            // Specify parameters for each list level.

            ListLevel level = list.Levels[0];
            level.ParagraphProperties.LeftIndent = 100;
            level.CharacterProperties.FontName   = "Symbol";
            level.DisplayFormatString            = new string('\u00B7', 1);

            level = list.Levels[1];
            level.ParagraphProperties.LeftIndent = 250;
            level.CharacterProperties.FontName   = "Symbol";
            level.DisplayFormatString            = new string('\u006F', 1);

            level = list.Levels[2];
            level.ParagraphProperties.LeftIndent = 450;
            level.CharacterProperties.FontName   = "Symbol";
            level.DisplayFormatString            = new string('\u00B7', 1);

            // Create a list for use in the document. It is based on a previously defined abstract list with ID = 0.
            document.NumberingLists.Add(0);
            document.EndUpdate();

            document.AppendText("Line 1\nLine 2\nLine 3");
            // Convert all paragraphs to list items.
            document.BeginUpdate();
            ParagraphCollection paragraphs = document.Paragraphs;
            foreach (Paragraph pgf in paragraphs)
            {
                pgf.ListIndex = 0;
                pgf.ListLevel = 1;
            }
            document.EndUpdate();
            #endregion #CreateBulletedList
        }
Beispiel #31
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Writes this response to the the specified annotation
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public void WriteToCache(IScrScriptureNote ann, FwStyleSheet styleSheet)
		{
			ParagraphCollection parasResponse = new ParagraphCollection(Paragraphs, styleSheet);

			ParagraphCollection.ParaMatchType type;
			int matchIndex = FindMatchingResponse(parasResponse, ann.ResponsesOS, out type);

			switch (type)
			{
				case ParagraphCollection.ParaMatchType.Exact:
				case ParagraphCollection.ParaMatchType.Contains:
					break; // we can ignore the new response -- it's a subset of the old.
				case ParagraphCollection.ParaMatchType.IsContained:
					IStJournalText oldText = ann.ResponsesOS[matchIndex];
					oldText.ParagraphsOS.Clear();
					parasResponse.WriteToCache(oldText);
					break;
				case ParagraphCollection.ParaMatchType.None:
					IStJournalText newText = ann.Cache.ServiceLocator.GetInstance<IStJournalTextFactory>().Create();
					ann.ResponsesOS.Add(newText);
					parasResponse.WriteToCache(newText);
					break;
			}
		}
Beispiel #32
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Prepares the paragraphs for the annotation text fields (e.g. Quote, Recommendation,
		/// etc.) and creates the annotation (or finds an existing one having all the same
		/// information).
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private IScrScriptureNote FindOrCreateAnnotation(FwStyleSheet styleSheet)
		{
			FdoCache cache = styleSheet.Cache;

			ParagraphCollection parasQuote = new ParagraphCollection(Quote, styleSheet, cache.DefaultVernWs);
			ParagraphCollection parasDiscussion = new ParagraphCollection(Discussion, styleSheet);
			ParagraphCollection parasRecommendation = new ParagraphCollection(Suggestion, styleSheet);
			ParagraphCollection parasResolution = new ParagraphCollection(Resolution, styleSheet);

			if (m_guidType == Guid.Empty)
				m_guidType = CmAnnotationDefnTags.kguidAnnConsultantNote;
			ScrAnnotationInfo info = new ScrAnnotationInfo(m_guidType, parasDiscussion,
				 parasQuote, parasRecommendation, parasResolution, BeginOffset,
				 BeginScrBCVRef, EndScrBCVRef, m_createdDate);

			IScrScriptureNote scrNote =
				ScrNoteImportManager.FindOrCreateAnnotation(info, m_guidBegObj);

			parasQuote.WriteToCache(scrNote.QuoteOA);
			parasDiscussion.WriteToCache(scrNote.DiscussionOA);
			parasRecommendation.WriteToCache(scrNote.RecommendationOA);
			parasResolution.WriteToCache(scrNote.ResolutionOA);

			return scrNote;
		}
Beispiel #33
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Find a text that matches the paragraph strings in rgtss, if any.
		/// </summary>
		/// <param name="paragraphs">The paragraphs for the response.</param>
		/// <param name="texts">The sequence of journal texts to search.</param>
		/// <param name="type">The type of match found (or not).</param>
		/// <returns>The index of the existing text found to be a match; or -1 if no match is
		/// found</returns>
		/// ------------------------------------------------------------------------------------
		private static int FindMatchingResponse(ParagraphCollection paragraphs,
			FdoOwningSequence<IStJournalText> texts, out ParagraphCollection.ParaMatchType type)
		{
			for (int i = 0; i < texts.Count; ++i)
			{
				if (paragraphs.Equals(texts[i]))
				{
					type = ParagraphCollection.ParaMatchType.Exact;
					return i;
				}
			}

			type = ParagraphCollection.ParaMatchType.None;
			return -1;
		}