电速宝智配引擎
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. const {
  2. Document, Packer, Paragraph, TextRun, HeadingLevel,
  3. AlignmentType, Table, TableRow, TableCell, WidthType,
  4. BorderStyle, ImageRun, PageBreak, ShadingType, convertInchesToTwip
  5. } = require('docx');
  6. const fs = require('fs');
  7. // Read the embedded image from the docx media folder
  8. const imageBuffer = fs.readFileSync('content/word/media/image1.png');
  9. // Helper: create a horizontal line paragraph
  10. function hline() {
  11. return new Paragraph({
  12. border: {
  13. bottom: { color: 'CCCCCC', space: 1, style: BorderStyle.SINGLE, size: 6 }
  14. },
  15. spacing: { after: 100 },
  16. children: []
  17. });
  18. }
  19. // Helper: info box paragraph (bordered)
  20. function infoPara(text, color = '4F81BD') {
  21. return new Paragraph({
  22. children: [
  23. new TextRun({ text: ' ' + text, font: '微软雅黑', size: 22, color: '333333' })
  24. ],
  25. shading: { type: ShadingType.CLEAR, color: 'auto', fill: 'F0F7FF' },
  26. border: {
  27. top: { color, style: BorderStyle.SINGLE, size: 4 },
  28. bottom: { color, style: BorderStyle.SINGLE, size: 4 },
  29. left: { color, style: BorderStyle.SINGLE, size: 12 },
  30. right: { color, style: BorderStyle.SINGLE, size: 4 }
  31. },
  32. spacing: { before: 80, after: 80, left: 100 },
  33. indent: { left: 100 }
  34. });
  35. }
  36. // Helper: section title
  37. function sectionTitle(text) {
  38. return new Paragraph({
  39. children: [
  40. new TextRun({
  41. text: ' ' + text,
  42. bold: true,
  43. font: '微软雅黑',
  44. size: 26,
  45. color: 'FFFFFF'
  46. })
  47. ],
  48. shading: { type: ShadingType.CLEAR, color: 'auto', fill: '2E74B5' },
  49. spacing: { before: 120, after: 80 },
  50. indent: { left: 0 }
  51. });
  52. }
  53. // Helper: normal body text
  54. function bodyPara(text, bold = false, color = '333333', size = 22) {
  55. return new Paragraph({
  56. children: [new TextRun({ text, bold, font: '微软雅黑', size, color })],
  57. spacing: { before: 60, after: 60 },
  58. indent: { firstLine: 480 }
  59. });
  60. }
  61. // Helper: bullet item
  62. function bullet(text, level = 0) {
  63. const indent = level * 360;
  64. return new Paragraph({
  65. children: [
  66. new TextRun({ text: '• ', font: '微软雅黑', size: 22, color: '2E74B5' }),
  67. new TextRun({ text, font: '微软雅黑', size: 22, color: '333333' })
  68. ],
  69. spacing: { before: 40, after: 40 },
  70. indent: { left: 480 + indent }
  71. });
  72. }
  73. // Helper: key-value row in a table
  74. function kvRow(label, value, labelColor = '2E74B5') {
  75. return new TableRow({
  76. children: [
  77. new TableCell({
  78. children: [new Paragraph({
  79. children: [new TextRun({ text: label, bold: true, font: '微软雅黑', size: 20, color: labelColor })]
  80. })],
  81. width: { size: 25, type: WidthType.PERCENTAGE },
  82. shading: { type: ShadingType.CLEAR, color: 'auto', fill: 'E8F0FB' },
  83. margins: { top: 80, bottom: 80, left: 120, right: 80 }
  84. }),
  85. new TableCell({
  86. children: [new Paragraph({
  87. children: [new TextRun({ text: value, font: '微软雅黑', size: 20, color: '333333' })]
  88. })],
  89. width: { size: 75, type: WidthType.PERCENTAGE },
  90. margins: { top: 80, bottom: 80, left: 120, right: 80 }
  91. })
  92. ]
  93. });
  94. }
  95. const doc = new Document({
  96. styles: {
  97. default: {
  98. document: {
  99. run: { font: '微软雅黑', size: 22 }
  100. }
  101. }
  102. },
  103. sections: [{
  104. properties: {
  105. page: {
  106. margin: { top: 1440, right: 1800, bottom: 1440, left: 1800 }
  107. }
  108. },
  109. children: [
  110. // ===== 大标题 =====
  111. new Paragraph({
  112. children: [
  113. new TextRun({
  114. text: '报错闭环处理报告',
  115. bold: true,
  116. font: '微软雅黑',
  117. size: 52,
  118. color: '1F497D'
  119. })
  120. ],
  121. alignment: AlignmentType.CENTER,
  122. spacing: { after: 200 }
  123. }),
  124. // ===== 元信息表格 =====
  125. new Table({
  126. width: { size: 100, type: WidthType.PERCENTAGE },
  127. borders: {
  128. top: { style: BorderStyle.SINGLE, size: 4, color: '2E74B5' },
  129. bottom: { style: BorderStyle.SINGLE, size: 4, color: '2E74B5' },
  130. left: { style: BorderStyle.SINGLE, size: 4, color: '2E74B5' },
  131. right: { style: BorderStyle.SINGLE, size: 4, color: '2E74B5' },
  132. insideH: { style: BorderStyle.SINGLE, size: 2, color: 'BDD7EE' },
  133. insideV: { style: BorderStyle.SINGLE, size: 2, color: 'BDD7EE' }
  134. },
  135. rows: [
  136. kvRow('报告编号', 'REP-20260418-001'),
  137. kvRow('处理日期', '2026年4月18日'),
  138. kvRow('报告类型', '数据异常报错闭环处理'),
  139. kvRow('处理状态', '已完成'),
  140. kvRow('报告人', '(请填写)')
  141. ]
  142. }),
  143. new Paragraph({ children: [], spacing: { after: 200 } }),
  144. // ===== 一、报错分析 =====
  145. sectionTitle('一、报错分析'),
  146. bodyPara('2026年4月18日,系统出现数据异常波动,经排查定位,确认问题原因如下:'),
  147. bullet('设备端上传的异常参数参与了后台整体运算流程'),
  148. bullet('该参数导致当日统计结果产生剧烈偏差'),
  149. new Paragraph({ children: [], spacing: { after: 100 } }),
  150. // 图片说明
  151. new Paragraph({
  152. children: [
  153. new TextRun({ text: '【错误截图】', bold: true, font: '微软雅黑', size: 22, color: '2E74B5' })
  154. ],
  155. spacing: { before: 80, after: 80 }
  156. }),
  157. // 嵌入截图
  158. new Paragraph({
  159. children: [
  160. new ImageRun({
  161. data: imageBuffer,
  162. transformation: { width: 560, height: 180 }
  163. })
  164. ],
  165. alignment: AlignmentType.CENTER,
  166. spacing: { after: 200 }
  167. }),
  168. // 原因描述
  169. new Paragraph({
  170. children: [
  171. new TextRun({ text: '问题描述:', bold: true, font: '微软雅黑', size: 22, color: 'C00000' }),
  172. new TextRun({
  173. text: '由于设备数据上传到后台后,后台将该参数参与了整体运算过程,导致该天数据产生巨大差异。',
  174. font: '微软雅黑',
  175. size: 22,
  176. color: '333333'
  177. })
  178. ],
  179. spacing: { before: 80, after: 80 },
  180. indent: { firstLine: 480 }
  181. }),
  182. hline(),
  183. // ===== 二、后台维度处理 =====
  184. sectionTitle('二、后台维度处理措施'),
  185. bodyPara('针对本次数据异常,已从以下维度制定并落实处理方案:'),
  186. new Paragraph({
  187. children: [new TextRun({ text: '2.1 数据校验增强', bold: true, font: '微软雅黑', size: 24, color: '1F497D' })],
  188. spacing: { before: 120, after: 60 }
  189. }),
  190. bullet('对特定字段数据增加范围校验与合法性校验'),
  191. bullet('对边界值与极值进行实时告警拦截'),
  192. bullet('引入异常数据默认值兜底机制,防止脏数据扩散'),
  193. new Paragraph({
  194. children: [new TextRun({ text: '2.2 后台运算管控', bold: true, font: '微软雅黑', size: 24, color: '1F497D' })],
  195. spacing: { before: 120, after: 60 }
  196. }),
  197. bullet('消除异常操作对数据统计的影响'),
  198. bullet('对参与整体运算的字段增加白名单过滤'),
  199. bullet('建立敏感参数修改的操作审计日志'),
  200. new Paragraph({
  201. children: [new TextRun({ text: '2.3 预警与闭环机制', bold: true, font: '微软雅黑', size: 24, color: '1F497D' })],
  202. spacing: { before: 120, after: 60 }
  203. }),
  204. bullet('设置数据波动阈值告警,超过阈值自动通知'),
  205. bullet('完善异常数据处理流程,形成闭环跟踪机制'),
  206. bullet('定期回溯验证,确保类似事件不再复发'),
  207. new Paragraph({ children: [], spacing: { after: 200 } }),
  208. hline(),
  209. // ===== 三、处理结论 =====
  210. sectionTitle('三、处理结论'),
  211. infoPara('处理结论:对特定字段数据进行管控处理,消除对数据异常进行的异常操作处理,增强校验机制,达到数据处理准确结果,避免类似事件再次发生。'),
  212. new Paragraph({ children: [], spacing: { after: 200 } }),
  213. hline(),
  214. // ===== 四、处理进度 =====
  215. sectionTitle('四、处理进度'),
  216. new Table({
  217. width: { size: 100, type: WidthType.PERCENTAGE },
  218. borders: {
  219. top: { style: BorderStyle.SINGLE, size: 4, color: '2E74B5' },
  220. bottom: { style: BorderStyle.SINGLE, size: 4, color: '2E74B5' },
  221. left: { style: BorderStyle.SINGLE, size: 4, color: '2E74B5' },
  222. right: { style: BorderStyle.SINGLE, size: 4, color: '2E74B5' },
  223. insideH: { style: BorderStyle.SINGLE, size: 2, color: 'BDD7EE' },
  224. insideV: { style: BorderStyle.SINGLE, size: 2, color: 'BDD7EE' }
  225. },
  226. rows: [
  227. new TableRow({
  228. children: [
  229. new TableCell({
  230. children: [new Paragraph({ children: [new TextRun({ text: '序号', bold: true, font: '微软雅黑', size: 20, color: 'FFFFFF' })] })],
  231. width: { size: 10, type: WidthType.PERCENTAGE },
  232. shading: { type: ShadingType.CLEAR, color: 'auto', fill: '2E74B5' },
  233. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  234. }),
  235. new TableCell({
  236. children: [new Paragraph({ children: [new TextRun({ text: '处理阶段', bold: true, font: '微软雅黑', size: 20, color: 'FFFFFF' })] })],
  237. width: { size: 30, type: WidthType.PERCENTAGE },
  238. shading: { type: ShadingType.CLEAR, color: 'auto', fill: '2E74B5' },
  239. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  240. }),
  241. new TableCell({
  242. children: [new Paragraph({ children: [new TextRun({ text: '处理措施', bold: true, font: '微软雅黑', size: 20, color: 'FFFFFF' })] })],
  243. width: { size: 35, type: WidthType.PERCENTAGE },
  244. shading: { type: ShadingType.CLEAR, color: 'auto', fill: '2E74B5' },
  245. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  246. }),
  247. new TableCell({
  248. children: [new Paragraph({ children: [new TextRun({ text: '完成时间', bold: true, font: '微软雅黑', size: 20, color: 'FFFFFF' })] })],
  249. width: { size: 15, type: WidthType.PERCENTAGE },
  250. shading: { type: ShadingType.CLEAR, color: 'auto', fill: '2E74B5' },
  251. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  252. }),
  253. new TableCell({
  254. children: [new Paragraph({ children: [new TextRun({ text: '状态', bold: true, font: '微软雅黑', size: 20, color: 'FFFFFF' })] })],
  255. width: { size: 10, type: WidthType.PERCENTAGE },
  256. shading: { type: ShadingType.CLEAR, color: 'auto', fill: '2E74B5' },
  257. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  258. })
  259. ]
  260. }),
  261. new TableRow({
  262. children: [
  263. new TableCell({
  264. children: [new Paragraph({ children: [new TextRun({ text: '1', font: '微软雅黑', size: 20 })] })],
  265. width: { size: 10, type: WidthType.PERCENTAGE },
  266. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  267. }),
  268. new TableCell({
  269. children: [new Paragraph({ children: [new TextRun({ text: '问题定位', font: '微软雅黑', size: 20 })] })],
  270. width: { size: 30, type: WidthType.PERCENTAGE },
  271. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  272. }),
  273. new TableCell({
  274. children: [new Paragraph({ children: [new TextRun({ text: '确认设备异常参数上传原因', font: '微软雅黑', size: 20 })] })],
  275. width: { size: 35, type: WidthType.PERCENTAGE },
  276. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  277. }),
  278. new TableCell({
  279. children: [new Paragraph({ children: [new TextRun({ text: '2026-04-18', font: '微软雅黑', size: 20 })] })],
  280. width: { size: 15, type: WidthType.PERCENTAGE },
  281. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  282. }),
  283. new TableCell({
  284. children: [new Paragraph({ children: [new TextRun({ text: '已完成', font: '微软雅黑', size: 20, color: '00B050' })] })],
  285. width: { size: 10, type: WidthType.PERCENTAGE },
  286. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  287. })
  288. ]
  289. }),
  290. new TableRow({
  291. children: [
  292. new TableCell({
  293. children: [new Paragraph({ children: [new TextRun({ text: '2', font: '微软雅黑', size: 20 })] })],
  294. width: { size: 10, type: WidthType.PERCENTAGE },
  295. shading: { type: ShadingType.CLEAR, color: 'auto', fill: 'F0F7FF' },
  296. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  297. }),
  298. new TableCell({
  299. children: [new Paragraph({ children: [new TextRun({ text: '数据修复', font: '微软雅黑', size: 20 })] })],
  300. width: { size: 30, type: WidthType.PERCENTAGE },
  301. shading: { type: ShadingType.CLEAR, color: 'auto', fill: 'F0F7FF' },
  302. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  303. }),
  304. new TableCell({
  305. children: [new Paragraph({ children: [new TextRun({ text: '清洗当日异常数据,恢复正确统计结果', font: '微软雅黑', size: 20 })] })],
  306. width: { size: 35, type: WidthType.PERCENTAGE },
  307. shading: { type: ShadingType.CLEAR, color: 'auto', fill: 'F0F7FF' },
  308. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  309. }),
  310. new TableCell({
  311. children: [new Paragraph({ children: [new TextRun({ text: '2026-04-18', font: '微软雅黑', size: 20 })] })],
  312. width: { size: 15, type: WidthType.PERCENTAGE },
  313. shading: { type: ShadingType.CLEAR, color: 'auto', fill: 'F0F7FF' },
  314. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  315. }),
  316. new TableCell({
  317. children: [new Paragraph({ children: [new TextRun({ text: '已完成', font: '微软雅黑', size: 20, color: '00B050' })] })],
  318. width: { size: 10, type: WidthType.PERCENTAGE },
  319. shading: { type: ShadingType.CLEAR, color: 'auto', fill: 'F0F7FF' },
  320. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  321. })
  322. ]
  323. }),
  324. new TableRow({
  325. children: [
  326. new TableCell({
  327. children: [new Paragraph({ children: [new TextRun({ text: '3', font: '微软雅黑', size: 20 })] })],
  328. width: { size: 10, type: WidthType.PERCENTAGE },
  329. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  330. }),
  331. new TableCell({
  332. children: [new Paragraph({ children: [new TextRun({ text: '校验增强', font: '微软雅黑', size: 20 })] })],
  333. width: { size: 30, type: WidthType.PERCENTAGE },
  334. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  335. }),
  336. new TableCell({
  337. children: [new Paragraph({ children: [new TextRun({ text: '增加参数合法性校验与极值告警机制', font: '微软雅黑', size: 20 })] })],
  338. width: { size: 35, type: WidthType.PERCENTAGE },
  339. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  340. }),
  341. new TableCell({
  342. children: [new Paragraph({ children: [new TextRun({ text: '2026-04-18', font: '微软雅黑', size: 20 })] })],
  343. width: { size: 15, type: WidthType.PERCENTAGE },
  344. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  345. }),
  346. new TableCell({
  347. children: [new Paragraph({ children: [new TextRun({ text: '已完成', font: '微软雅黑', size: 20, color: '00B050' })] })],
  348. width: { size: 10, type: WidthType.PERCENTAGE },
  349. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  350. })
  351. ]
  352. }),
  353. new TableRow({
  354. children: [
  355. new TableCell({
  356. children: [new Paragraph({ children: [new TextRun({ text: '4', font: '微软雅黑', size: 20 })] })],
  357. width: { size: 10, type: WidthType.PERCENTAGE },
  358. shading: { type: ShadingType.CLEAR, color: 'auto', fill: 'F0F7FF' },
  359. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  360. }),
  361. new TableCell({
  362. children: [new Paragraph({ children: [new TextRun({ text: '持续监控', font: '微软雅黑', size: 20 })] })],
  363. width: { size: 30, type: WidthType.PERCENTAGE },
  364. shading: { type: ShadingType.CLEAR, color: 'auto', fill: 'F0F7FF' },
  365. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  366. }),
  367. new TableCell({
  368. children: [new Paragraph({ children: [new TextRun({ text: '建立数据波动告警与周期性回溯机制', font: '微软雅黑', size: 20 })] })],
  369. width: { size: 35, type: WidthType.PERCENTAGE },
  370. shading: { type: ShadingType.CLEAR, color: 'auto', fill: 'F0F7FF' },
  371. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  372. }),
  373. new TableCell({
  374. children: [new Paragraph({ children: [new TextRun({ text: '2026-04-18', font: '微软雅黑', size: 20 })] })],
  375. width: { size: 15, type: WidthType.PERCENTAGE },
  376. shading: { type: ShadingType.CLEAR, color: 'auto', fill: 'F0F7FF' },
  377. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  378. }),
  379. new TableCell({
  380. children: [new Paragraph({ children: [new TextRun({ text: '已完成', font: '微软雅黑', size: 20, color: '00B050' })] })],
  381. width: { size: 10, type: WidthType.PERCENTAGE },
  382. shading: { type: ShadingType.CLEAR, color: 'auto', fill: 'F0F7FF' },
  383. margins: { top: 80, bottom: 80, left: 80, right: 80 }
  384. })
  385. ]
  386. })
  387. ]
  388. }),
  389. new Paragraph({ children: [], spacing: { after: 300 } }),
  390. hline(),
  391. // ===== 五、签字确认 =====
  392. sectionTitle('五、签字确认'),
  393. new Paragraph({
  394. children: [new TextRun({ text: '本报告由相关责任人确认签字后归档,确保问题处理闭环可追溯。', font: '微软雅黑', size: 22, color: '666666' })],
  395. spacing: { before: 80, after: 160 }
  396. }),
  397. new Table({
  398. width: { size: 100, type: WidthType.PERCENTAGE },
  399. borders: {
  400. top: { style: BorderStyle.SINGLE, size: 4, color: '2E74B5' },
  401. bottom: { style: BorderStyle.SINGLE, size: 4, color: '2E74B5' },
  402. left: { style: BorderStyle.SINGLE, size: 4, color: '2E74B5' },
  403. right: { style: BorderStyle.SINGLE, size: 4, color: '2E74B5' },
  404. insideH: { style: BorderStyle.SINGLE, size: 2, color: 'BDD7EE' },
  405. insideV: { style: BorderStyle.SINGLE, size: 2, color: 'BDD7EE' }
  406. },
  407. rows: [
  408. new TableRow({
  409. children: [
  410. new TableCell({
  411. children: [new Paragraph({ children: [new TextRun({ text: '角色', bold: true, font: '微软雅黑', size: 20, color: 'FFFFFF' })] })],
  412. width: { size: 20, type: WidthType.PERCENTAGE },
  413. shading: { type: ShadingType.CLEAR, color: 'auto', fill: '2E74B5' },
  414. margins: { top: 80, bottom: 80, left: 120, right: 80 }
  415. }),
  416. new TableCell({
  417. children: [new Paragraph({ children: [new TextRun({ text: '姓名', bold: true, font: '微软雅黑', size: 20, color: 'FFFFFF' })] })],
  418. width: { size: 25, type: WidthType.PERCENTAGE },
  419. shading: { type: ShadingType.CLEAR, color: 'auto', fill: '2E74B5' },
  420. margins: { top: 80, bottom: 80, left: 120, right: 80 }
  421. }),
  422. new TableCell({
  423. children: [new Paragraph({ children: [new TextRun({ text: '签字', bold: true, font: '微软雅黑', size: 20, color: 'FFFFFF' })] })],
  424. width: { size: 35, type: WidthType.PERCENTAGE },
  425. shading: { type: ShadingType.CLEAR, color: 'auto', fill: '2E74B5' },
  426. margins: { top: 80, bottom: 80, left: 120, right: 80 }
  427. }),
  428. new TableCell({
  429. children: [new Paragraph({ children: [new TextRun({ text: '日期', bold: true, font: '微软雅黑', size: 20, color: 'FFFFFF' })] })],
  430. width: { size: 20, type: WidthType.PERCENTAGE },
  431. shading: { type: ShadingType.CLEAR, color: 'auto', fill: '2E74B5' },
  432. margins: { top: 80, bottom: 80, left: 120, right: 80 }
  433. })
  434. ]
  435. }),
  436. ...['提出人', '开发负责人', '测试负责人', '审批人'].map((role, i) =>
  437. new TableRow({
  438. children: [
  439. new TableCell({
  440. children: [new Paragraph({ children: [new TextRun({ text: role, font: '微软雅黑', size: 20 })] })],
  441. width: { size: 20, type: WidthType.PERCENTAGE },
  442. shading: { type: ShadingType.CLEAR, color: 'auto', fill: i % 2 === 0 ? 'FFFFFF' : 'F0F7FF' },
  443. margins: { top: 120, bottom: 120, left: 120, right: 80 }
  444. }),
  445. new TableCell({
  446. children: [new Paragraph({ children: [] })],
  447. width: { size: 25, type: WidthType.PERCENTAGE },
  448. shading: { type: ShadingType.CLEAR, color: 'auto', fill: i % 2 === 0 ? 'FFFFFF' : 'F0F7FF' },
  449. margins: { top: 120, bottom: 120, left: 120, right: 80 }
  450. }),
  451. new TableCell({
  452. children: [new Paragraph({ children: [] })],
  453. width: { size: 35, type: WidthType.PERCENTAGE },
  454. shading: { type: ShadingType.CLEAR, color: 'auto', fill: i % 2 === 0 ? 'FFFFFF' : 'F0F7FF' },
  455. margins: { top: 120, bottom: 120, left: 120, right: 80 }
  456. }),
  457. new TableCell({
  458. children: [new Paragraph({ children: [] })],
  459. width: { size: 20, type: WidthType.PERCENTAGE },
  460. shading: { type: ShadingType.CLEAR, color: 'auto', fill: i % 2 === 0 ? 'FFFFFF' : 'F0F7FF' },
  461. margins: { top: 120, bottom: 120, left: 120, right: 80 }
  462. })
  463. ]
  464. })
  465. )
  466. ]
  467. })
  468. ]
  469. }]
  470. });
  471. Packer.toBuffer(doc).then(buffer => {
  472. fs.writeFileSync('20260418报错闭环处理_美化版.docx', buffer);
  473. console.log('Done!');
  474. });