Aspose.Words.Examples.CSharp.Programming_Documents.Bookmarks.UntangleRowBookmarks.Run C# (CSharp) Метод

Run() публичный статический Метод

public static Run ( ) : void
Результат void
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_WorkingWithBookmarks();
            string fileName = "TestDefect1352.doc";
            // Load a document.
            Document doc = new Document(dataDir + fileName);

            // This perform the custom task of putting the row bookmark ends into the same row with the bookmark starts.
            Untangle(doc);

            // Now we can easily delete rows by a bookmark without damaging any other row's bookmarks.
            DeleteRowByBookmark(doc, "ROW2");

            // This is just to check that the other bookmark was not damaged.
            if (doc.Range.Bookmarks["ROW1"].BookmarkEnd == null)
                throw new Exception("Wrong, the end of the bookmark was deleted.");

            dataDir = dataDir + RunExamples.GetOutputFilePath(fileName);
            // Save the finished document.
            doc.Save(dataDir);

            Console.WriteLine("\nRow bookmark untangled successfully.\nFile saved at " + dataDir);
        }