为了账号安全,请及时绑定邮箱和手机立即绑定

Python办公自动化

离岛 全栈工程师
难度入门
时长 3小时44分
学习人数
综合评分8.93
16人评价 查看评价
9.2 内容实用
9.2 简洁易懂
8.4 逻辑清晰
  • 只支持2003-2013的.xls格式,不支持.xlsx格式

    查看全部
    0 采集 收起 来源:xlwt模块介绍

    2024-02-25

  • pip install pymysql

    查看全部
  • http://img1.sycdn.imooc.com//64a3846e0001732912340884.jpg

    python装使用教程

    查看全部
    0 采集 收起 来源:安装Python

    2023-07-04

  • 111

    查看全部
  • PyCharm常用快捷键

    1、编码/开发

    shift + enter  开启新的一行

    ctrl + /  注释

    ctrl + alt + i  自动缩进

    ctrl + q  快速查找文档

    ctrl + shift +/-  展开/折叠代码块

    ctrl_alt + space  快速导入

    2、查找/替换

    ctrl + f  当前文件查找

    ctrl + r  当前文件查找替换

    ctrl + shift +f   全局查找

    ctrl + shift +r   全局替换

    ctrl + n  查找类的名称

    3、运行/调试

    shift + f10  运行

    shift + f9  调试

    alt + shift + f10  运行模式配置

    alt + shift + f9  调试模式配置

    4、自定义快捷键

    file - > setting - > keymap

    查看全部
    0 采集 收起 来源:PyCharm的使用

    2022-11-15

  • 111

    查看全部
  • 111

    查看全部
  • 快捷键~~~~~625e775d0001b06d12000540.jpg625e77660001f19e12000540.jpg625e778a00014a6b12000540.jpg
    查看全部
    0 采集 收起 来源:PyCharm的使用

    2022-04-19

  • Py chrome常用快捷键大全


    620e35f6000116bc09600540.jpg620e36810001d23009600540.jpg
    620e36af0001879209600540.jpg
    ——————《Python办公自动化》
    查看全部
    1 采集 收起 来源:PyCharm的使用

    2022-02-17

  • # 添加表格

    table = slide.shapes.add_table(2, 3, Inches(2), Inches(2), Inches(4), Inches(2)).table

    # 填充内容

    table.cell(0, 0).text = 'title1'

    table.cell(0, 1).text = 'title2'

    table.cell(0, 2).text = 'title3'

    # 合并单元格

    cell = table.cell(0, 0)

    cell1 = table.cell(0, 2)

    cell.merge(cell1)

    # 取消合并单元格

    if cell.is_merge_origin:

        cell.split()

    查看全部
    0 采集 收起 来源:写入表格到PPT

    2022-01-18

  • from pptx.util import Inches, Pt

    from pptx.enum.shapes import MSO_SHAPE

    from pptx.dml.color import RGBColor

    # 添加自选图形

    shape = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, Inches(2), Inches(2), Inches(5), Inches(3))

    # 设置填充色、边框样式

    fill = shape.fill

    fill.solid()

    fill.fore_color.rgb = RGBColor(255, 0, 0)

    line = shape.line

    line.color.rgb = RGBColor(55, 3, 5)

    line.width = Pt(2)

    查看全部
    0 采集 收起 来源:添加图形到PPT

    2022-01-18

  • import pptx

    from pptx.util import Inches


    # 得到演示文稿的对象

    prs = pptx.Presentation()

    # 打开ppt

    # prs = pptx.Presentation('test.pptx')


    # 指定模板,插入一张幻灯片

    slide = prs.slides.add_slide(prs.slide_layouts[0])

    prs.slides.add_slide(prs.slide_layouts[1])

    prs.slides.add_slide(prs.slide_layouts[2])


    # 删除幻灯片

    del prs.slides._sldIdLst[1]


    # 向幻灯片中插入文本框

    text1 = slide.shapes.add_textbox(Inches(5), Inches(5), Inches(5), Inches(5))

    text1.text = '我是文本框'

    p1 = text1.text_frame.add_paragraph()

    p1.text = '我是段落1'

    p1.add_run().text = 'end'


    # 向幻灯片中现有的元素写入文本

    title_shape = slide.shapes.title

    title_shape.text = '标题1'

    slide.shapes.placeholders[1].text = '标题2'


    # 保存ppt文档

    prs.save('test.pptx')

    查看全部
    0 采集 收起 来源:写入文本到PPT

    2022-01-17

  • pip install python-pptx

    import pptx

    查看全部
  • pip install pywin32

    from win32com.client import constants, gencache

    import os


    def createpdf(wordPath, pdfPath):

        word = gencache.EnsureDispatch('Word.Application'

        doc = word.Documents.Open(wordPath, ReadOnly=1)

        # 转换方法

        doc.ExportAsFixedFormat(pdfPath, constants.wdExportFormatPDF)

        word.Quit()


    # 单个文件转换

    createpdf('info.docx', 'info.pdf')


    # 多个文件转换

    os.listdir('.') # 获取当前文件夹下的所有文件

    wordfiles = []    # 存储当前文件夹下的所有word文件

    for file in os.listdir('.'):

        if file.endswith(('.doc', '.docx')):

            wordfiles.append(file)

    for file in wordfiles:

        filepath = os.path.abspath(file)    # 获取文件的绝对路径

        index = filepath.rindex('.') # 获取最后一个点的索引

        pdfpath = filepath[:index] + '.pdf' # 构造pdf绝对路径

        createpdf(filepath, pdfpath)

    查看全部
    0 采集 收起 来源:Word转换PDF

    2022-01-11

    • from docx.enum.style import WD_STYLE_TYPE # 导入

    • style = document.styles.add_style('textstyle', WD_STYLE_TYPE.PARAGRAPH) # 创建段落样式

    • style.font.size = Pt(5) # 设置字体大小

    • p1 = document.add_paragraph('texttexttext', style='textstyle') # 为段落设置样式

    • 官方文档:https://python-docx.readthedocs.io/en/latest/user/styles-using.html

    • 样式对照表:http://www.thedoctools.com/index.php?show=mt_create_style_name_list

    • http://img1.sycdn.imooc.com//61dc111400015dea08940490.jpg

    • table = document.add_table(rows=1, cols=3, style='Medium List 1') # 为表格设置内置样式

    • document.styles['textstyle'].delete() # 删除样式

    查看全部
    0 采集 收起 来源:Word样式处理

    2022-01-10

    • document.add_picture('logo.jpg') # 插入图片

    • document.add_picture('logo.jpg', Pt(20), Pt(30)) # 插入图片,设置宽高

    • table = document.add_table(rows=1, cols=2) # 插入表格

    • header_cells = table.rows[0].cells # 获取第一行的单元格

    • header_cells[0].text = 'title' # 向表格中写入内容

    • rows.cells = table.add_row().cells # 添加行

    • len(document.tables[0].rows) # 获取文档中第一个表格的总行数

    • document.tables[0].cell(0, 1).text # 获取文档中第一个表格的第一行第二列的内容

    查看全部
    • from docx import Document

    • from docx.shared import Pt, RGBColor

    • document = Document() # 创建文档对象

    • document = Document("info.docx") # 读取现有word,创建文档对象

    • document.add_heading('title') # 写入标题,默认标题1样式

    • document.add_heading('title', level=4) # 指定标题级别

    • p1 = document.add_paragraph('xxxxxxxxxxxxxxxxx') # 写入段落

    • p1.insert_paragraph_before('xxxxxxxxxx') # 在段落前插入段落

    • format = p1.paragraph_format # 获取段落的样式

    • format.left_indent = Pt(20) # 左侧缩进

    • format.right_indent = Pt(20) # 右侧缩进

    • format.first_line_indent = Pt(20) # 首行缩进

    • format.line_spacing = 1.5 # 1.5倍行间距

    • run = p1.add_run('xxxxxxxxxx') # 在段落后追加文字

    • run.font.size = Pt(12) # 设置字号

    • run.font.name = '微软雅黑' # 设置字体

    • run.font.color.rgb = RGBColor(235, 33, 24) # 设置文字颜色

    • run.bold = True # 设置加粗

    • run.font.underline = True # 添加下划线

    • run.font.italic = True # 设置斜体

    • document.save('test.docx') # 保存文档

    查看全部
    1 采集 收起 来源:写入文本到Word

    2022-01-06

  • python-docx

    查看全部
    • import xlsxwriter

    • wb = xlsxwriter.Workbook("data.xlsx") # 创建工作簿

    • sheet = wb.add_worksheet("newsheet") # 创建工作表

    • sheet.write(0, 0, "title") # 写入单元格数据

    • sheet.merge_range(1, 0, 2, 2, "data") # 合并单元格并写入数据

    • sheet.write_row(3, 0, ["col1", "col2", "col3" ]

    • sheet.write(7, 1, "=sum(B5:B7)" # 写入公式

    • sheet.write_url(9, 0, "http://www.baidu.com", string = "更多数据" # 写入超链接

    • sheet.insert_image(10, 0, "view.png") # 插入图片

    • wb.close() # 关闭文件

    查看全部
    • style = xlwt.XFStyle() # 初始化样式


    • font = xlwt.Font() # 初始化字体

    • font.name = "宋体" # 字体名称

    • font.bold = True # 加粗

    • font.height = 11 * 20 # 字号设置为11,20为衡量单位

    • font.colour_index = 0x08 # 字体颜色设置为黑色,也可等于索引1

    • style.font = font # 设置字体


    • align = xlwt.Alignment() # 初始化对齐方式

    • align.horz = 0x02 # 设置水平方向居中对齐

    • align.vert = 0x01 # 设置垂直方向居中对齐

    • style.alignment = align # 设置对齐方式


    • borders = xlwt.Borders() # 初始化边框

    • borders.right = xlwt.Borders.DASHED # 右边框设置为虚线

    • borders.bottom = xlwt.Borders.DOTTED # 下边框设置为点线

    • style.borders = borders # 设置边框样式


    • bgcolor = xlwt.Pattern() # 初始化颜色模式

    • bgcolor.pattern = xlwt.Pattern.SOLID_PATTERN # 颜色模式设置为背景颜色

    • bgcolor.pattern_fore_colour = 22 # 背景颜色设置为灰色

    • style.pattern = bgcolor # 设置背景颜色


    • ws.write(0, 0, value, style) # 设置单元格样式

    查看全部
    0 采集 收起 来源:写入格式化

    2021-12-28

    • import xlwt # 导入模块,只支持xls格式

    • wb = xlwt.Wortbook() # 创建工作簿

    • ws = wb.add_sheet("sheet1") # 创建sheet

    • ws.write_merge(0, 1, 0, 5, "title") # 合并单元格,并写入数据

    • ws.write(i + 2, j, value) # 向单元格写入数据

    • ws.insert_bimap("文件路径.bmp", 0, 1) # 插入图片

    • wb. save("保存文件路径.xls") # 保存工作簿

    查看全部
    0 采集 收起 来源:xlwt写入Excel

    2021-12-27

  • pip install xlrd

    查看全部
    0 采集 收起 来源:xlrd常用函数

    2021-11-27

    1. 使用pycharm

    2. pycharm常用配置

    3. ctrl+shift+F10 运行

    4. 文件和代码片段  #author:username #createdate:${DATE}

    查看全部
    0 采集 收起 来源:PyCharm的使用

    2021-11-08

首页上一页1234567下一页尾页

举报

0/150
提交
取消
课程须知
有python语法基础,缺少完整项目开发经验,为找工作增加经验而学习
老师告诉你能学到什么?
学好办公自动化,走遍天下都不怕。本课程会讲解如何巧妙充分的利用python强大的第三方办公文件库。利用python高效的开发办公自动化之Office。实现Excel自动化,Word自动化,PPT自动化。

微信扫码,参与3人拼团

意见反馈 帮助中心 APP下载
官方微信
友情提示:

您好,此课程属于迁移课程,您已购买该课程,无需重复购买,感谢您对慕课网的支持!