Why an empty line at the beginning of the document?


I just create an empty 'Aspose.Words.Document'.

Then I create a 'Aspose.Words.Paragraph' and add to it a 'Aspose.Words.Run' object with a sample text.

I add the 'Paragraph' to the document with this code: 'asposeDocument.FirstSection.Body.AppendChild( ... )'

When I open then the created document the text starts from the second line !! The first line is kept empty !!

How can I avoid this behaviour ?



Hi David,

This happens because a blank document already has one empty paragraph as a child of the first section's body. You can call for example


before adding your paragraph to the document.

Another way (a neater one probably) is using DocumentBuilder.Write and DocumentBuilder.Writeln to insert text into the document.