Exemplo n.º 1
0
        /// <summary>
        /// 创建书签
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="alignment"></param>
        /// <param name="outlineLevel"></param>
        /// <param name="fontSize"></param>
        /// <param name="bookmarkName"></param>
        /// <param name="bookmarkText"></param>
        private static void CreateBookmark(Aspose.Words.DocumentBuilder builder, Aspose.Words.ParagraphAlignment alignment,
                                           Aspose.Words.OutlineLevel outlineLevel, double fontSize, string bookmarkName, string bookmarkText)
        {
            // 清除段落样式
            builder.ParagraphFormat.ClearFormatting();

            // TODO 创建书签
            builder.StartBookmark(bookmarkName);
            builder.ParagraphFormat.Alignment    = alignment;
            builder.ParagraphFormat.OutlineLevel = outlineLevel;
            builder.ParagraphFormat.SpaceBefore  = builder.ParagraphFormat.SpaceAfter = 15;
            builder.Font.Size = fontSize;
            builder.Font.Name = "Arial";
            builder.Font.Bold = true;
            builder.Writeln(bookmarkText);
            builder.EndBookmark(bookmarkName);
        }