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


C# ParagraphProperties类代码示例

本文整理汇总了C#中ParagraphProperties的典型用法代码示例。如果您正苦于以下问题:C# ParagraphProperties类的具体用法?C# ParagraphProperties怎么用?C# ParagraphProperties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: GenerateParagraph

        public static void GenerateParagraph(this Body body, string text, string styleId)
        {
            var paragraph = new Paragraph
                                {
                                    RsidParagraphAddition = "00CC1B7A",
                                    RsidParagraphProperties = "0016335E",
                                    RsidRunAdditionDefault = "0016335E"
                                };

            var paragraphProperties = new ParagraphProperties();
            var paragraphStyleId = new ParagraphStyleId {Val = styleId};

            paragraphProperties.Append(paragraphStyleId);

            var run1 = new Run();
            var text1 = new Text();
            text1.Text = text;

            run1.Append(text1);

            paragraph.Append(paragraphProperties);
            paragraph.Append(run1);

            body.Append(paragraph);
        }
开发者ID:Jaykul,项目名称:pickles,代码行数:25,代码来源:BodyExtensions.cs

示例2: ApplyFooter

        private void ApplyFooter(FooterPart footerPart)
        {
            var footer1 = new Footer();
            footer1.AddNamespaceDeclaration("ve", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            footer1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
            footer1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            footer1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
            footer1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
            footer1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
            footer1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
            footer1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
            footer1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");

            var paragraph1 = new Paragraph { RsidParagraphAddition = "005641D2", RsidRunAdditionDefault = "005641D2" };

            var paragraphProperties1 = new ParagraphProperties();
            var paragraphStyleId1 = new ParagraphStyleId { Val = "Footer" };

            paragraphProperties1.Append(paragraphStyleId1);

            var run1 = new Run();
            var text1 = new Text();
            text1.Text = "Generated with Pickles " + Assembly.GetExecutingAssembly().GetName().Version;

            run1.Append(text1);

            paragraph1.Append(paragraphProperties1);
            paragraph1.Append(run1);

            footer1.Append(paragraph1);

            footerPart.Footer = footer1;
        }
开发者ID:vavavivi,项目名称:pickles,代码行数:33,代码来源:WordHeaderFooterFormatter.cs

示例3: GetParagraphProperties

        private static ParagraphProperties GetParagraphProperties(Model.Paragraph paragraph)
        {
            ParagraphProperties paraProps = new ParagraphProperties();

            SpacingBetweenLines paraSpacing = new SpacingBetweenLines()
            {
                Before = Utilities.GetDxaFromPoints(paragraph.SpacingBefore),
                After = Utilities.GetDxaFromPoints(paragraph.SpacingAfter),
                LineRule = LineSpacingRuleValues.Auto,
                //If the value of the lineRule attribute is auto, then the value of the line attribute shall be interpreted as 240ths of a line
                Line = (paragraph.Leading * 240).ToString()
            };

            Justification justification = new Justification();
            switch (paragraph.Justification)
            {
                case DocGen.ObjectModel.Justification.Left:
                    justification.Val = JustificationValues.Left;
                    break;
                case DocGen.ObjectModel.Justification.Center:
                    justification.Val = JustificationValues.Center;
                    break;
                case DocGen.ObjectModel.Justification.Right:
                    justification.Val = JustificationValues.Right;
                    break;
                case DocGen.ObjectModel.Justification.Justified:
                    justification.Val = JustificationValues.Both;
                    break;
            }

            paraProps.Append(justification);
            paraProps.Append(paraSpacing);

            return paraProps;
        }
开发者ID:amilasurendra,项目名称:pdf-generator,代码行数:35,代码来源:ParagraphFormatter.cs

示例4: GetListItem

        /// <summary>
        /// Returns a OpenXMl paragraph representing formatted listItem.
        /// </summary>
        /// <param name="item">listItem object</param>
        /// <param name="numStyleId">style id to use</param>
        /// <returns></returns>
        private static Paragraph GetListItem(Model.ListItem item, int numStyleId)
        {
            Paragraph listItemPara = new Paragraph();

            ParagraphProperties paraProps = new ParagraphProperties();

            NumberingProperties numberingProps = new NumberingProperties();
            NumberingLevelReference numberingLevelReference = new NumberingLevelReference() { Val = 0 };

            NumberingId numberingId = new NumberingId() { Val = numStyleId };

            numberingProps.Append(numberingLevelReference);
            numberingProps.Append(numberingId);
            paraProps.Append(numberingProps);

            Run listRun = new Run();
            Text listItemText = new Text()
            {
                Text = item.Body
            };
            listRun.Append(listItemText);

            listItemPara.Append(paraProps);
            listItemPara.Append(listRun);

            return listItemPara;
        }
开发者ID:amilasurendra,项目名称:pdf-generator,代码行数:33,代码来源:ListFormatter.cs

示例5: ApplyTags

        //____________________________________________________________________
        //
        /// <summary>
        /// Apply all the current Html tag to the specified table cell.
        /// </summary>
        public override void ApplyTags(OpenXmlCompositeElement tableCell)
        {
            if (tags.Count > 0)
            {
                TableCellProperties properties = tableCell.GetFirstChild<TableCellProperties>();
                if (properties == null) tableCell.PrependChild<TableCellProperties>(properties = new TableCellProperties());

                var en = tags.GetEnumerator();
                while (en.MoveNext())
                {
                    TagsAtSameLevel tagsOfSameLevel = en.Current.Value.Peek();
                    foreach (OpenXmlElement tag in tagsOfSameLevel.Array)
                        properties.Append(tag.CloneNode(true));
                }
            }

            // Apply some style attributes on the unique Paragraph tag contained inside a table cell.
            if (tagsParagraph.Count > 0)
            {
                Paragraph p = tableCell.GetFirstChild<Paragraph>();
                ParagraphProperties properties = p.GetFirstChild<ParagraphProperties>();
                if (properties == null) p.PrependChild<ParagraphProperties>(properties = new ParagraphProperties());

                var en = tagsParagraph.GetEnumerator();
                while (en.MoveNext())
                {
                    TagsAtSameLevel tagsOfSameLevel = en.Current.Value.Peek();
                    foreach (OpenXmlElement tag in tagsOfSameLevel.Array)
                        properties.Append(tag.CloneNode(true));
                }
            }
        }
开发者ID:TimNFL,项目名称:PEACReportsDemo,代码行数:37,代码来源:TableStyleCollection.cs

示例6: ApplyStyle

 public static Paragraph ApplyStyle(this Paragraph paragrah, string style)
 {
     ParagraphProperties properties = new ParagraphProperties();
     properties.ParagraphStyleId = new ParagraphStyleId() { Val = style };
     paragrah.Append(properties);
     return paragrah;
 }
开发者ID:IdeaFortune,项目名称:DocumentGenerator,代码行数:7,代码来源:ParagraphExtensions.cs

示例7: OXMLParagraphFormatWrap

        public OXMLParagraphFormatWrap(Paragraph paragraph)
        {
            if (paragraph.ParagraphProperties == null)
                paragraph.ParagraphProperties = new ParagraphProperties();

            pPr = paragraph.ParagraphProperties;
            if (pPr.Justification == null)
                pPr.Justification = new Justification() { Val = JustificationValues.Left };
        }
开发者ID:VLunev,项目名称:RachetRR4,代码行数:9,代码来源:OXMLParagraphFormatWrap.cs

示例8: Test_Style_01

        public static void Test_Style_01()
        {
            SetDirectory();
            string file = "test_Style_01.docx";
            Trace.WriteLine("create docx \"{0}\" using OXmlDoc", file);

            using (WordprocessingDocument doc = WordprocessingDocument.Create(zPath.Combine(_directory, file), WordprocessingDocumentType.Document))
            {
                MainDocumentPart mainPart = doc.AddMainDocumentPart();

                mainPart.Document = new Document();
                Body body = mainPart.Document.AppendChild(new Body());

                //body.AppendChild(Test_OXmlCreator.CreateSectionProperties());
                SectionProperties sectionProperties = body.AppendChild(new SectionProperties());
                Test_OpenXml_Creator.SetSectionPage(sectionProperties);

                //SectionProperties sectionProperties = new SectionProperties();
                //// PageSize, <w:pgSz w:w="11907" w:h="16839"/>, 11907 1/20 point = 21 cm, 16839 1/20 point = 29.7 cm, unit = 1/20 point, 11907 1/20 point = 595.35 point
                //sectionProperties.AppendChild(new PageSize { Width = 11907, Height = 16839 });
                //// top 1.27 cm, bottom 1.27 cm, left 2.5 cm, right 2.5 cm, header 0.5 cm, footer 0.5 cm
                //// <w:pgMar w:top="720" w:right="1418" w:bottom="720" w:left="1418" w:header="284" w:footer="284" w:gutter="0"/>
                //sectionProperties.AppendChild(new PageMargin { Top = 720, Bottom = 720, Left = 1418, Right = 1418, Header = 284, Footer = 284 });
                //body.AppendChild(sectionProperties);

                //Trace.WriteLine("add StyleDefinitionsPart");
                Styles styles = Test_OpenXml_Creator.CreateStyles(mainPart);

                //Trace.WriteLine("create DocDefaults");
                styles.DocDefaults = Test_OpenXml_Creator.CreateDocDefaults();
                //string tinyParagraphStyleId = Test_OXmlCreator.CreateStyleTinyParagraph(styles);
                string tinyParagraphStyleId = "TinyParagraph";
                styles.Append(Test_OpenXml_Creator.CreateTinyParagraphStyle(tinyParagraphStyleId));

                //string styleAliases = "style_01";
                //Trace.WriteLine($"create style {styleId}");


                //Paragraph paragraph = body.AppendChild(new Paragraph());
                //Run run = paragraph.AppendChild(new Run());
                //run.RunProperties = new RunProperties(new RunFonts() { Ascii = "Arial" });

                //RunProperties runProperties = new RunProperties(new RunFonts() { Ascii = "Arial" });
                //Run r = package.MainDocumentPart.Document.Descendants<Run>().First();
                //r.PrependChild<RunProperties>(rPr);

                ParagraphProperties paragraphProperties = new ParagraphProperties();
                // ParagraphStyleId, <w:pStyle>
                paragraphProperties.ParagraphStyleId = new ParagraphStyleId { Val = tinyParagraphStyleId };

                //AddText(body);
                //AddText(body, paragraphProperties);
                body.Append(Test_OpenXml_Creator.CreateText_01(paragraphProperties));
            }
        }
开发者ID:labeuze,项目名称:source,代码行数:55,代码来源:Test_OpenXml_Style.cs

示例9: GenerateParagraph

 /// <summary>
 /// создание параграфа
 /// </summary>
 /// <param name="text">null = пустая строка</param>
 /// <param name="parProp">null = настройки из стиля</param>
 /// <returns></returns>
 public void GenerateParagraph(Run run = null, ParagraphProperties parProp = null)
 {
     var paragraph = new Paragraph();
     parProp = parProp ?? GetParagraphProperties();
     paragraph.Append(parProp);
     if (run != null)
     {
         paragraph.Append(run);
     }
     _body.Append(paragraph);
 }
开发者ID:silmarion,项目名称:WPDHelper,代码行数:17,代码来源:DocBuilderHelpers.cs

示例10: ToOpenXmlElements

        public override IEnumerable<OpenXmlElement> ToOpenXmlElements(DocumentFormat.OpenXml.Packaging.MainDocumentPart mainDocumentPart)
        {
            var result = new DocumentFormat.OpenXml.Wordprocessing.Paragraph();

            var paragraphProperties = new ParagraphProperties();

            var numberingProperties = new NumberingProperties();
            var numberingLevelReference = new NumberingLevelReference() { Val = 0 };

            NumberingId numberingId;
            ParagraphStyleId paragraphStyleId;
            if (Parent is OrderedListFormattedElement)
            {
                paragraphStyleId = new ParagraphStyleId() { Val = "NumberedList" };
                numberingId = new NumberingId() { Val = ((OrderedListFormattedElement)Parent).NumberingInstanceId };

                var indentation = new Indentation() { Left = "1440", Hanging = "720" };
                paragraphProperties.Append(indentation);
            }
            else
            {
                paragraphStyleId = new ParagraphStyleId() { Val = "UnorderedListStyle" };
                numberingId = new NumberingId() { Val = 3 };
            }

            numberingProperties.Append(numberingLevelReference);
            numberingProperties.Append(numberingId);

            var spacingBetweenLines= new SpacingBetweenLines() { After = "100", AfterAutoSpacing = true };

            paragraphProperties.Append(paragraphStyleId);
            paragraphProperties.Append(numberingProperties);
            paragraphProperties.Append(spacingBetweenLines);
            result.Append(paragraphProperties);

            ForEachChild(x =>
            {
                if (x is TextFormattedElement)
                {
                    result.Append(
                        new DocumentFormat.OpenXml.Wordprocessing.Run(x.ToOpenXmlElements(mainDocumentPart))
                    );

                }
                else
                {
                    result.Append(x.ToOpenXmlElements(mainDocumentPart));
                }
            });

            return new List<OpenXmlElement> { result };
        }
开发者ID:julienblin,项目名称:RadarPOC,代码行数:52,代码来源:ListItemFormattedElement.cs

示例11: IsSectionProps

        static bool IsSectionProps(ParagraphProperties pPr)
        {

            SectionProperties sectPr = pPr.GetFirstChild<SectionProperties>();

            if (sectPr == null)

                return false;

            else

                return true;

        }
开发者ID:aspose-words,项目名称:Aspose.Words-for-.NET,代码行数:14,代码来源:Program.cs

示例12: SetListProperties

        private void SetListProperties(NumberFormatValues numberFormat, ParagraphProperties paragraphProperties)
        {
            ParagraphStyleId paragraphStyleId = new ParagraphStyleId() { Val = "ListParagraph" };

            NumberingProperties numberingProperties = new NumberingProperties();
            NumberingLevelReference numberingLevelReference = new NumberingLevelReference() { Val = 0 };
            NumberingId numberingId = new NumberingId() { Val = ((Int32)numberFormat) + 1 };

            numberingProperties.Append(numberingLevelReference);
            numberingProperties.Append(numberingId);

            paragraphProperties.Append(paragraphStyleId);
            paragraphProperties.Append(numberingProperties);
        }
开发者ID:kannan-ar,项目名称:MariGold.OpenXHTML,代码行数:14,代码来源:DocxOL.cs

示例13: CreateCodeParagraph

        private Paragraph CreateCodeParagraph(CodeVM code)
        {
            Paragraph paragraph1 = new Paragraph();

            ParagraphProperties paragraphProperties1 = new ParagraphProperties();
            Indentation indentation1 = new Indentation(){ FirstLine = "210", FirstLineChars = 100 };

            paragraphProperties1.Append(indentation1);

            Run run1 = new Run();

            RunProperties runProperties1 = new RunProperties();
            RunFonts runFonts1 = new RunFonts(){ Hint = FontTypeHintValues.EastAsia };

            runProperties1.Append(runFonts1);
            Text text1 = new Text();
            text1.Text = code.Value;
            run1.Append(runProperties1);
            run1.Append(text1);

            Run run2 = new Run();

            RunProperties runProperties2 = new RunProperties();
            RunFonts runFonts2 = new RunFonts(){ Hint = FontTypeHintValues.EastAsia };

            runProperties2.Append(runFonts2);
            TabChar tabChar1 = new TabChar();

            run2.Append(runProperties2);
            run2.Append(tabChar1);

            Run run3 = new Run();

            RunProperties runProperties3 = new RunProperties();
            RunFonts runFonts3 = new RunFonts(){ Hint = FontTypeHintValues.EastAsia };

            runProperties3.Append(runFonts3);
            Text text2 = new Text();
            text2.Text = code.Label;

            run3.Append(runProperties3);
            run3.Append(text2);

            paragraph1.Append(paragraphProperties1);
            paragraph1.Append(run1);
            paragraph1.Append(run2);
            paragraph1.Append(run3);
            return paragraph1;
        }
开发者ID:Easy-DDI-Organizer,项目名称:EDO,代码行数:49,代码来源:CodebookWriter.cs

示例14: ApplyTags

        /// <summary>
        /// Apply all the current Html tag (Paragraph properties) to the specified paragrah.
        /// </summary>
        public override void ApplyTags(OpenXmlCompositeElement paragraph)
        {
            if (tags.Count == 0) return;

            ParagraphProperties properties = paragraph.GetFirstChild<ParagraphProperties>();
            if (properties == null) paragraph.PrependChild<ParagraphProperties>(properties = new ParagraphProperties());

            var en = tags.GetEnumerator();
            while (en.MoveNext())
            {
                TagsAtSameLevel tagsOfSameLevel = en.Current.Value.Peek();
                foreach (OpenXmlElement tag in tagsOfSameLevel.Array)
                    properties.Append(tag.CloneNode(true));
            }
        }
开发者ID:TimNFL,项目名称:PEACReportsDemo,代码行数:18,代码来源:ParagraphStyleCollection.cs

示例15: AddAlphaRow

        public Paragraph AddAlphaRow()
        {
            var paragraph1 = new Paragraph {RsidParagraphMarkRevision = "005205ED", RsidParagraphAddition = "00A01149", RsidParagraphProperties = "005205ED", RsidRunAdditionDefault = "00E7001C"};

            var paragraphProperties1 = new ParagraphProperties();
            var spacingBetweenLines1 = new SpacingBetweenLines {After = "60", Line = "240", LineRule = LineSpacingRuleValues.Auto};
            var justification1 = new Justification {Val = JustificationValues.Center};

            var paragraphMarkRunProperties1 = new ParagraphMarkRunProperties();
            var runFonts1 = new RunFonts {ComplexScriptTheme = ThemeFontValues.MinorHighAnsi};
            var bold1 = new Bold();
            var fontSize1 = new FontSize {Val = "32"};
            var fontSizeComplexScript1 = new FontSizeComplexScript {Val = "32"};

            paragraphMarkRunProperties1.Append(runFonts1);
            paragraphMarkRunProperties1.Append(bold1);
            paragraphMarkRunProperties1.Append(fontSize1);
            paragraphMarkRunProperties1.Append(fontSizeComplexScript1);

            paragraphProperties1.Append(new KeepNext());
            paragraphProperties1.Append(spacingBetweenLines1);
            paragraphProperties1.Append(justification1);
            paragraphProperties1.Append(paragraphMarkRunProperties1);

            var run1 = new Run {RsidRunProperties = "005205ED"};

            var runProperties1 = new RunProperties();
            var runFonts2 = new RunFonts {ComplexScriptTheme = ThemeFontValues.MinorHighAnsi};
            var bold2 = new Bold();
            var fontSize2 = new FontSize {Val = "32"};
            var fontSizeComplexScript2 = new FontSizeComplexScript {Val = "32"};

            runProperties1.Append(runFonts2);
            runProperties1.Append(bold2);
            runProperties1.Append(fontSize2);
            runProperties1.Append(fontSizeComplexScript2);
            var text1 = new Text();
            text1.Text = FamilyName.Substring(0, 1);

            run1.Append(runProperties1);
            run1.Append(text1);

            paragraph1.Append(paragraphProperties1);
            paragraph1.Append(run1);
            return paragraph1;
        }
开发者ID:stevesloka,项目名称:bvcms,代码行数:46,代码来源:CompactRow.cs


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