当前位置: 首页>>代码示例>>C#>>正文


C# Paragraph.InsertInProperties方法代码示例

本文整理汇总了C#中DocumentFormat.OpenXml.Drawing.Paragraph.InsertInProperties方法的典型用法代码示例。如果您正苦于以下问题:C# Paragraph.InsertInProperties方法的具体用法?C# Paragraph.InsertInProperties怎么用?C# Paragraph.InsertInProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DocumentFormat.OpenXml.Drawing.Paragraph的用法示例。


在下文中一共展示了Paragraph.InsertInProperties方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessHeading

        private void ProcessHeading(HtmlEnumerator en)
        {
            char level = en.Current[2];

            AlternateProcessHtmlChunks(en, "</h" + level + ">");
            Paragraph p = new Paragraph(elements);
            p.InsertInProperties(
                new ParagraphStyleId() { Val = htmlStyles.GetStyle("heading " + level, false) });

            this.elements.Clear();
            AddParagraph(p);
            AddParagraph(currentParagraph = htmlStyles.Paragraph.NewParagraph());
        }
开发者ID:TimNFL,项目名称:PEACReportsDemo,代码行数:13,代码来源:HtmlConverter.ProcessTag.cs

示例2: ProcessTableCaption

        private void ProcessTableCaption(HtmlEnumerator en)
        {
            if (!tables.HasContext) return;

            string att = en.StyleAttributes["text-align"];
            if (att == null) att = en.Attributes["align"];

            ProcessHtmlChunks(en, "</caption>");

            var runStyleId = htmlStyles.GetStyle("Subtle Reference", true);
            var legend = new Paragraph(
                    new ParagraphProperties(
                        new ParagraphStyleId() { Val = htmlStyles.GetStyle("caption", false) },
                        new ParagraphMarkRunProperties(
                            new RunStyle() { Val = runStyleId })),
                    new Run(
                        new RunProperties(
                            new RunStyle() { Val = runStyleId }),
                        new FieldChar() { FieldCharType = FieldCharValues.Begin }),
                    new Run(
                        new RunProperties(
                            new RunStyle() { Val = runStyleId }),
                        new FieldCode(" SEQ Tableau \\* ARABIC ") { Space = SpaceProcessingModeValues.Preserve }),
                    new Run(
                        new RunProperties(
                            new RunStyle() { Val = runStyleId }),
                        new FieldChar() { FieldCharType = FieldCharValues.End })
                );
            legend.Append(elements);
            elements.Clear();

            if (att != null)
            {
                JustificationValues? align = ConverterUtility.FormatParagraphAlign(att);
                if (align.HasValue)
                {
                    legend.InsertInProperties(new Justification { Val = align });
                }
            }
            else
            {
                // If no particular alignement has been specified for the legend, we will align the legend
                // relative to the owning table
                TableProperties props = tables.CurrentTable.GetFirstChild<TableProperties>();
                if (props != null)
                {
                    TableJustification justif = props.GetFirstChild<TableJustification>();
                    if (justif != null) legend.InsertInProperties(new Justification { Val = justif.Val.Value.ToJustification() });
                }
            }

            if (this.TableCaptionPosition == CaptionPositionValues.Above)
            {
                this.paragraphs.Insert(this.paragraphs.Count - 1, legend);
            }
            else
            {
                this.paragraphs.Add(legend);
            }

            EnsureCaptionStyle();
        }
开发者ID:TimNFL,项目名称:PEACReportsDemo,代码行数:62,代码来源:HtmlConverter.ProcessTag.cs

示例3: ProcessHeading

        private void ProcessHeading(HtmlEnumerator en)
        {
            char level = en.Current[2];
            string clsName = "heading " + level;

            // ensure style exists or the heading will be displayed as a normal text
            if (!htmlStyles.DoesStyleExists(clsName))
            {
                String normalStyleName = htmlStyles.GetStyle("Normal", StyleValues.Paragraph);
                htmlStyles.AddStyle(clsName, new Style(
                    new StyleName() { Val = clsName },
                    new BasedOn() { Val = normalStyleName },
                    new NextParagraphStyle() { Val = normalStyleName },
                    new UnhideWhenUsed(),
                    new PrimaryStyle(),
                    new StyleParagraphProperties()
                    {
                        KeepNext = new KeepNext(),
                        KeepLines = new KeepLines(),
                        SpacingBetweenLines = new SpacingBetweenLines() { Before = "200", After = "0" },
                        OutlineLevel = new OutlineLevel() { Val = (int)Char.GetNumericValue(level) - 1 /* outline starts at 0 */ }
                    },
                    new StyleRunProperties(PredefinedStyles.ResourceManager.GetString(clsName))
                ) { Type = StyleValues.Paragraph, StyleId = clsName });
            }

            // support also style attributes for heading (in case of theme override)
            List<OpenXmlElement> styleAttributes = new List<OpenXmlElement>();
            htmlStyles.Paragraph.ProcessCommonAttributes(en, styleAttributes);

            AlternateProcessHtmlChunks(en, "</h" + level + ">");
            Paragraph p = new Paragraph(elements);
            p.InsertInProperties(prop =>
                prop.ParagraphStyleId = new ParagraphStyleId() { Val = htmlStyles.GetStyle(clsName, StyleValues.Paragraph) });

            htmlStyles.Paragraph.ApplyTags(p);
            htmlStyles.Paragraph.EndTag("<h" + level + ">");

            this.elements.Clear();
            AddParagraph(p);
            AddParagraph(currentParagraph = htmlStyles.Paragraph.NewParagraph());
        }
开发者ID:rexyanglucky,项目名称:uba,代码行数:42,代码来源:HtmlConverter.ProcessTag.cs


注:本文中的DocumentFormat.OpenXml.Drawing.Paragraph.InsertInProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。