# Load document. doc = aw.Document("Extract content.docx") # Define starting and ending paragraphs. startPara = doc.first_section.body.get_child(aw.NodeType.PARAGRAPH, 6, True).as_paragraph() endPara = doc.first_section.body.get_child(aw.NodeType.PARAGRAPH, 10, True).as_paragraph() # Extract the content between these paragraphs in the document. Include these markers in the extraction. extractedNodes = extract_content(startPara, endPara, True) # Generate document containing extracted content. dstDoc = generate_document(doc, extractedNodes) # Save document. dstDoc.save("extract_content_between_paragraphs.docx")