import openpyxl from openpyxl.styles import Font wb = openpyxl.Workbook() ws = wb.active ws.title = "第2幕剩余剧本" # 列宽 col_widths = {"A": 12, "B": 8, "C": 10, "D": 10, "E": 45, "F": 15, "G": 45, "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, "【插入图】(复用)黑板图谱,标记1、2、3动作。Leo站在黑板前盯着看。", None, None, None, None], [None, None, None, None, None, "Leo", "Okay! Number one...", None, None], [None, None, None, None, "Leo做1号动作,胳膊拧到背后。", None, None, None, None], [None, None, None, None, None, "Leo", "Number two...", None, None], [None, None, None, None, "Leo做2号动作,踢腿,身体摇晃。", None, None, None, None], [None, None, None, None, None, "Leo", "Number three... Hero change!", None, None], [None, None, None, None, "Leo旋转,失去平衡,一屁股坐在地上。", None, None, None, None], [None, None, None, None, "【音效】摔倒\"砰\"", None, None, None, None], [None, None, None, None, "【emoji】全班 emoji_laugh", None, None, None, None], [None, None, None, None, "【镜头】11号从角落探出头,还冒着微弱黑烟。", None, None, None, None], [None, None, None, None, None, "Eleven", "Bip! Hero change... 37%! Keep going!", None, None], [None, None, None, None, None, "Leo", "Oww...", None, None], [None, None, None, None, None, "Leo", "But I did read it right!", None, None], [None, None, None, None, None, "Ben", "Haha! You look so funny!", None, None], ["中互动", None, None, None, "【教研图】左:黑板图谱(1/2/3动作)。右:Leo摔倒的滑稽样。题目:\"Leo tried to read the blackboard. Did he do it right?\" 选项:Yes / No。正确答案:No", None, None, None, None], [None, None, None, None, None, "User", "No! Leo did not read it right.", None, None], ["TL", None, None, None, None, "Ben", "Your example is so funny!", None, None], [None, None, None, None, None, "Vicky", "That's not a dragon for sure.", None, None], [None, None, None, None, None, "Leo", "But the blackboard shows 1, 2, 3!", None, None], [None, None, None, None, None, "Leo", "I did it as an example!", None, None], [None, None, None, None, None, "Sue", "Hmm... Maybe you are wrong.", None, None], [None, None, None, None, None, "Sue", "Hey, what do you think?", None, None], ["中互动", None, None, None, None, "User", "Leo's example is wrong. That's not a dragon!", None, None], ["TL", None, None, None, "Leo揉着屁股站起来,嘟囔着不服气。", None, None, None, None], [None, None, None, None, None, "Leo", "Fine... But then what is it?", None, None], [None, None, None, None, "大家又看向黑板,还是看不懂。", None, None, None, None], [None, None, None, None, None, "Vicky", "We still can't read the blackboard...", None, None], [None, None, None, None, None, "Vicky", "Maybe we need Grandpa.", None, None], [None, None, None, None, "【音效】门\"砰\"推开", None, None, None, None], [None, None, None, None, "【镜头】Justin爷爷抱着一摞彩色绸缎出现在门口,看到Leo揉屁股。", None, None, None, None], [None, None, None, None, "【emoji】Justin emoji_laugh", None, None, None, None], [None, None, None, None, None, "Justin", "Hahaha! What happened here?", None, None], ["中互动", None, None, None, None, "User", "We tried to read the blackboard. But we can't!", 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_L2_第2幕剩余剧本.xlsx" wb.save(output_path) print(f"OK: {output_path}")