首页 > 编程语言 > 详细

excel带格式复制python

时间:2020-10-08 22:19:00      阅读:232      评论:0      收藏:0      [点我收藏+]
openpyxl 复制cell单元格包括所有样式

target_cell.data_type = source_cell.data_type
target_cell.fill = copy(source_cell.fill)
if source_cell.has_style:
    target_cell._style = copy(source_cell._style)
    target_cell.font = copy(source_cell.font)
    target_cell.border = copy(source_cell.border)
    target_cell.fill = copy(source_cell.fill)
    target_cell.number_format = copy(source_cell.number_format)
    target_cell.protection = copy(source_cell.protection)
    target_cell.alignment = copy(source_cell.alignment)
 
if source_cell.hyperlink:
    target_cell._hyperlink = copy(source_cell.hyperlink)
 
if source_cell.comment:
    target_cell.comment = copy(source_cell.comment)
 

 

excel带格式复制python

原文:https://www.cnblogs.com/xkdn/p/13782827.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!