simple-skills 1.3.7 → 1.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/README.md +3 -5
  2. package/package.json +1 -1
  3. package/skills/engineering/README.md +1 -2
  4. package/skills/engineering/officedocs/SKILL.md +306 -0
  5. package/skills/engineering/requirement-workflow/SKILL.md +1 -1
  6. package/skills/engineering/docx/SKILL.md +0 -617
  7. package/skills/engineering/docx/scripts/office/__pycache__/soffice.cpython-314.pyc +0 -0
  8. package/skills/engineering/docx/scripts/office/helpers/__pycache__/__init__.cpython-314.pyc +0 -0
  9. package/skills/engineering/docx/scripts/office/helpers/__pycache__/merge_runs.cpython-314.pyc +0 -0
  10. package/skills/engineering/docx/scripts/office/helpers/__pycache__/simplify_redlines.cpython-314.pyc +0 -0
  11. package/skills/engineering/pptx/SKILL.md +0 -221
  12. package/skills/engineering/pptx/scripts/__init__.py +0 -0
  13. package/skills/engineering/pptx/scripts/office/helpers/__init__.py +0 -0
  14. package/skills/engineering/pptx/scripts/office/helpers/merge_runs.py +0 -199
  15. package/skills/engineering/pptx/scripts/office/helpers/simplify_redlines.py +0 -197
  16. package/skills/engineering/pptx/scripts/office/pack.py +0 -159
  17. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +0 -1499
  18. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +0 -146
  19. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +0 -1085
  20. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +0 -11
  21. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +0 -3081
  22. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +0 -23
  23. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +0 -185
  24. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +0 -287
  25. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +0 -1676
  26. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +0 -28
  27. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +0 -144
  28. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +0 -174
  29. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +0 -25
  30. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +0 -18
  31. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +0 -59
  32. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +0 -56
  33. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +0 -195
  34. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +0 -582
  35. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +0 -25
  36. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +0 -4439
  37. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +0 -570
  38. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +0 -509
  39. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +0 -12
  40. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +0 -108
  41. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +0 -96
  42. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +0 -3646
  43. package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +0 -116
  44. package/skills/engineering/pptx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +0 -42
  45. package/skills/engineering/pptx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +0 -50
  46. package/skills/engineering/pptx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +0 -49
  47. package/skills/engineering/pptx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +0 -33
  48. package/skills/engineering/pptx/scripts/office/schemas/mce/mc.xsd +0 -75
  49. package/skills/engineering/pptx/scripts/office/schemas/microsoft/wml-2010.xsd +0 -560
  50. package/skills/engineering/pptx/scripts/office/schemas/microsoft/wml-2012.xsd +0 -67
  51. package/skills/engineering/pptx/scripts/office/schemas/microsoft/wml-2018.xsd +0 -14
  52. package/skills/engineering/pptx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +0 -20
  53. package/skills/engineering/pptx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +0 -13
  54. package/skills/engineering/pptx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +0 -4
  55. package/skills/engineering/pptx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +0 -8
  56. package/skills/engineering/pptx/scripts/office/soffice.py +0 -183
  57. package/skills/engineering/pptx/scripts/office/unpack.py +0 -132
  58. package/skills/engineering/pptx/scripts/office/validate.py +0 -111
  59. package/skills/engineering/pptx/scripts/office/validators/__init__.py +0 -15
  60. package/skills/engineering/pptx/scripts/office/validators/base.py +0 -847
  61. package/skills/engineering/pptx/scripts/office/validators/docx.py +0 -446
  62. package/skills/engineering/pptx/scripts/office/validators/pptx.py +0 -275
  63. package/skills/engineering/pptx/scripts/office/validators/redlining.py +0 -247
  64. package/skills/engineering/xlsx/SKILL.md +0 -320
  65. package/skills/engineering/xlsx/scripts/office/helpers/__init__.py +0 -0
  66. package/skills/engineering/xlsx/scripts/office/helpers/merge_runs.py +0 -199
  67. package/skills/engineering/xlsx/scripts/office/helpers/simplify_redlines.py +0 -197
  68. package/skills/engineering/xlsx/scripts/office/pack.py +0 -159
  69. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +0 -1499
  70. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +0 -146
  71. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +0 -1085
  72. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +0 -11
  73. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +0 -3081
  74. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +0 -23
  75. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +0 -185
  76. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +0 -287
  77. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +0 -1676
  78. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +0 -28
  79. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +0 -144
  80. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +0 -174
  81. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +0 -25
  82. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +0 -18
  83. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +0 -59
  84. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +0 -56
  85. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +0 -195
  86. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +0 -582
  87. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +0 -25
  88. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +0 -4439
  89. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +0 -570
  90. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +0 -509
  91. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +0 -12
  92. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +0 -108
  93. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +0 -96
  94. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +0 -3646
  95. package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +0 -116
  96. package/skills/engineering/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +0 -42
  97. package/skills/engineering/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +0 -50
  98. package/skills/engineering/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +0 -49
  99. package/skills/engineering/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +0 -33
  100. package/skills/engineering/xlsx/scripts/office/schemas/mce/mc.xsd +0 -75
  101. package/skills/engineering/xlsx/scripts/office/schemas/microsoft/wml-2010.xsd +0 -560
  102. package/skills/engineering/xlsx/scripts/office/schemas/microsoft/wml-2012.xsd +0 -67
  103. package/skills/engineering/xlsx/scripts/office/schemas/microsoft/wml-2018.xsd +0 -14
  104. package/skills/engineering/xlsx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +0 -20
  105. package/skills/engineering/xlsx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +0 -13
  106. package/skills/engineering/xlsx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +0 -4
  107. package/skills/engineering/xlsx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +0 -8
  108. package/skills/engineering/xlsx/scripts/office/soffice.py +0 -183
  109. package/skills/engineering/xlsx/scripts/office/unpack.py +0 -132
  110. package/skills/engineering/xlsx/scripts/office/validate.py +0 -111
  111. package/skills/engineering/xlsx/scripts/office/validators/__init__.py +0 -15
  112. package/skills/engineering/xlsx/scripts/office/validators/base.py +0 -847
  113. package/skills/engineering/xlsx/scripts/office/validators/docx.py +0 -446
  114. package/skills/engineering/xlsx/scripts/office/validators/pptx.py +0 -275
  115. package/skills/engineering/xlsx/scripts/office/validators/redlining.py +0 -247
  116. /package/skills/engineering/{pptx → officedocs}/editing.md +0 -0
  117. /package/skills/engineering/{pptx → officedocs}/pptxgenjs.md +0 -0
  118. /package/skills/engineering/{docx → officedocs}/scripts/__init__.py +0 -0
  119. /package/skills/engineering/{docx → officedocs}/scripts/accept_changes.py +0 -0
  120. /package/skills/engineering/{pptx → officedocs}/scripts/add_slide.py +0 -0
  121. /package/skills/engineering/{pptx → officedocs}/scripts/clean.py +0 -0
  122. /package/skills/engineering/{docx → officedocs}/scripts/comment.py +0 -0
  123. /package/skills/engineering/{docx → officedocs}/scripts/office/helpers/__init__.py +0 -0
  124. /package/skills/engineering/{docx → officedocs}/scripts/office/helpers/merge_runs.py +0 -0
  125. /package/skills/engineering/{docx → officedocs}/scripts/office/helpers/simplify_redlines.py +0 -0
  126. /package/skills/engineering/{docx → officedocs}/scripts/office/pack.py +0 -0
  127. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +0 -0
  128. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +0 -0
  129. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +0 -0
  130. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +0 -0
  131. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +0 -0
  132. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +0 -0
  133. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +0 -0
  134. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +0 -0
  135. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +0 -0
  136. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +0 -0
  137. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +0 -0
  138. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +0 -0
  139. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +0 -0
  140. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +0 -0
  141. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +0 -0
  142. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +0 -0
  143. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +0 -0
  144. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +0 -0
  145. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +0 -0
  146. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +0 -0
  147. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +0 -0
  148. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +0 -0
  149. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +0 -0
  150. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +0 -0
  151. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +0 -0
  152. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +0 -0
  153. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +0 -0
  154. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +0 -0
  155. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +0 -0
  156. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +0 -0
  157. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +0 -0
  158. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/mce/mc.xsd +0 -0
  159. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/microsoft/wml-2010.xsd +0 -0
  160. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/microsoft/wml-2012.xsd +0 -0
  161. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/microsoft/wml-2018.xsd +0 -0
  162. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/microsoft/wml-cex-2018.xsd +0 -0
  163. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/microsoft/wml-cid-2016.xsd +0 -0
  164. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +0 -0
  165. /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/microsoft/wml-symex-2015.xsd +0 -0
  166. /package/skills/engineering/{docx → officedocs}/scripts/office/soffice.py +0 -0
  167. /package/skills/engineering/{docx → officedocs}/scripts/office/unpack.py +0 -0
  168. /package/skills/engineering/{docx → officedocs}/scripts/office/validate.py +0 -0
  169. /package/skills/engineering/{docx → officedocs}/scripts/office/validators/__init__.py +0 -0
  170. /package/skills/engineering/{docx → officedocs}/scripts/office/validators/base.py +0 -0
  171. /package/skills/engineering/{docx → officedocs}/scripts/office/validators/docx.py +0 -0
  172. /package/skills/engineering/{docx → officedocs}/scripts/office/validators/pptx.py +0 -0
  173. /package/skills/engineering/{docx → officedocs}/scripts/office/validators/redlining.py +0 -0
  174. /package/skills/engineering/{xlsx → officedocs}/scripts/recalc.py +0 -0
  175. /package/skills/engineering/{docx → officedocs}/scripts/templates/comments.xml +0 -0
  176. /package/skills/engineering/{docx → officedocs}/scripts/templates/commentsExtended.xml +0 -0
  177. /package/skills/engineering/{docx → officedocs}/scripts/templates/commentsExtensible.xml +0 -0
  178. /package/skills/engineering/{docx → officedocs}/scripts/templates/commentsIds.xml +0 -0
  179. /package/skills/engineering/{docx → officedocs}/scripts/templates/people.xml +0 -0
  180. /package/skills/engineering/{pptx → officedocs}/scripts/thumbnail.py +0 -0
@@ -1,320 +0,0 @@
1
- ---
2
- name: xlsx
3
- description: "当电子表格文件是主要输入或输出时使用此技能。适用于用户需要执行以下操作的任何任务:打开、读取、编辑或修复现有.xlsx、.xlsm、.csv或.tsv文件(例如添加列、计算公式、格式化、制作图表、清理杂乱数据);从零开始或从其他数据源创建新电子表格;或在表格类文件格式之间转换。尤其当用户通过名称或路径引用电子表格文件时——即使是随意提及(比如"我下载文件夹里的xlsx")——并且需要对其进行操作或基于其生成内容时触发。也适用于清理或重构杂乱的表格数据文件(格式错误的行、错位的表头、垃圾数据)为规范的电子表格。交付物必须是电子表格文件。当主要交付物是Word文档、HTML报告、独立Python脚本、数据库流水线或Google Sheets API集成时,即使涉及表格数据也不要触发此技能。"
4
- ---
5
-
6
- # 输出要求
7
-
8
- ## 所有Excel文件
9
-
10
- ### 专业字体
11
-
12
- - 所有交付物使用统一的专业字体(例如Arial、Times New Roman),除非用户另有指示
13
-
14
- ### 零公式错误
15
-
16
- - 交付的所有Excel模型必须零公式错误(#REF!、#DIV/0!、#VALUE!、#N/A、#NAME?)
17
-
18
- ### 保留现有模板(更新模板时)
19
-
20
- - 修改文件时研究并严格匹配现有格式、样式和规范
21
- - 不要对已有固定格式的文件强制使用标准化格式
22
- - 现有模板规范始终优先于这些指南
23
-
24
- ## 财务模型
25
-
26
- ### 颜色编码标准
27
-
28
- 除非用户或现有模板另有说明
29
-
30
- #### 行业标准颜色约定
31
-
32
- - **蓝色文本(RGB: 0,0,255)**:硬编码输入值,以及用户会根据场景修改的数字
33
- - **黑色文本(RGB: 0,0,0)**:所有公式和计算结果
34
- - **绿色文本(RGB: 0,128,0)**:引用同一工作簿内其他工作表的链接
35
- - **红色文本(RGB: 255,0,0)**:指向其他文件的外部链接
36
- - **黄色背景(RGB: 255,255,0)**:需要关注的关键假设或需要更新的单元格
37
-
38
- ### 数字格式标准
39
-
40
- #### 强制格式规则
41
-
42
- - **年份**:格式化为文本字符串(例如"2024"而不是"2,024")
43
- - **货币**:使用$#,##0格式;始终在表头中指定单位("收入 ($百万)")
44
- - **零值**:使用数字格式将所有零显示为"-",包括百分比(例如"$#,##0;($#,##0);-")
45
- - **百分比**:默认使用0.0%格式(一位小数)
46
- - **倍数**:估值倍数(EV/EBITDA、P/E)格式化为0.0x
47
- - **负数**:使用括号表示(123)而不是减号-123
48
-
49
- ### 公式构建规则
50
-
51
- #### 假设值放置位置
52
-
53
- - 将所有假设值(增长率、利润率、倍数等)放在独立的假设单元格中
54
- - 公式中使用单元格引用而不是硬编码值
55
- - 示例:使用=B5*(1+$B$6)而不是=B5*1.05
56
-
57
- #### 公式错误预防
58
-
59
- - 验证所有单元格引用正确
60
- - 检查范围是否存在差一错误
61
- - 确保所有预测期的公式一致
62
- - 使用边界情况测试(零值、负数)
63
- - 确认没有意外的循环引用
64
-
65
- #### 硬编码值的文档要求
66
-
67
- - 添加注释或写在旁边的单元格中(如果是表格末尾)。格式:"来源: [系统/文档], [日期], [具体引用], [URL(如果有)]"
68
- - 示例:
69
- - "来源: 公司10-K报告, 2024财年, 第45页, 收入附注, [SEC EDGAR URL]"
70
- - "来源: 公司10-Q报告, 2025年第二季度, 附件99.1, [SEC EDGAR URL]"
71
- - "来源: Bloomberg Terminal, 2025年8月15日, AAPL US Equity"
72
- - "来源: FactSet, 2025年8月20日, 市场一致预期屏幕"
73
-
74
- # XLSX创建、编辑和分析
75
-
76
- ## 概述
77
-
78
- 用户可能要求你创建、编辑或分析.xlsx文件的内容。针对不同任务可以使用不同的工具和工作流。
79
-
80
- ## 重要要求
81
-
82
- **公式重新计算需要LibreOffice**:你可以假设已安装LibreOffice,使用`scripts/recalc.py`脚本重新计算公式值。脚本首次运行时会自动配置LibreOffice,包括Unix套接字受限的沙箱环境(由`scripts/office/soffice.py`处理)
83
-
84
- ## 读取和分析数据
85
-
86
- ### 使用pandas进行数据分析
87
-
88
- 对于数据分析、可视化和基础操作,使用**pandas**,它提供强大的数据处理能力:
89
-
90
- ```python
91
- import pandas as pd
92
-
93
- # 读取Excel
94
- df = pd.read_excel('file.xlsx') # 默认:第一个工作表
95
- all_sheets = pd.read_excel('file.xlsx', sheet_name=None) # 所有工作表以字典形式返回
96
-
97
- # 分析
98
- df.head() # 预览数据
99
- df.info() # 列信息
100
- df.describe() # 统计信息
101
-
102
- # 写入Excel
103
- df.to_excel('output.xlsx', index=False)
104
- ```
105
-
106
- ## Excel文件工作流
107
-
108
- ## 关键要求:使用公式,不要硬编码值
109
-
110
- **始终使用Excel公式,而不是在Python中计算值然后硬编码**。这样可以确保电子表格保持动态可更新。
111
-
112
- ### ❌ 错误 - 硬编码计算结果
113
-
114
- ```python
115
- # 错误:在Python中计算并硬编码结果
116
- total = df['Sales'].sum()
117
- sheet['B10'] = total # 硬编码为5000
118
-
119
- # 错误:在Python中计算增长率
120
- growth = (df.iloc[-1]['Revenue'] - df.iloc[0]['Revenue']) / df.iloc[0]['Revenue']
121
- sheet['C5'] = growth # 硬编码为0.15
122
-
123
- # 错误:在Python中计算平均值
124
- avg = sum(values) / len(values)
125
- sheet['D20'] = avg # 硬编码为42.5
126
- ```
127
-
128
- ### ✅ 正确 - 使用Excel公式
129
-
130
- ```python
131
- # 正确:让Excel计算总和
132
- sheet['B10'] = '=SUM(B2:B9)'
133
-
134
- # 正确:增长率使用Excel公式
135
- sheet['C5'] = '=(C4-C2)/C2'
136
-
137
- # 正确:使用Excel函数计算平均值
138
- sheet['D20'] = '=AVERAGE(D2:D19)'
139
- ```
140
-
141
- 这适用于所有计算——总计、百分比、比率、差值等。电子表格应该能够在源数据变化时重新计算。
142
-
143
- ## 通用工作流
144
-
145
- 1. **选择工具**:数据处理用pandas,公式/格式处理用openpyxl
146
- 2. **创建/加载**:创建新工作簿或加载现有文件
147
- 3. **修改**:添加/编辑数据、公式和格式
148
- 4. **保存**:写入文件
149
- 5. **重新计算公式(使用公式时必须执行)**:使用scripts/recalc.py脚本
150
-
151
- ```bash
152
- python scripts/recalc.py output.xlsx
153
- ```
154
-
155
- 6. **验证并修复所有错误**:
156
- - 脚本返回包含错误详情的JSON
157
- - 如果`status`为`errors_found`,查看`error_summary`获取具体错误类型和位置
158
- - 修复发现的错误后再次重新计算
159
- - 需要修复的常见错误:
160
- - `#REF!`:无效的单元格引用
161
- - `#DIV/0!`:除零错误
162
- - `#VALUE!`:公式中数据类型错误
163
- - `#NAME?`:无法识别的公式名称
164
-
165
- ### 创建新Excel文件
166
-
167
- ```python
168
- # 使用openpyxl处理公式和格式
169
- from openpyxl import Workbook
170
- from openpyxl.styles import Font, PatternFill, Alignment
171
-
172
- wb = Workbook()
173
- sheet = wb.active
174
-
175
- # 添加数据
176
- sheet['A1'] = 'Hello'
177
- sheet['B1'] = 'World'
178
- sheet.append(['Row', 'of', 'data'])
179
-
180
- # 添加公式
181
- sheet['B2'] = '=SUM(A1:A10)'
182
-
183
- # 格式化
184
- sheet['A1'].font = Font(bold=True, color='FF0000')
185
- sheet['A1'].fill = PatternFill('solid', start_color='FFFF00')
186
- sheet['A1'].alignment = Alignment(horizontal='center')
187
-
188
- # 列宽
189
- sheet.column_dimensions['A'].width = 20
190
-
191
- wb.save('output.xlsx')
192
- ```
193
-
194
- ### 编辑现有Excel文件
195
-
196
- ```python
197
- # 使用openpyxl保留公式和格式
198
- from openpyxl import load_workbook
199
-
200
- # 加载现有文件
201
- wb = load_workbook('existing.xlsx')
202
- sheet = wb.active # 或用wb['SheetName']指定工作表
203
-
204
- # 处理多个工作表
205
- for sheet_name in wb.sheetnames:
206
- sheet = wb[sheet_name]
207
- print(f"工作表: {sheet_name}")
208
-
209
- # 修改单元格
210
- sheet['A1'] = 'New Value'
211
- sheet.insert_rows(2) # 在第2行位置插入行
212
- sheet.delete_cols(3) # 删除第3列
213
-
214
- # 添加新工作表
215
- new_sheet = wb.create_sheet('NewSheet')
216
- new_sheet['A1'] = 'Data'
217
-
218
- wb.save('modified.xlsx')
219
- ```
220
-
221
- ## 重新计算公式
222
-
223
- openpyxl创建或修改的Excel文件包含字符串形式的公式,但没有计算值。使用提供的`scripts/recalc.py`脚本重新计算公式:
224
-
225
- ```bash
226
- python scripts/recalc.py <excel_file> [timeout_seconds]
227
- ```
228
-
229
- 示例:
230
-
231
- ```bash
232
- python scripts/recalc.py output.xlsx 30
233
- ```
234
-
235
- 脚本功能:
236
-
237
- - 首次运行时自动设置LibreOffice宏
238
- - 重新计算所有工作表中的所有公式
239
- - 扫描所有单元格查找Excel错误(#REF!、#DIV/0!等)
240
- - 返回包含详细错误位置和计数的JSON
241
- - 同时支持Linux和macOS
242
-
243
- ## 公式验证检查清单
244
-
245
- 快速检查确保公式正常工作:
246
-
247
- ### 基本验证
248
-
249
- - [ ] **测试2-3个示例引用**:在构建完整模型前验证它们获取的值正确
250
- - [ ] **列映射**:确认Excel列匹配(例如第64列是BL,不是BK)
251
- - [ ] **行偏移**:记住Excel行是1索引的(DataFrame第5行 = Excel第6行)
252
-
253
- ### 常见陷阱
254
-
255
- - [ ] **NaN处理**:使用`pd.notna()`检查空值
256
- - [ ] **最右侧列**:财年数据通常在第50列之后
257
- - [ ] **多个匹配项**:搜索所有出现的位置,不只是第一个
258
- - [ ] **除零错误**:在公式中使用`/`前检查分母(#DIV/0!)
259
- - [ ] **引用错误**:验证所有单元格引用指向目标单元格(#REF!)
260
- - [ ] **跨工作表引用**:链接工作表时使用正确格式(Sheet1!A1)
261
-
262
- ### 公式测试策略
263
-
264
- - [ ] **从小范围开始**:先在2-3个单元格上测试公式,再广泛应用
265
- - [ ] **验证依赖项**:检查公式中引用的所有单元格都存在
266
- - [ ] **测试边界情况**:包括零、负数和非常大的值
267
-
268
- ### 解读scripts/recalc.py输出
269
-
270
- 脚本返回包含错误详情的JSON:
271
-
272
- ```json
273
- {
274
- "status": "success", // 或"errors_found"
275
- "total_errors": 0, // 总错误数
276
- "total_formulas": 42, // 文件中的公式数量
277
- "error_summary": { // 仅当发现错误时存在
278
- "#REF!": {
279
- "count": 2,
280
- "locations": ["Sheet1!B5", "Sheet1!C10"]
281
- }
282
- }
283
- }
284
- ```
285
-
286
- ## 最佳实践
287
-
288
- ### 库选择
289
-
290
- - **pandas**:最适合数据分析、批量操作和简单数据导出
291
- - **openpyxl**:最适合复杂格式、公式和Excel特有功能
292
-
293
- ### 使用openpyxl
294
-
295
- - 单元格索引是1索引的(row=1, column=1对应单元格A1)
296
- - 使用`data_only=True`读取计算后的值:`load_workbook('file.xlsx', data_only=True)`
297
- - **警告**:如果以`data_only=True`打开并保存,公式会被替换为值并永久丢失
298
- - 大文件处理:读取时使用`read_only=True`,写入时使用`write_only=True`
299
- - 公式会被保留但不会计算——使用scripts/recalc.py更新值
300
-
301
- ### 使用pandas
302
-
303
- - 指定数据类型避免推断错误:`pd.read_excel('file.xlsx', dtype={'id': str})`
304
- - 大文件读取指定列:`pd.read_excel('file.xlsx', usecols=['A', 'C', 'E'])`
305
- - 正确处理日期:`pd.read_excel('file.xlsx', parse_dates=['date_column'])`
306
-
307
- ## 代码风格指南
308
-
309
- **重要**:生成Excel操作的Python代码时:
310
-
311
- - 编写简洁的Python代码,不要不必要的注释
312
- - 避免冗长的变量名和冗余操作
313
- - 避免不必要的print语句
314
-
315
- **对于Excel文件本身**:
316
-
317
- - 给包含复杂公式或重要假设的单元格添加注释
318
- - 记录硬编码值的数据来源
319
- - 为关键计算和模型部分添加说明
320
-
@@ -1,199 +0,0 @@
1
- """Merge adjacent runs with identical formatting in DOCX.
2
-
3
- Merges adjacent <w:r> elements that have identical <w:rPr> properties.
4
- Works on runs in paragraphs and inside tracked changes (<w:ins>, <w:del>).
5
-
6
- Also:
7
- - Removes rsid attributes from runs (revision metadata that doesn't affect rendering)
8
- - Removes proofErr elements (spell/grammar markers that block merging)
9
- """
10
-
11
- from pathlib import Path
12
-
13
- import defusedxml.minidom
14
-
15
-
16
- def merge_runs(input_dir: str) -> tuple[int, str]:
17
- doc_xml = Path(input_dir) / "word" / "document.xml"
18
-
19
- if not doc_xml.exists():
20
- return 0, f"Error: {doc_xml} not found"
21
-
22
- try:
23
- dom = defusedxml.minidom.parseString(doc_xml.read_text(encoding="utf-8"))
24
- root = dom.documentElement
25
-
26
- _remove_elements(root, "proofErr")
27
- _strip_run_rsid_attrs(root)
28
-
29
- containers = {run.parentNode for run in _find_elements(root, "r")}
30
-
31
- merge_count = 0
32
- for container in containers:
33
- merge_count += _merge_runs_in(container)
34
-
35
- doc_xml.write_bytes(dom.toxml(encoding="UTF-8"))
36
- return merge_count, f"Merged {merge_count} runs"
37
-
38
- except Exception as e:
39
- return 0, f"Error: {e}"
40
-
41
-
42
-
43
-
44
- def _find_elements(root, tag: str) -> list:
45
- results = []
46
-
47
- def traverse(node):
48
- if node.nodeType == node.ELEMENT_NODE:
49
- name = node.localName or node.tagName
50
- if name == tag or name.endswith(f":{tag}"):
51
- results.append(node)
52
- for child in node.childNodes:
53
- traverse(child)
54
-
55
- traverse(root)
56
- return results
57
-
58
-
59
- def _get_child(parent, tag: str):
60
- for child in parent.childNodes:
61
- if child.nodeType == child.ELEMENT_NODE:
62
- name = child.localName or child.tagName
63
- if name == tag or name.endswith(f":{tag}"):
64
- return child
65
- return None
66
-
67
-
68
- def _get_children(parent, tag: str) -> list:
69
- results = []
70
- for child in parent.childNodes:
71
- if child.nodeType == child.ELEMENT_NODE:
72
- name = child.localName or child.tagName
73
- if name == tag or name.endswith(f":{tag}"):
74
- results.append(child)
75
- return results
76
-
77
-
78
- def _is_adjacent(elem1, elem2) -> bool:
79
- node = elem1.nextSibling
80
- while node:
81
- if node == elem2:
82
- return True
83
- if node.nodeType == node.ELEMENT_NODE:
84
- return False
85
- if node.nodeType == node.TEXT_NODE and node.data.strip():
86
- return False
87
- node = node.nextSibling
88
- return False
89
-
90
-
91
-
92
-
93
- def _remove_elements(root, tag: str):
94
- for elem in _find_elements(root, tag):
95
- if elem.parentNode:
96
- elem.parentNode.removeChild(elem)
97
-
98
-
99
- def _strip_run_rsid_attrs(root):
100
- for run in _find_elements(root, "r"):
101
- for attr in list(run.attributes.values()):
102
- if "rsid" in attr.name.lower():
103
- run.removeAttribute(attr.name)
104
-
105
-
106
-
107
-
108
- def _merge_runs_in(container) -> int:
109
- merge_count = 0
110
- run = _first_child_run(container)
111
-
112
- while run:
113
- while True:
114
- next_elem = _next_element_sibling(run)
115
- if next_elem and _is_run(next_elem) and _can_merge(run, next_elem):
116
- _merge_run_content(run, next_elem)
117
- container.removeChild(next_elem)
118
- merge_count += 1
119
- else:
120
- break
121
-
122
- _consolidate_text(run)
123
- run = _next_sibling_run(run)
124
-
125
- return merge_count
126
-
127
-
128
- def _first_child_run(container):
129
- for child in container.childNodes:
130
- if child.nodeType == child.ELEMENT_NODE and _is_run(child):
131
- return child
132
- return None
133
-
134
-
135
- def _next_element_sibling(node):
136
- sibling = node.nextSibling
137
- while sibling:
138
- if sibling.nodeType == sibling.ELEMENT_NODE:
139
- return sibling
140
- sibling = sibling.nextSibling
141
- return None
142
-
143
-
144
- def _next_sibling_run(node):
145
- sibling = node.nextSibling
146
- while sibling:
147
- if sibling.nodeType == sibling.ELEMENT_NODE:
148
- if _is_run(sibling):
149
- return sibling
150
- sibling = sibling.nextSibling
151
- return None
152
-
153
-
154
- def _is_run(node) -> bool:
155
- name = node.localName or node.tagName
156
- return name == "r" or name.endswith(":r")
157
-
158
-
159
- def _can_merge(run1, run2) -> bool:
160
- rpr1 = _get_child(run1, "rPr")
161
- rpr2 = _get_child(run2, "rPr")
162
-
163
- if (rpr1 is None) != (rpr2 is None):
164
- return False
165
- if rpr1 is None:
166
- return True
167
- return rpr1.toxml() == rpr2.toxml()
168
-
169
-
170
- def _merge_run_content(target, source):
171
- for child in list(source.childNodes):
172
- if child.nodeType == child.ELEMENT_NODE:
173
- name = child.localName or child.tagName
174
- if name != "rPr" and not name.endswith(":rPr"):
175
- target.appendChild(child)
176
-
177
-
178
- def _consolidate_text(run):
179
- t_elements = _get_children(run, "t")
180
-
181
- for i in range(len(t_elements) - 1, 0, -1):
182
- curr, prev = t_elements[i], t_elements[i - 1]
183
-
184
- if _is_adjacent(prev, curr):
185
- prev_text = prev.firstChild.data if prev.firstChild else ""
186
- curr_text = curr.firstChild.data if curr.firstChild else ""
187
- merged = prev_text + curr_text
188
-
189
- if prev.firstChild:
190
- prev.firstChild.data = merged
191
- else:
192
- prev.appendChild(run.ownerDocument.createTextNode(merged))
193
-
194
- if merged.startswith(" ") or merged.endswith(" "):
195
- prev.setAttribute("xml:space", "preserve")
196
- elif prev.hasAttribute("xml:space"):
197
- prev.removeAttribute("xml:space")
198
-
199
- run.removeChild(curr)