off2txt:从Office文件中提取文本
项目描述
从Office文件中提取ASCII/Unicode文本到单独的文件。
如果您有一个包含两种语言(例如英语和中文)的文档,并且希望将语言分开到文本文件以进行进一步处理和分析,则非常有用。
支持Open XML文件格式。也就是说,docx,pptx和xlsx。
Word和PowerPoint文件提取到文本文件。Excel文件提取到CSV文件,列被保留。
可以在不打开Excel的情况下从Excel创建CSV文件。
示例
从Word文档中提取ASCII和Unicode文本
$ off2txt -s word.docx
上面的操作将创建两个文件:word-ascii.txt和word-unicode.txt
从Excel文档中提取ASCII和Unicode文本
$ off2txt -s excel.xlsx
上面的操作将创建两个文件:excel-ascii.csv和excel-unicode.csv
注意
如果提取的文件为空,则不会创建该文件。
Excel不同。列被保留。因此可能会得到一个空列的CSV文件。如果单元格仅包含ASCII,则将单元格放入提取的ASCII文件中,否则将它们流式传输到Unicode文件。
用法
usage: off2txt [options] File [File ...]
off2txt: extract ASCII/Unicode text from Office files to separate files
positional arguments:
File Files to extract from
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
--debug Turn on debug logging.
--debug-log FILE Save debug logging to FILE.
-a EXTENSION, --ascii EXTENSION
Identifier to append to input file name to make ASCII
output file name when splitting Unicode and ASCII
text. Default ascii.
-d DIRECTORY, --directory DIRECTORY
Save extracted text to DIRECTORY. Ignored if the -o
option is given.
-e EXTENSION, --extension EXTENSION
Extension to use for extracted text files. Default for
Word and PowerPoint is txt. Default for Excel is csv.
-o FILE, --output FILE
Save extracted text to FILE. If not given, the output
file is named the same as the input file but with a
txt extension. The extension can be changed with the
-e option. Files are opened in append mode unless the
-X option is given.
-s, --split Split ASCII and Unicode text into two separate files.
Unicode files are named by adding -unicode before the
file extension. The Unicode identifer can be changed
with the -u option.
-u EXTENSION, --unicode EXTENSION
Identifier to append to input file name to make
Unicode output file name when splitting Unicode and
ASCII text. Default unicode.
-A, --suppress-file-access-errors
Do not print file/directory access errors.
-X, --overwrite-output-files
Truncate output files before writing.
项目详情
下载文件
下载您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。
源代码分发
off2txt-0.1.0.tar.gz (187.3 kB 查看哈希值)
构建分发
off2txt-0.1.0-py2.py3-none-any.whl (9.8 kB 查看哈希值)