[]
        
(Showing Draft Content)

Line Spacing

GcWord allows you to specify line spacing for a paragraph using LineSpacing property of the Spacing class which can be accessed using Spacing property of the ParagraphFormat class.

Get Line Spacing

To get the line spacing of a paragraph:

  1. Access a paragraph from the paragraph collection using Paragraphs property of the RangeBase class.

  2. Access the paragraph formatting properties using Format property of the Paragraph class.

  3. Get the spacing properties applied to the paragraph using Spacing property of the ParagraphFormat class.

  4. Get the value of the line spacing for the paragraph using LineSpacing property of the Spacing class.

  5. Display the line spacing value on the console.

    //Get line spacing
    Console.WriteLine("Line spacing:" + 
        doc.Body.Sections.First.GetRange().Paragraphs.Last.Format.Spacing.LineSpacing);
    

Set Line Spacing

To set the line spacing of a paragraph:

  1. Access a paragraph from the paragraph collection using Paragraphs property of the RangeBase class.

  2. Access the paragraph formatting properties using Format property of the Paragraph class.

  3. Get the spacing properties applied to the paragraph using Spacing property of the ParagraphFormat class.

  4. Set the line spacing rule using LineSpacingRule property of the Spacing class.

  5. Set the value of the line spacing for the paragraph using LineSpacing property of the Spacing class.

    //Set line spacing
    doc.Body.Sections.First.GetRange().Paragraphs.Last.Format.Spacing.LineSpacingRule = 
        LineSpacingRule.Exact;
    doc.Body.Sections.First.GetRange().Paragraphs.Last.Format.Spacing.LineSpacing = 30;
    

For more information on how to implement line spacing using GcWord, see GcWord sample browser.