none
Insert indent to paragraph RRS feed

Answers

  • OpenXML provides a great document reflector tool, you can always use that and view the "source code".

    But here it is:

    <w:pPr>
        <w:ind w:firstLine="720" />
    </w:pPr>

    Paragraph properties must contain an indent node with a value in DXA (string).

    in C#:

    new Paragraph(new ParagraphProperties(new Indentation() { FirstLine = "720"}), new Run(new Text("test")));

    Note that this is the indent only for the first line of the paragraph!!!

    Explore this class please:

    http://msdn.microsoft.com/en-us/library/documentformat.openxml.wordprocessing.indentation.aspx






    • Edited by ysnikitin Tuesday, February 21, 2012 7:08 PM
    • Marked as answer by guy222 Wednesday, February 22, 2012 4:27 AM
    • Unmarked as answer by guy222 Wednesday, February 22, 2012 5:46 AM
    • Marked as answer by guy222 Wednesday, February 22, 2012 6:01 AM
    Tuesday, February 21, 2012 7:07 PM
  • parProperties.Justification = new WP.Justification(){ Val = WP.JustificationValues.Both };
    • Marked as answer by guy222 Wednesday, February 22, 2012 6:01 AM
    Wednesday, February 22, 2012 6:01 AM

All replies

  • OpenXML provides a great document reflector tool, you can always use that and view the "source code".

    But here it is:

    <w:pPr>
        <w:ind w:firstLine="720" />
    </w:pPr>

    Paragraph properties must contain an indent node with a value in DXA (string).

    in C#:

    new Paragraph(new ParagraphProperties(new Indentation() { FirstLine = "720"}), new Run(new Text("test")));

    Note that this is the indent only for the first line of the paragraph!!!

    Explore this class please:

    http://msdn.microsoft.com/en-us/library/documentformat.openxml.wordprocessing.indentation.aspx






    • Edited by ysnikitin Tuesday, February 21, 2012 7:08 PM
    • Marked as answer by guy222 Wednesday, February 22, 2012 4:27 AM
    • Unmarked as answer by guy222 Wednesday, February 22, 2012 5:46 AM
    • Marked as answer by guy222 Wednesday, February 22, 2012 6:01 AM
    Tuesday, February 21, 2012 7:07 PM
  • Thanks!

    One more. Can you say how can I set horizontal alignment in paragraph? At first I think that property ParagraphProperties.TextAlignment let me to do this, but it's vertical alignment  

    http://msdn.microsoft.com/en-us/library/documentformat.openxml.wordprocessing.textalignment.aspx 


    • Edited by guy222 Wednesday, February 22, 2012 5:47 AM
    Wednesday, February 22, 2012 5:46 AM
  • parProperties.Justification = new WP.Justification(){ Val = WP.JustificationValues.Both };
    • Marked as answer by guy222 Wednesday, February 22, 2012 6:01 AM
    Wednesday, February 22, 2012 6:01 AM
  • Should be:

    new Paragraph(
        new ParagraphProperties(
            new Justification() { Val = JustificationValues.Left}),
        new Run(
            new Text("test")));

    You can use: JustificationValues.Left JustificationValues.Center JustificationValues.Right




    • Edited by ysnikitin Wednesday, February 22, 2012 3:11 PM
    Wednesday, February 22, 2012 3:10 PM