import openpyxl from openpyxl.styles import Font wb = openpyxl.Workbook() ws = wb.active ws.title = "第4幕剧本" col_widths = {"A": 18, "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, "Justin看着歪扭但在动的小龙,满意点头。", None, None, None, None], [None, None, None, None, None, "Justin", "Very good! Take you as an example.", None, None], [None, None, None, None, None, "Justin", "Your move is the best!", None, None], [None, None, None, None, None, "Justin", "You are the dragon head!", None, None], [None, None, None, None, None, "Leo", "Yeah! Dragon head!", None, None], ["中互动", None, None, None, None, "Justin", "Tell everyone. Why are you the head?", None, None], [None, None, None, None, None, "User", "Take me as an example! My move is the best!", None, None], ["核心互动-听力拖拽", None, None, None, "【教研图】教室队列场景。Justin语音逐句说指令,User听后操作:① \"Stand in line!\"(拖角色排队)② \"Read the blackboard!\"(点击黑板对应动作)③ \"Take number 1 as an example!\"(选出龙头动作)。全部完成后,小龙动画动起来。", None, None, None, None], ["TL", None, None, None, "小龙成功动起来!大家欢呼。", None, None, None, None], [None, None, None, None, None, "Justin", "Well done!", None, None], [None, None, None, None, None, "Justin", "Next time, we make a real dragon!", None, None], [None, None, None, None, None, "Justin", "And give it a cool Chinese name!", None, None], [None, None, None, None, None, "Leo", "I have a name! Earthman Dragon!", None, None], [None, None, None, None, "【emoji】全班 emoji_laugh", None, None, None, None], [None, None, None, None, None, "Vicky", "That's not Chinese, Leo...", None, None], ["中互动", None, None, None, None, "Justin", "What did we learn today?", None, None], [None, None, None, None, None, "User", "We stand in line and dance like a dragon! Take us as an example!", 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_第4幕剧本.xlsx" wb.save(output_path) print(f"OK: {output_path}")