diff --git a/funcext/TSOffice/TOfficeObj.tsf b/funcext/TSOffice/TOfficeObj.tsf index 2aa7621..d986d40 100644 --- a/funcext/TSOffice/TOfficeObj.tsf +++ b/funcext/TSOffice/TOfficeObj.tsf @@ -1,4 +1,4 @@ -// Version 1.8.7 +// Version 1.8.8 Function TOfficeObj(n); Begin case lowercase(n) of diff --git a/funcext/TSOffice/TSDocxFile.tsf b/funcext/TSOffice/TSDocxFile.tsf index f7dcf21..d450088 100644 --- a/funcext/TSOffice/TSDocxFile.tsf +++ b/funcext/TSOffice/TSDocxFile.tsf @@ -1,4 +1,4 @@ -// Version 1.8.7 +// Version 1.8.8 Type TSDocxFile = Class ///Version: V1.0 2022-09-20 ///适用于 Microsoft Word docx格式文件 diff --git a/funcext/TSOffice/TSXlsxFile.tsf b/funcext/TSOffice/TSXlsxFile.tsf index 2028e9e..7cfdc76 100644 --- a/funcext/TSOffice/TSXlsxFile.tsf +++ b/funcext/TSOffice/TSXlsxFile.tsf @@ -1,4 +1,4 @@ -// Version 1.8.7 +// Version 1.8.8 Type TSXlsxFile = Class ///Version: V1.0 2022-08-08 ///适用于 Microsoft Excel? 2007 及以上版本创建的电子表格文档。支持 XLSX / XLSM / XLTM / XLTX 等多种文档格式。 diff --git a/funcext/TSOffice/document/TDocxCopy.tsf b/funcext/TSOffice/document/TDocxCopy.tsf index 6f8d399..3fd45c0 100644 --- a/funcext/TSOffice/document/TDocxCopy.tsf +++ b/funcext/TSOffice/document/TDocxCopy.tsf @@ -249,7 +249,9 @@ private Function SetDrawingInfo(drawing); Begin - graphic_node := class(TSXml).GetNode(drawing.node_,'w:r/w:drawing/wp:inline/a:graphic/a:graphicData'); + drawing_node := GetDrawingNode(drawing.node_); + graphic_node := class(TSXml).GetNode(drawing_node,'wp:inline/a:graphic/a:graphicData'); + // graphic_node := class(TSXml).GetNode(drawing.node_,'w:r/w:drawing/wp:inline/a:graphic/a:graphicData'); if ifObj(graphic_node) then begin node := class(TSXml).GetNode(graphic_node,'pic:pic/pic:blipFill/a:blip'); @@ -353,7 +355,8 @@ private end else if name = "w:p" then begin - draw := class(TSXml).GetNode(node, 'w:r/w:drawing'); + // draw := class(TSXml).GetNode(node, 'w:r/w:drawing'); + draw := GetDrawingNode(node); if ifObj(draw) then begin obj := TOfficeObj('TPicture'); @@ -382,6 +385,7 @@ private case name of 'w:p': begin + if GetDrawingNode(part.node_) then return 1; if class(TSXml).GetNode(part.node_, 'w:r/w:drawing') then return 1; return 0; end @@ -392,6 +396,26 @@ private end End; + function GetDrawingNode(node); + begin + r_node := node.FirstChild('w:r'); + while ifObj(r_node) do + begin + sub_node := r_node.FirstChild(); + sub_node_name := sub_node.GetName(); + if sub_node_name = 'w:rPr' then + begin + sub_node := sub_node.NextElement(); + sub_node_name := sub_node.GetName(); + end + if sub_node_name = 'w:drawing' then return sub_node; + if sub_node_name = 'w:t' and sub_node.GetAttribute('xml:space') = 'preserve' then + r_node := r_node.NextElement(); + else break; + end + return nil; + end; + private old_docx_obj_; new_docx_obj_; diff --git a/更新日志.md b/更新日志.md index f5ca592..d04a7e7 100644 --- a/更新日志.md +++ b/更新日志.md @@ -1,5 +1,13 @@ # 更新日志 +## 2026-09-10 + +### V1.8.8 + +#### word + +1. 修复`InsertFile`时,图片前有空格无法识别问题 + ## 2026-07-30 ### V1.8.7