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

Free Support Forum - aspose.com

I want to delete the extra empty lines in the file, but there are pictures and package in the file

I have 2 files, source file(test-shape.docx) and target file(target-test-shape.docx),I want to delete useless blank lines and set the picture to top and bottom wrapping, How can I do it?test-shape.docx (148.5 KB)
target-test-shape.docx (147.6 KB)

@lovecomputer

Please use the following code example to get the desired output. Hope this helps you.

var document = new Aspose.Words.Document(MyDir + "test-shape.docx");

foreach (Paragraph paragraph in document.GetChildNodes(NodeType.Paragraph, true))
{
    if (!paragraph.HasChildNodes)
        paragraph.Remove();

    if (paragraph.HasChildNodes && paragraph.FirstChild.NodeType == NodeType.Shape)
    {
        ((Shape)paragraph.FirstChild).WrapType = WrapType.Inline;
        paragraph.ParagraphFormat.Alignment = ParagraphAlignment.Center;
    }
}

document.Save(MyDir + "output.docx");