# Paragraph

Learn the steps involved in adding, deleting, and modifying a paragraph in a Word document. Learn more in DsWord docs.

## Content

DsWord allows you to add, modify, and delete a paragraph from a Word document. It allows you to add a paragraph to the paragraph collection using [Add](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ParagraphCollection.Add.html) method of the [ParagraphCollection](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ParagraphCollection.html) class, modify it using the [Paragraphs](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.RangeBase.Paragraphs.html) property which accesses the paragraph collection, and delete it using the [Delete](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ContentObject.Delete.html) method of the [ContentObject](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ContentObject.html) class.

## Add Paragraph

To add a paragraph to a document:

1. Access the paragraph collection using **Paragraphs** property of the [RangeBase](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.RangeBase.html) class.
2. Add a paragraph using **Add** method of the **ParagraphCollection** class.

    ```csharp
    //Add first paragraph
    doc.Body.Sections.First.GetRange().Paragraphs.Add("Hello, World!");
    
    //Add another paragraph
    doc.Body.Sections.First.GetRange().Paragraphs.Add("Document Solutions");
    
    //Save the document
    doc.Save("AddParagraph.docx");
    ```

## Modify Paragraph

To modify a paragraph in a document:

1. Access the paragraph you want to modify from the paragraph collection using Paragraphs property of the **RangeBase** class. For example, access the first paragraph using First property of the ParagraphCollection class.
2. Modify the [Paragraph](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Paragraph.html) class properties. For example, use the [Format](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Paragraph.Format.html) property for accessing the paragraph formatting properties such as the [Alignment](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ParagraphFormat.Alignment.html) property to set the alignment of the paragraph.

    ```csharp
    doc.Load("AddParagraph.docx");
    //Modify settings of the first paragraph
    doc.Body.Sections.First.GetRange().Paragraphs.First.Format.Alignment = ParagraphAlignment.Center;
    
    //Save the document
    doc.Save("ModifyParagraph.docx");
    ```

## Delete Paragraph

To delete a paragraph from a document, access a paragraph from the paragraph collection using the Paragraphs property and delete it using [Delete](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ContentObject.Delete.html) method of the [ContentObject](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ContentObject.html) class.

```csharp
doc.Load("AddParagraph.docx");
//Delete the last paragraph
doc.Body.Sections.First.GetRange().Paragraphs.Last.Delete();

//Save the document
doc.Save("DeleteParagraph.docx");
```

For more information on how to work with paragraphs using DsWord, see [DsWord sample browser](https://developer.mescius.com/documents-api-word/demos/).