We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to read whether paragraph has space or not using aspose.words?

if user wantedly gave space between paragraph then in tht case i have to get as it is how much he gave …if in another case only default spaces in paragraph…i have to remove tht spaces in between paragraph…

// Iterate through all paragraphs in the source document to avoid the staying paragraphs together.
foreach (Paragraph para in oCurrentDoc.GetChildNodes(NodeType.Paragraph, true))
{
    para.ParagraphFormat.KeepWithNext = false;
    para.ParagraphFormat.SpaceAfterAuto = false;
    para.ParagraphFormat.SpaceAfter = 0;
}

Hi,

Thanks for your query. I have tried to understand your problem statement and based on my understanding you want to remove empty paragraphs from document. Please use the following code snippet to remove empty paragraphs. Hope this answer your query. If this does not help you, please share some more information about your issue.

Document doc = new Document(DirDoc + "in.doc");
NodeCollection paras = doc.GetChildNodes(NodeType.Paragraph, true);
Aspose.Words.Node[] nodes = paras.ToArray();
foreach (Node node in nodes)
{
    if ((node as Paragraph).HasChildNodes == false)
        (node as Paragraph).Remove();
}
doc.Save(DirDoc + "Out.doc");

if user gave space after paragraph in word document i mean he gave spaceafter as 36 points…while converting to pdf i have to get tht space as it is in pdf …pls see my below code and let me know how to solve?

foreach (Paragraph para in oCurrentDoc.GetChildNodes(NodeType.Paragraph, true))
{
    para.ParagraphFormat.KeepWithNext = false;
    para.ParagraphFormat.SpaceAfterAuto = false;
    para.ParagraphFormat.SpaceAfter = 0;
}

Hi,

It would be great, If you share a sample .doc file to get a clear idea about your question.