Aspose.Words for Python 是一个功能强大的本地类库,可用于众多文档处理任务。它使开发人员能够通过生成、修改、转换和呈现文档等功能来增强自己的应用程序,而无需依赖第三方应用程序,例如 Microsoft Word 或 Office Automation。
此存储库包含一系列 Python 示例,可帮助您学习和探索 API 功能。
以下是 Aspose.Words for Python 的一些流行功能:
尝试我们的免费在线应用程序,演示一些最流行的 Aspose.Words 功能。
Aspose.Words for Python 支持多种加载和保存文档的格式,下面列出了其中一些格式:
Microsoft Word: DOC、DOT、DOCX、DOTX、DOTM、FlatOpc、FlatOpcMacroEnabled、FlatOpcTemplate、FlatOpcTemplateMacroEnabled、RTF、WordML、DocPreWord60
开放文档: ODT、OTT
网页: HTML、MHTML
降价: MD
标记: XamlFixed、HtmlFixed、XamlFlow、XamlFlowPack
固定布局: PDF、XPS、OpenXps
图片: SVG、TIFF、PNG、BMP、JPEG、GIF
图元文件: EMF
打印机: PCL、PS
文本: TXT
电子书: MOBI、CHM、EPUB
Aspose.Words for Python 可用于为各种操作系统开发应用程序,例如安装了 Python 3.5 或更高版本的 Windows 和 Linux。您可以构建 32 位和 64 位 Python 应用程序。
准备好尝试 Aspose.Words for Python 了吗?
只需从控制台运行pip install aspose-words
即可获取包。如果您已经拥有 Aspose.Words for Python 并且想要升级版本,请运行pip install --upgrade aspose-words
来获取最新版本。
您可以在您的环境中运行以下代码片段来查看 Aspose.Words 的工作原理,或者查看示例或 Aspose.Words for Python 文档以了解其他常见用例。
Aspose.Words for Python 允许您创建新的空白文档并向该文档添加内容。
import aspose . words as aw
# Create a blank document.
doc = aw . Document ()
# Use a document builder to add content to the document.
builder = aw . DocumentBuilder ( doc )
# Write a new paragraph in the document with the text "Hello World!".
builder . writeln ( "Hello World!" )
# Save the document in DOCX format. Save format is automatically determined from the file extension.
doc . save ( "output.docx" )
Aspose.Words for Python 还允许您将 Microsoft Word 格式转换为 PDF、XPS、Markdown、HTML、JPEG、TIFF 和其他文件格式。以下代码段演示了从 DOCX 到 HTML 的转换:
import aspose . words as aw
# Load the document from the disc.
doc = aw . Document ( "TestDocument.docx" )
# Save the document to HTML format.
doc . save ( "output.html" )
此外,您可以将 PDF 文档导入到 Python 应用程序中并将其导出为 DOCX 格式文件,而无需安装 Microsoft Word:
import aspose . words as aw
# Load the PDF document from the disc.
doc = aw . Document ( "TestDocument.pdf" )
# Save the document to DOCX format.
doc . save ( "output.docx" )
Dockerfile 包含用于配置 Linux 映像的命令,以便能够通过 .Net 使用 Aspose.Words for Python。
产品页面 |文档 |演示 |示例 |博客 |搜索 |免费支持|临时牌照