# Line Spacing

Line spacing refers to the amount of space between two successive lines in a paragraph. Learn how to change the line spacing for a paragraph using DsWord.

## Content

DsWord allows you to specify line spacing for a paragraph using [LineSpacing](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Spacing.LineSpacing.html) property of the [Spacing](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Spacing.html) class which can be accessed using [Spacing](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ParagraphFormat.Spacing.html) property of the [ParagraphFormat](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ParagraphFormat.html) class.

## Get Line Spacing

To get the line spacing of a paragraph:

1. Access a paragraph from the paragraph collection using [Paragraphs](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.RangeBase.Paragraphs.html) property of the [RangeBase](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.RangeBase.html) class.
2. Access the paragraph formatting properties using [Format](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Paragraph.Format.html) property of the [Paragraph](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Paragraph.html) 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.

    ```csharp
    //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](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Spacing.LineSpacingRule.html) property of the Spacing class.
5. Set the value of the line spacing for the paragraph using **LineSpacing** property of the Spacing class.

    ```csharp
    //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 DsWord, see [DsWord sample browser](https://developer.mescius.com/documents-api-word/demos/).