Skip to main content

这是个测试版,正式版请检索FreeWork!

Project description

★ 关于FreeWork的相关介绍 (Introduction for FreeWork)★

本文档为中英双语文档,其中括号内的为中文部分的英语译文,其二者内容相同。(This document is a bilingual document in Chinese and English, with the English translation of the Chinese part enclosed in parentheses, both of which have the same content.)

一、安装 (Installation)

pip install FreeWork

二、使用 (Usage)

1. 导包 (Import)

from FreeWork import OfficeWork as ow

2. 内置函数 (Integrated functions)

(1) 文件复制函数 (File Copy Function)

本函数用于复制文件,在复制的同时可以根据需求修改函数名字。通常与for循环结合进行批量复制并改名的操作。(This function is used to copy files, and the function name can be modified as needed while copying. Usually combined with the for loop for batch copying and renaming operations.)

from FreeWork import OfficeWork as ow

ow.CopyFile(FileOriginalPath, FileNewPath)
# ow.CopyFile(文件原始路径, 文件新路径)

注意,这里文件路径为包含文件名的路径,可以是相对路径,也可以是绝对路径。如:(1)D:ExampleEasyWorkexample.png;(2)Exampleexample.png。

(Note that the file path here is a path that includes the file name, which can be a relative path or an absolute path. For example:(1)D:ExampleEasyWorkexample.png;(2)Exampleexample.png)

(2) 文件剪切函数 (File Copy Function)

本函数用于剪切文件,在剪切的同时可以根据需求修改函数名字。通常与for循环结合进行批量剪切并改名的操作。(This function is used to move files, and the function name can be modified as needed while moving. Usually combined with the for loop for batch move and renaming operations.)

from FreeWork import OfficeWork as ow

ow.MoveFile(FileOriginalPath, FileNewPath)
# ow.MoveFile(文件原始路径, 文件新路径)

注意,这里文件路径为包含文件名的路径,可以是相对路径,也可以是绝对路径。如:(1)D:ExampleEasyWorkexample.jpg;(2)Exampleexample.jpg。

(Note that the file path here is a path that includes the file name, which can be a relative path or an absolute path. For example:(1)D:ExampleEasyWorkexample.jpg;(2)Exampleexample.jpg)

(3) Excle读取函数 (Excel read function)

from FreeWork import OfficeWork as ow

List = ow.ExcleRead(ExclePath, SheetIndex, Rowlow, Rowmax, Collow, Colmax)
# ow.ExcleRead(Excle路径, Sheet序号, 最小行号, 最大行号, 最小列号, 最大列号)

注意,这里所有的序号均是从1开始而不是0!而且列号为数字,请不要填写字母。文件路径同样为包含文件名的路径,可以是相对路径,也可以是绝对路径,与前面的函数所需的路径形式相同。(Note that all serial numbers here start from 1 instead of 0! And the column number is a number, please do not fill in letters.The file path is also a path that includes the file name, which can be a relative path or an absolute path, in the same form as the path required by the previous function.)

比如我需要获取example.xlsx中sheet1的(2,3)到(5,7)的所有数据,则应当如下调用:

(For example, if I need to retrieve all the data from (2,3) to (5,7) of Sheet1 in example.xlsx, I should call as follows:)

from FreeWork import OfficeWork as ow

List = ow.ExcleRead("\Example\example.xlsx", 1, 2, 5, 3, 7)

(4) Excle写入函数(Excel write function)

from FreeWork import OfficeWork as ow

ow.ExcleWrite(ExclePath, SheetIndex, CellRow, CellCol, Value, SaveAsNewFile(True / False))
# ow.ExcleWrite(Excle路径, Sheet序号, 单元格行号, 单元格列号, 要赋的值, 是否保存为新文件(True/False))

注意,这里所有的序号均是从1开始而不是0!而且列号为数字,请不要填写字母。文件路径同样为包含文件名的路径,可以是相对路径,也可以是绝对路径,与前面的函数所需的路径形式相同。(Note that all serial numbers here start from 1 instead of 0! And the column number is a number, please do not fill in letters.The file path is also a path that includes the file name, which can be a relative path or an absolute path, in the same form as the path required by the previous function.)

本函数只能填写单个单元格,若需批量填写,可与for循环等结合使用。(This function can only fill in a single cell. If batch filling is required, it can be used in conjunction with for loops, etc.)

(5) Word表格读取函数 (Word Table Reading Function)

from FreeWork import OfficeWork as ow

List = WordTableRead(WordPath, TableIndex)
# ow.WordTableRead(Word路径, 表格索引)

注意,这里表格索引为全局索引。文件路径同样为包含文件名的路径,可以是相对路径,也可以是绝对路径,与前面的函数所需的路径形式相同。(Note that the table index here is a global index. The file path is also a path that includes the file name, which can be a relative path or an absolute path, in the same form as the path required by the previous function.)

(6) Word表格写入函数 (Word Table Writing Function)

from FreeWork import OfficeWork as ow

ow.WordTableWrite(WordPath, TableIndex, Row, Col, InputText, SaveAsNewFile(True / False))
# ow.WordTableWrite(Word路径, 表格索引, 行号, 列号, 欲写入的文本, 是否保存为新文件(True/False))

注意,这里行号与Excle的不同,加入表格1的未合并前为6个单元格,此时将1、2单元格合并。此时“行号”参数填写1与2均会写入第一个单元格,当填入3时才会写入第二个单元格。列与行的情况相同。(Note that the row numbers here are different from Excel. Before joining Table 1, there are 6 unmerged cells. In this case, cells 1 and 2 will be merged. At this point, filling in 1 and 2 for the “line number” parameter will be written to the first cell, and only when filling in 3 will it be written to the second cell. The situation is the same for columns and rows.)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

FreeWorkUT-0.0.15.zip (12.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page