Free Support Forum - aspose.com

First carriage return insertion

Hi support,

Within Aspose.Word, I need a way to figure out, before inserting a new paragraph, that I'm about to insert the first one in the current container, which might be a header, a table cell, or even the first paragraph in the document. I want to avoid extra carriage returns. I usually insert a new carriage return before I insert a new paragraph, but this affects my output look. I have some solution for the up-mentioned containers, but a quick and generic solution that doesn't "know" the container type would be helpful.

Regards,
Milan

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. Could you please attach your document and provide me your code? i will investigate this task and try to help you.

I think that you can check the last paragraph of your container. For example something like this.

doc.FirstSection.Body.LastParagraph.HasChildNodes

Best regards.