Free Support Forum - aspose.com

Removing default paragraph

Hi,

I am using Aspose Words for java.I create a new Document using

Document doc = new Document();

This creates a one section and one paragraph.I want to remove this paragraph.without deleting the section.Can i do that?

Hi

Thanks for your request. Sure you can, just remove the first paragraph of the first section. For instance, see the following code:

Document doc = new Document();

doc.FirstSection.Body.FirstParagraph.Remove();

But you should not if you save such document, Aspose.Words will automatically create one empty paragraph to make the document valid.

Best regards,