Aspose.Words FOSS를 사용하여 Python을 사용합니다.

Aspose.Words FOSS를 사용하여 Python을 사용합니다.

Aspose.Words FOSS for Python is a pure Python library for reading and converting Word documents without Microsoft Office. The following use cases illustrate where the library fits into real-world Python applications.


문서 형식 변환

DOCX, DOC, RTF, TXT, Markdown 및 PDF 사이의 변환:

import aspose.words_foss as aw

doc = aw.Document("input.docx")
doc.save("output.pdf")
doc.save("output.md")

이 패턴은 지원되는 입력 및 출력 형식의 모든 조합에 작동합니다.


텍스트 추출

인덱스, 검색 또는 NLP 파이프라인을 위한 Word 문서에서 평평한 텍스트를 추출하십시오.:

import aspose.words_foss as aw

doc = aw.Document("contract.docx")
text = doc.get_text()
# Feed to search index, NLP model, or text analysis

배치 처리

단일 스크립트로 문서 디렉토리를 처리합니다 :

import aspose.words_foss as aw
from pathlib import Path

for src in Path("incoming/").glob("*.docx"):
    doc = aw.Document(str(src))
    doc.save(str(src.with_suffix(".pdf")))

서버 측 문서 처리

일시적인 파일없이 웹 응용 프로그램에서 업로드 된 문서를 읽으십시오 :

import aspose.words_foss as aw

def process_upload(stream):
    doc = aw.Document(stream)
    return {
        "sections": len(doc.sections),
        "text_preview": doc.get_text()[:200]
    }

유산 형식 이민

변환 유산 Word 97-2003 .doc 현대 DOCX 또는 PDF 파일:

import aspose.words_foss as aw

doc = aw.Document("legacy.doc")
doc.save("modern.docx")
doc.save("archive.pdf")

또한 보기

 한국어