import openpyxl from openpyxl.styles import Font wb = openpyxl.Workbook() ws = wb.active ws.title = "L3第4段剧本" 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, "大家把龙骨、龙身、龙头合在一起。一条完整的paper dragon拼好了!但全是白色的。", None, None, None, None], [None, None, None, None, None, "Ben", "It's done! But...", None, None], [None, None, None, None, None, "Matt", "It's all white. It doesn't look strong.", None, None], [None, None, None, None, None, "Sunny", "It needs color!", None, None], [None, None, None, None, "这时Rock老师经过教室门口。气场强烈。", None, None, None, None], [None, None, None, None, None, "Justin", "Rock! Come here! We need your help!", None, None], [None, None, None, None, "Rock老师走进来,看了一眼纸龙。", None, None, None, None], [None, None, None, None, None, "Rock", "Hmm. It needs color.", None, None], [None, None, None, None, None, "Rock", "Chinese dragons are red.", None, None], [None, None, None, None, None, "Rock", "What color is a Chinese dragon?", None, None], ["中互动", None, None, None, None, "User", "Chinese dragons are red! Red is a Chinese color!", None, None], ["TL", None, None, None, "Rock拿出红色颜料,开始给纸龙涂色。", None, None, None, None], [None, None, None, None, "纸龙变成了红色——威武极了!大家欢呼。", None, None, None, None], [None, None, None, None, None, "Ben", "Wow!", None, None], [None, None, None, None, None, "Matt", "Now that's a real dragon.", None, None], [None, None, None, None, "Sunny看呆了。", None, None, None, None], [None, None, None, None, None, "Sunny", "How is it? Do you like it?", None, None], ["中互动", None, None, None, None, "User", "It is too beautiful!", None, None], [None, None, None, None, None, "Justin", "Next class, we dance with our dragon!", None, None], [None, None, None, None, "【emoji】全班 emoji_cheer", None, None, 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_第4段剧本.xlsx" wb.save(output_path) print(f"OK: {output_path}")