# Load document doc = aw.Document("Extract content.docx") # Gather a list of the paragraphs using the respective heading styles. parasStyleHeading1 = paragraphs_by_style_name(doc, "Heading 1") parasStyleHeading3 = paragraphs_by_style_name(doc, "Heading 3") # Use the first instance of the paragraphs with those styles. startPara1 = parasStyleHeading1[0] endPara1 = parasStyleHeading3[0] # Extract the content between these nodes in the document. Don't include these markers in the extraction. extractedNodes = extract_content(startPara1, endPara1, False) # Generate document containing extracted content. dstDoc = generate_document(doc, extractedNodes) # Save document. dstDoc.save("extract_content_between_paragraphs_based_on-Styles.docx")