【教学类-19-09】20240214《ABAB式-规律黏贴18格-手工纸15*15CM-一页3种图案,AB满,纵向、无边框》(中班)

   e08219889d974416894ea794d73dac8f.png

背景需求

利用15*15CM手工纸制作AB色块手环(手工纸自带色彩),一页3个图案,2条为一组,黏贴成一个手环

素材准备

c680edcdbca644deb5b071d3182d45a6.png

c1685b2efea34fb884390d4f8052219d.png8987aff092c1454d960356390ae2b7f7.png19d42ecefad54f3091a1014f2edf9a6f.png

848c7fc387174d55a540b3f3d53cd5d5.png

fe40eed163b347a4a0c2c483075e416a.png

代码展示

# '''

# 作者:阿夏
# 时间:2024年2月14日
# 名称:正方形数字卡片AB图案 _ 华光彩云_CNKI A的位置有图案 18格 1图案变6个,分布2列,一页3个图案  A空


# '''


import xlwt
import xlrd
import os
import random
from win32com.client import constants,gencache
from win32com.client.gencache import EnsureDispatch
from win32com.client import constants # 导入枚举常数模块
import os,time
import docx
from docx import Document
from docx.shared import Pt 
from docx.shared import RGBColor
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT
from docx.oxml.ns import qn

# num=int(input('多少份 最多24任意数字\n'))

ziti='华光彩云_CNKI'
size=60


patho=['○','□','▽','☆','◇','△','◇','☾','♡','☼','♧','¤','①','②','③','④','⑤','⑥','⑦','⑧','⑨','⑩','①','②']   # 数字圈10个
print(len(patho))
# 24
cs=6
cs3=cs*3

# 把每个符号批量15次
pathall=[]
for t in range(len(patho)):
    for v in range(cs):
        pathall.append(patho[t])
print(pathall)   
print(len(pathall))
# 144


# 因为是7个一页,所以要除以7

# 18分割 ['21个图形','21个图形']
path=[]
for t in range(int(len(pathall)/cs3)):
    path.append(pathall[t*cs3:t*cs3+cs3])
print(path)
print(len(path))
# 8

# # # print('----------第2步:新建一个临时文件夹------------')
# # # # # 新建一个”装N份word和PDF“的文件夹
# os.mkdir
imagePath1=r'C:\Users\jg2yXRZ\OneDrive\桌面\正方形数字卡片\零时Word'
if not os.path.exists(imagePath1):  # 判断存放图片的文件夹是否存在
    os.makedirs(imagePath1)  # 若图片文件夹不存在就创建

print('----------第3步:遍历输入每一种图案 ------------')

bg=[]
for o in range(0,6,2):
    for x1 in range(0,6,2):
        for y1 in range(o,o+1):
            bg.append('{}{}'.format('%02d'%x1,'%02d'%y1))
    for x2 in range(1,6,2):
        for y2 in range(o+1,o+2):
            bg.append('{}{}'.format('%02d'%x2,'%02d'%y2))
print(bg)
print(len(bg))
# 18

# ['0000', '0200', '0400', '0002', '0202', '0402', '0004', '0204', '0404', '0101', '0301', '0501', '0103', '0303', '0503', '0105', '0305', '0505']
# 单独提取
# ['0000', '0200', '0400', '0101', '0301', '0501', '0002', '0202', '0402', '0103', '0303', '0503', '0004', '0204', '0404', '0105', '0305', '0505']

for nn in range(len(path)):  # 8

    doc = Document(r'C:\Users\jg2yXRZ\OneDrive\桌面\正方形数字卡片\2.0正方形数字卡片AB(无框线).docx')

    # for b in range(h):    # 共有2个表格         
    table = doc.tables[0]          # 一共有2个表格 

    # 插入图形
    for tt in range(len(bg)):   # 26个
        pp=int(bg[tt][0:2])    
        qq=int(bg[tt][2:4])  
        # print(p)               
        k=path[nn][tt]              # 每个坐标里面插入一个☉      
        print(pp,qq,k)  

        # 图案符号的字体、大小参数
        run=table.cell(pp,qq).paragraphs[0].add_run(k)    # 在单元格0,0(第1行第1列)输入第0个图图案
        run.font.name = ziti#输入时默认华文彩云字体
        # run.font.size = Pt(46)  #输入字体大小默认30号 换行(一页一份大卡片
        run.font.size = Pt(size) #是否加粗
        run.font.color.rgb = RGBColor(0,0,0) #数字小,颜色深0-255
        run.bold=True
        # paragraph.paragraph_format.line_spacing = Pt(180) #数字段间距
    
        r = run._element
        r.rPr.rFonts.set(qn('w:eastAsia'), ziti)#将输入语句中的中文部分字体变为华文行楷
        table.cell(pp,qq).paragraphs[0].alignment = WD_PARAGRAPH_ALIGNMENT.CENTER #居中  

    doc.save(r'C:\Users\jg2yXRZ\OneDrive\桌面\正方形数字卡片\零时Word\{}.docx'.format('%02d'%nn))   
    time.sleep(1)

    from docx2pdf import convert

    # docx 文件另存为PDF文件
    inputFile = r"C:/Users/jg2yXRZ/OneDrive/桌面/正方形数字卡片/零时Word/{}.docx".format('%02d'%nn)  # 要转换的文件:已存在
    outputFile = r"C:/Users/jg2yXRZ/OneDrive/桌面/正方形数字卡片/零时Word/{}.pdf".format('%02d'%nn)  # 要生成的文件:不存在
    # 先创建 不存在的 文件
    f1 = open(outputFile, 'w')
    f1.close()
    # 再转换往PDF中写入内容
    convert(inputFile, outputFile)
    time.sleep(1)
    
print('----------第4步:把都有PDF合并为一个打印用PDF------------')
    
# 多个PDF合并(CSDN博主「红色小小螃蟹」,https://blog.csdn.net/yangcunbiao/article/details/125248205)
import os
from PyPDF2 import PdfMerger
target_path =  'C:/Users/jg2yXRZ/OneDrive/桌面/正方形数字卡片/零时Word'
pdf_lst = [f for f in os.listdir(target_path) if f.endswith('.pdf')]
pdf_lst = [os.path.join(target_path, filename) for filename in pdf_lst]
pdf_lst.sort()
file_merger = PdfMerger()
for pdf in pdf_lst:
    print(pdf)
    file_merger.append(pdf)
file_merger.write("C:/Users/jg2yXRZ/OneDrive/桌面/正方形数字卡片/(打印合集)5.0正方形手工纸 AB黏贴{} A空6次 一页3个图案,无框线({}张共{}人).pdf".format(cs,int(len(path)),len(path)))
file_merger.close()
# doc.Close()
# print('----------第5步:删除临时文件夹------------')    
import shutil
shutil.rmtree('C:/Users/jg2yXRZ/OneDrive/桌面/正方形数字卡片/零时Word') #递归删除文件夹,即:删除非空文件夹

一共24张图案

2e2216de62e747bcbc87c0fd2b505662.png408db62867c749b48acb739ff18f3109.png

f454857d60f34923a3f9e9041cce574c.png

作品展示

f0e4dbd557de42749d55f6ead6041389.png

灰色图案,线描

ca3942ae58234738ac26fa31616744f5.png

07e7a6c6496d4cc09d48909e56d1e04b.png

2b233faf0b13463cb179177c1f0dc73d.png

 其他相似作品

【教学类-19-11】20240214《ABAB式-规律黏贴18格-手工纸15*15CM-复制空表 有边框》(中班)-CSDN博客文章浏览阅读334次,点赞12次,收藏2次。【教学类-19-11】20240214《ABAB式-规律黏贴18格-手工纸15*15CM-复制空表 有边框》(中班)https://blog.csdn.net/reasonsummer/article/details/136119948【教学类-19-10】20240214《ABAB式-规律黏贴18格-手工纸15*15CM-一页3种图案,AB一组样板,纵向、有边框》(中班)-CSDN博客文章浏览阅读657次,点赞21次,收藏7次。【教学类-19-10】20240214《ABAB式-规律黏贴18格-手工纸15*15CM-一页3种图案,AB一组样板,纵向、有边框》(中班)https://blog.csdn.net/reasonsummer/article/details/136119845【教学类-19-08】20240214《ABAB式-规律黏贴18格-手工纸15*15CM-一页3种图案,A空,纵向、无边框》(中班)-CSDN博客文章浏览阅读295次。【教学类-19-08】20240214《ABAB式-规律黏贴18格-手工纸15*15CM-一页3种图案,A空,纵向、无边框》(中班)https://blog.csdn.net/reasonsummer/article/details/136119680【教学类-19-07】20240214《ABAB式-规律黏贴18格-手工纸15*15CM-一页一种图案,A空,竖向、有边框》(中班)-CSDN博客文章浏览阅读200次。【教学类-19-07】20240214《ABAB式-规律黏贴18格-手工纸15*15CM-一页一种图案,A空,竖向、有边框》(中班)https://blog.csdn.net/reasonsummer/article/details/136119255

【教学类-19-06】20240214《ABAB式-规律黏贴36格-手工纸15*15CM-一页一种图案,A满,横向、边框》(中班)-CSDN博客文章浏览阅读314次,点赞7次,收藏7次。【教学类-19-06】20240214《ABAB式-规律黏贴36格-手工纸15*15CM-一页一种图案,A满,横向、边框》(中班)https://blog.csdn.net/reasonsummer/article/details/136118590【教学类-19-05】20240214《ABAB式-规律黏贴18格-手工纸15*15CM-一页一种图案,A空,横向、边框》(中班)-CSDN博客文章浏览阅读252次。【教学类-19-05】20240214《ABAB式-规律黏贴18格-手工纸15*15CM-一页一种图案,A空,横向、边框》(中班)https://blog.csdn.net/reasonsummer/article/details/136113192

  • 13
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

阿夏reasonsummer

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值