Spire.Doc 5.5.71 supports to set the color for different levels bookmark

Spire.Doc

We are glad to announce the new hotfix version of Spire.Doc 5.5.71 today. We add new feature to enable developers to set the color for different levels bookmark. We also fixed bugs in this version. View the details as below:

New feature:

Add new feature to set the color for different levels bookmark.

Document document = new Document();
Section section = document.AddSection();
Paragraph p = section.AddParagraph();
p.AppendText("Nested bookmark.");
p.ApplyStyle(BuiltinStyle.Heading4);
section.AddParagraph();
p = section.AddParagraph();
p.AppendBookmarkStart("Root");
p.AppendText(" Root data ");
p.AppendBookmarkStart("NestedLevel1");
p.AppendText(" Nested Level1 ");
for (int i = 0; i < 10; i++)
            {
                p.AppendBookmarkStart("AAAA -" + i.ToString());
                p.AppendText(" Nested Level1 " + i.ToString());
                p.AppendBookmarkEnd("AAAA -" + i.ToString());
            }
            p.AppendText(" Nested Level1 ");
            p.AppendText(" Data Level1 ");
            p.AppendBookmarkEnd("NestedLevel1");
            p.AppendBookmarkStart("NestedLevel2");
            p.AppendText(" Nested Level2 ");
            for (int i = 0; i < 10; i++)
            {
                p.AppendBookmarkStart("BBBB -" + i.ToString());
                p.AppendText(" Nested Level2 " + i.ToString());
                p.AppendBookmarkEnd("BBBB -" + i.ToString());
            }
            p.AppendBookmarkEnd("NestedLevel2");
            p.AppendText(" Data Root ");
            p.AppendBookmarkEnd("Root");
            ToPdfParameterList toPdf = new ToPdfParameterList();
            toPdf.CreateWordBookmarks = true;
            toPdf.WordBookmarksTitle = "Changed bookmark";
            toPdf.WordBookmarksColor = Color.Gray;
            document.BookmarkLayout += document_BookmarkLayout;
            document.SaveToFile("result.pdf", toPdf);
        }
        void document_BookmarkLayout(object sender, Spire.Doc.Documents.Rendering.BookmarkLevelEventArgs args)
        {
            if (args.BookmarkLevel.Level == 2)
            {
                args.BookmarkLevel.Color = Color.Red;
                args.BookmarkLevel.Style = BookmarkTextStyle.Bold;
            }
            else if (args.BookmarkLevel.Level == 3)
            {
                args.BookmarkLevel.Color = Color.Gray;
                args.BookmarkLevel.Style = BookmarkTextStyle.Italic;
            }
            else
            {
                args.BookmarkLevel.Color = Color.Green;
                args.BookmarkLevel.Style = BookmarkTextStyle.Regular;
            }
        }

Bug Solutions:

  • Fixes the issue that caused incorrect formatting when convert .docx to PDF.
  • Fixes the issue where footer with RomanLower was displayed with Arabic numbering when convert .docx to PDF.
  • Fixes the issue that caused content lost when convert .docx to PDF.
  • Fixes the issue that caused incorrect formatting(table,font) when convert .docx to RTF.
  • Fixes the issue that caused incorrect formatting when convert RTF to RTF.
  • Fixes the issue when saving the file as a PDF, the MailMerge fields has no value after calling MailMerge.Execute.
  • Fixes the issue where nativedata that read from excel object in word is null.
  • Resolves the issue that caused Word documents(RTF,Docx) failed to load.
  • Fixes the issue where the content lost when converts RTF to Image.

Welcome to experience Spire.Doc 5.5.71 with downloading here:

http://www.e-iceblue.com/Download/download-word-for-net-now.html