import openpyxl from openpyxl.styles import Font wb = openpyxl.Workbook() ws = wb.active ws.title = "L3第1段剧本" col_widths = {"A": 12, "B": 8, "C": 10, "D": 10, "E": 55, "F": 15, "G": 55, "H": 10, "I": 15} for col, w in col_widths.items(): ws.column_dimensions[col].width = w headers = ["类型", "ID", "组件配置", "知识点", "剧情描述", "名字", "台词", "角色", "台词润色"] bold = Font(bold=True) for i, h in enumerate(headers, 1): cell = ws.cell(row=1, column=i, value=h) cell.font = bold rows = [ ["TL", None, None, None, "【场景】教室 【角色】User、Vicky、Ben、Sunny、Matt、Justin", None, None, None, None], [None, None, None, None, "Justin走进教室,带着一个大纸箱。大家看了看——11号不在。", None, None, None, None], [None, None, None, None, None, "Vicky", "Where is Eleven?", None, None], [None, None, None, None, None, "Justin", "Eleven is broken. It's getting a repair!", None, None], [None, None, None, None, None, "Ben", "Too much smoke! Haha!", None, None], ["TL", None, None, None, "Justin打开纸箱。里面全是纸制品——paper cups、paper spoons、paper plates、还有纸板。", None, None, None, None], [None, None, None, None, None, "Justin", "Today, we make our dragon! With these!", None, None], [None, None, None, None, None, "Sunny", "Paper cups? It is too ugly!", None, None], [None, None, None, None, None, "Matt", "It is too soft. It will break!", None, None], [None, None, None, None, "Ben用手指戳了一下纸板——戳出个洞。", None, None, None, None], [None, None, None, None, None, "Ben", "See? One poke!", None, None], [None, None, None, None, None, "Ben", "A paper dragon? What do you think?", None, None], ["中互动", None, None, None, None, "User", "A paper dragon? It is too weak!", None, None], ["TL", None, None, None, "Justin笑了笑,从箱子底下抽出一个网格状的paper box,放在地上。", None, None, None, None], [None, None, None, None, None, "Justin", "Who wants to try? Stand on it!", None, None], [None, None, None, None, "Ben第一个踩上去——稳稳的。", None, None, None, None], [None, None, None, None, None, "Ben", "Wow! It's okay!", None, None], [None, None, None, None, "Vicky也站上去——没事。", None, None, None, None], [None, None, None, None, "Matt小心翼翼上去,使劲跺了两脚。Paper box纹丝不动。", None, None, None, None], [None, None, None, None, None, "Matt", "How? It's a paper box!", None, None], [None, None, None, None, "Sunny站在旁边。", None, None, None, None], [None, None, None, None, None, "Sunny", "It is too dirty. I'm not going up.", None, None], [None, None, None, None, "Sunny偷偷看着paper box上的网格花纹。", None, None, None, None], [None, None, None, None, None, "Sunny", "Well... the pattern is kind of pretty.", None, None], [None, None, None, None, None, "Justin", "See? A paper box can be very strong!", None, None], ["中互动", None, None, None, None, "Justin", "What is this box made of?", None, None], [None, None, None, None, None, "User", "It is a paper box! But it is so strong!", None, None], ["TL", None, None, None, None, "Justin", "Paper things are Chinese.", None, None], [None, None, None, None, None, "Justin", "Chinese people made paper long ago.", None, None], [None, None, None, None, None, "Justin", "If you fold paper the right way, it is very strong!", None, None], [None, None, None, None, None, "Matt", "So if I fold it right, it will be perfect?", None, None], [None, None, None, None, None, "Justin", "Yes!", None, None], [None, None, None, None, "Sunny翻了个白眼,但手已经在挑好看的彩纸了。", None, None, None, None], ["中互动", None, None, None, None, "Justin", "Where do paper things come from?", None, None], [None, None, None, None, None, "User", "Paper things are Chinese! Chinese people made them!", None, None], ["TL", None, None, None, None, "Justin", "Today, we use paper to make our dragon!", None, None], [None, None, None, None, "Matt已经在研究paper box的折叠结构。", None, None, None, None], [None, None, None, None, None, "Matt", "I need to study this first...", None, None], [None, None, None, None, "Ben搓手。", None, None, None, None], [None, None, None, None, None, "Ben", "Let's go!", None, None], [None, None, None, None, "Sunny挑了一张彩色纸板,端详着。", None, None, None, None], [None, None, None, None, None, "Sunny", "This color is nice. Only this one.", None, None], ] for r_idx, row in enumerate(rows, 2): for c_idx, val in enumerate(row, 1): if val is not None: ws.cell(row=r_idx, column=c_idx, value=val) output_path = "/root/.openclaw/workspace-xiaobian/output/U18_L3_第1段剧本.xlsx" wb.save(output_path) print(f"OK: {output_path}")