diff --git a/Demo/excel_demo.tsl b/Demo/excel_demo.tsl index d270b1f..c814811 100644 --- a/Demo/excel_demo.tsl +++ b/Demo/excel_demo.tsl @@ -463,7 +463,7 @@ appProps.ScaleCrop := "true"; appProps.Company := "TS"; appProps.LinksUpToDate := "true"; appProps.HyperlinksChanged := "true"; -appProps.AppVersion := "1.000"; +appProps.Version := "1.000"; appProps.Manager := "这是主管"; //appProps.HyperlinkBase := "这是超链接基础"; excel.SetAppProps(appProps); diff --git a/DocxFile使用帮助.docx b/DocxFile使用帮助.docx index 9916bc0..1d329fc 100644 Binary files a/DocxFile使用帮助.docx and b/DocxFile使用帮助.docx differ diff --git a/ExcelFile使用帮助.xlsx b/ExcelFile使用帮助.xlsx index ea858fc..d197700 100644 Binary files a/ExcelFile使用帮助.xlsx and b/ExcelFile使用帮助.xlsx differ diff --git a/Linux-aarch64/liboffice_plugin.so b/Linux-aarch64/liboffice_plugin.so index 7c1e097..abf7e7f 100644 Binary files a/Linux-aarch64/liboffice_plugin.so and b/Linux-aarch64/liboffice_plugin.so differ diff --git a/Linux-x86_64/liboffice_plugin.so b/Linux-x86_64/liboffice_plugin.so index dec4ee4..4649b98 100644 Binary files a/Linux-x86_64/liboffice_plugin.so and b/Linux-x86_64/liboffice_plugin.so differ diff --git a/Windows-X64/office_plugin.dll b/Windows-X64/office_plugin.dll index 1ef1804..5e41b6b 100644 Binary files a/Windows-X64/office_plugin.dll and b/Windows-X64/office_plugin.dll differ diff --git a/funcext/TSOffice/TOfficeObj.tsf b/funcext/TSOffice/TOfficeObj.tsf index 645a69a..bcfb6fa 100644 --- a/funcext/TSOffice/TOfficeObj.tsf +++ b/funcext/TSOffice/TOfficeObj.tsf @@ -1,4 +1,4 @@ -// Version 1.0.7 +// Version 1.0.8 Function TOfficeObj(n); Begin @@ -411,18 +411,17 @@ type TComment=class(NodeInfo) //TODO... End; - Property Text read readCommentText write writeCommentText; - Function readCommentText(); + Property Text read readXMLText write writeXMLText; + Function readXMLText(); Begin - if ifObj(Root()) then - return class(TSXml).Utf8ToCurCodePage(Value('CommentText')); - else - return CommentText; + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Text')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLText); End; - Function writeCommentText(str); + Function writeXMLText(str); Begin - CommentText := class(TSXml).CurCodePageToUtf8(str); + XMLText := class(TSXml).CurCodePageToUtf8(str); End; Function GetAttrs(); override; @@ -435,7 +434,7 @@ type TComment=class(NodeInfo) Begin HandleChildren(); return array(("field":"Font","name":Font.NodeName,"obj":Font,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"TFont") - ,("field":"CommentText","name":"t","obj":CommentText,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") + ,("field":"Text","name":"t","obj":XMLText,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") ,("field":"Space","name":"t","obj":Space,"attrEx":"xml:space","nodeType":"","attrName":"", "desc":"", "class":"") ) union ExtNodes; End; @@ -444,7 +443,7 @@ type TComment=class(NodeInfo) //Nodes Font; - CommentText; + XMLText; Space; End; @@ -3692,52 +3691,49 @@ type THyperLink=class(NodeInfo) //TODO... End; - Property LinkUrl read readLinkLinkUrl write writeLinkLinkUrl; - Function readLinkLinkUrl(); + Property LinkUrl read readXMLLinkUrl write writeXMLLinkUrl; + Function readXMLLinkUrl(); Begin - if ifObj(Root()) then - return class(TSXml).Utf8ToCurCodePage(Value('LinkLinkUrl')); - else - return LinkLinkUrl; + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('LinkUrl')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLLinkUrl); End; - Function writeLinkLinkUrl(str); + Function writeXMLLinkUrl(str); Begin - LinkLinkUrl := class(TSXml).CurCodePageToUtf8(str); + XMLLinkUrl := class(TSXml).CurCodePageToUtf8(str); End; - Property Display read readLinkDisplay write writeLinkDisplay; - Function readLinkDisplay(); + Property Display read readXMLDisplay write writeXMLDisplay; + Function readXMLDisplay(); Begin - if ifObj(Root()) then - return class(TSXml).Utf8ToCurCodePage(Value('LinkDisplay')); - else - return LinkDisplay; + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Display')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLDisplay); End; - Function writeLinkDisplay(str); + Function writeXMLDisplay(str); Begin - LinkDisplay := class(TSXml).CurCodePageToUtf8(str); + XMLDisplay := class(TSXml).CurCodePageToUtf8(str); End; - Property Tooltip read readLinkTooltip write writeLinkTooltip; - Function readLinkTooltip(); + Property Tooltip read readXMLTooltip write writeXMLTooltip; + Function readXMLTooltip(); Begin - if ifObj(Root()) then - return class(TSXml).Utf8ToCurCodePage(Value('LinkTooltip')); - else - return LinkTooltip; + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Tooltip')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLTooltip); End; - Function writeLinkTooltip(str); + Function writeXMLTooltip(str); Begin - LinkTooltip := class(TSXml).CurCodePageToUtf8(str); + XMLTooltip := class(TSXml).CurCodePageToUtf8(str); End; Function GetAttrs(); override; Begin HandleAttrs(); - return array(("LinkType", "linkType", LinkType, ""),("LinkLinkUrl", "linkUrl", LinkLinkUrl, ""),("Axis", "ref", Axis, ""),("LinkDisplay", "display", LinkDisplay, ""),("LinkTooltip", "tooltip", LinkTooltip, ""),("RId", "r:id", RId, ""),("Location", "location", Location, "")) union ExtAttr; + return array(("LinkType", "linkType", LinkType, ""),("LinkUrl", "linkUrl", XMLLinkUrl, ""),("Axis", "ref", Axis, ""),("Display", "display", XMLDisplay, ""),("Tooltip", "tooltip", XMLTooltip, ""),("RId", "r:id", RId, ""),("Location", "location", Location, "")) union ExtAttr; End; Function GetChildren(); override; @@ -3748,10 +3744,10 @@ type THyperLink=class(NodeInfo) //Attributes LinkType; - LinkLinkUrl; + XMLLinkUrl; Axis; - LinkDisplay; - LinkTooltip; + XMLDisplay; + XMLTooltip; RId; Location; @@ -3868,144 +3864,134 @@ type TAppProperty=class(NodeInfo) //TODO... End; - Property Application read readAppApplication write writeAppApplication; - Function readAppApplication(); + Property Application read readXMLApplication write writeXMLApplication; + Function readXMLApplication(); Begin - if ifObj(Root()) then - return class(TSXml).Utf8ToCurCodePage(Value('AppApplication')); - else - return AppApplication; + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Application')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLApplication); End; - Function writeAppApplication(str); + Function writeXMLApplication(str); Begin - AppApplication := class(TSXml).CurCodePageToUtf8(str); + XMLApplication := class(TSXml).CurCodePageToUtf8(str); End; - Property DocSecurity read readAppDocSecurity write writeAppDocSecurity; - Function readAppDocSecurity(); + Property DocSecurity read readXMLDocSecurity write writeXMLDocSecurity; + Function readXMLDocSecurity(); Begin - if ifObj(Root()) then - return Value('AppDocSecurity'); - else - return AppDocSecurity; + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('DocSecurity')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLDocSecurity); End; - Function writeAppDocSecurity(str); + Function writeXMLDocSecurity(str); Begin - AppDocSecurity := str; + XMLDocSecurity := class(TSXml).CurCodePageToUtf8(str); End; - Property ScaleCrop read readAppScaleCrop write writeAppScaleCrop; - Function readAppScaleCrop(); + Property ScaleCrop read readXMLScaleCrop write writeXMLScaleCrop; + Function readXMLScaleCrop(); Begin - if ifObj(Root()) then - return Value('AppScaleCrop'); - else - return AppScaleCrop; + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ScaleCrop')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLScaleCrop); End; - Function writeAppScaleCrop(str); + Function writeXMLScaleCrop(str); Begin - AppScaleCrop := str; + XMLScaleCrop := class(TSXml).CurCodePageToUtf8(str); End; - Property Manager read readAppManager write writeAppManager; - Function readAppManager(); + Property Manager read readXMLManager write writeXMLManager; + Function readXMLManager(); Begin - if ifObj(Root()) then - return class(TSXml).Utf8ToCurCodePage(Value('AppManager')); - else - return AppManager; + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Manager')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLManager); End; - Function writeAppManager(str); + Function writeXMLManager(str); Begin - AppManager := class(TSXml).CurCodePageToUtf8(str); + XMLManager := class(TSXml).CurCodePageToUtf8(str); End; - Property Company read readAppCompany write writeAppCompany; - Function readAppCompany(); + Property Company read readXMLCompany write writeXMLCompany; + Function readXMLCompany(); Begin - if ifObj(Root()) then - return Value('AppCompany'); - else - return AppCompany; + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Company')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLCompany); End; - Function writeAppCompany(str); + Function writeXMLCompany(str); Begin - AppCompany := str; + XMLCompany := class(TSXml).CurCodePageToUtf8(str); End; - Property LinksUpToDate read readAppLinksUpToDate write writeAppLinksUpToDate; - Function readAppLinksUpToDate(); + Property LinksUpToDate read readXMLLinksUpToDate write writeXMLLinksUpToDate; + Function readXMLLinksUpToDate(); Begin - if ifObj(Root()) then - return Value('AppLinksUpToDate'); - else - return AppLinksUpToDate; + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('LinksUpToDate')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLLinksUpToDate); End; - Function writeAppLinksUpToDate(str); + Function writeXMLLinksUpToDate(str); Begin - AppLinksUpToDate := str; + XMLLinksUpToDate := class(TSXml).CurCodePageToUtf8(str); End; - Property SharedDoc read readAppSharedDoc write writeAppSharedDoc; - Function readAppSharedDoc(); + Property SharedDoc read readXMLSharedDoc write writeXMLSharedDoc; + Function readXMLSharedDoc(); Begin - if ifObj(Root()) then - return Value('AppSharedDoc'); - else - return AppSharedDoc; + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('SharedDoc')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLSharedDoc); End; - Function writeAppSharedDoc(str); + Function writeXMLSharedDoc(str); Begin - AppSharedDoc := str; + XMLSharedDoc := class(TSXml).CurCodePageToUtf8(str); End; - Property HyperlinkBase read readAppHyperlinkBase write writeAppHyperlinkBase; - Function readAppHyperlinkBase(); + Property HyperlinkBase read readXMLHyperlinkBase write writeXMLHyperlinkBase; + Function readXMLHyperlinkBase(); Begin - if ifObj(Root()) then - return class(TSXml).Utf8ToCurCodePage(Value('AppHyperlinkBase')); - else - return AppHyperlinkBase; + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('HyperlinkBase')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLHyperlinkBase); End; - Function writeAppHyperlinkBase(str); + Function writeXMLHyperlinkBase(str); Begin - AppHyperlinkBase := class(TSXml).CurCodePageToUtf8(str); + XMLHyperlinkBase := class(TSXml).CurCodePageToUtf8(str); End; - Property HyperlinksChanged read readAppHyperlinksChanged write writeAppHyperlinksChanged; - Function readAppHyperlinksChanged(); + Property HyperlinksChanged read readXMLHyperlinksChanged write writeXMLHyperlinksChanged; + Function readXMLHyperlinksChanged(); Begin - if ifObj(Root()) then - return Value('AppHyperlinksChanged'); - else - return AppHyperlinksChanged; + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('HyperlinksChanged')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLHyperlinksChanged); End; - Function writeAppHyperlinksChanged(str); + Function writeXMLHyperlinksChanged(str); Begin - AppHyperlinksChanged := str; + XMLHyperlinksChanged := class(TSXml).CurCodePageToUtf8(str); End; - Property Version read readAppVersion write writeAppVersion; - Function readAppVersion(); + Property Version read readXMLVersion write writeXMLVersion; + Function readXMLVersion(); Begin - if ifObj(Root()) then - return class(TSXml).Utf8ToCurCodePage(Value('AppVersion')); - else - return AppVersion; + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Version')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLVersion); End; - Function writeAppVersion(str); + Function writeXMLVersion(str); Begin - AppVersion := class(TSXml).CurCodePageToUtf8(str); + XMLVersion := class(TSXml).CurCodePageToUtf8(str); End; Function GetAttrs(); override; @@ -4017,32 +4003,32 @@ type TAppProperty=class(NodeInfo) Function GetChildren(); override; Begin HandleChildren(); - return array(("field":"AppApplication","name":"Application","obj":AppApplication,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") - ,("field":"AppDocSecurity","name":"DocSecurity","obj":AppDocSecurity,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") - ,("field":"AppScaleCrop","name":"ScaleCrop","obj":AppScaleCrop,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") - ,("field":"AppManager","name":"Manager","obj":AppManager,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") - ,("field":"AppCompany","name":"Company","obj":AppCompany,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") - ,("field":"AppLinksUpToDate","name":"LinksUpToDate","obj":AppLinksUpToDate,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") - ,("field":"AppSharedDoc","name":"SharedDoc","obj":AppSharedDoc,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") - ,("field":"AppHyperlinkBase","name":"HyperlinkBase","obj":AppHyperlinkBase,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") - ,("field":"AppHyperlinksChanged","name":"HyperlinksChanged","obj":AppHyperlinksChanged,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") - ,("field":"AppVersion","name":"AppVersion","obj":AppVersion,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") + return array(("field":"Application","name":"Application","obj":XMLApplication,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") + ,("field":"DocSecurity","name":"DocSecurity","obj":XMLDocSecurity,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") + ,("field":"ScaleCrop","name":"ScaleCrop","obj":XMLScaleCrop,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") + ,("field":"Manager","name":"Manager","obj":XMLManager,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") + ,("field":"Company","name":"Company","obj":XMLCompany,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") + ,("field":"LinksUpToDate","name":"LinksUpToDate","obj":XMLLinksUpToDate,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") + ,("field":"SharedDoc","name":"SharedDoc","obj":XMLSharedDoc,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") + ,("field":"HyperlinkBase","name":"HyperlinkBase","obj":XMLHyperlinkBase,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") + ,("field":"HyperlinksChanged","name":"HyperlinksChanged","obj":XMLHyperlinksChanged,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") + ,("field":"Version","name":"AppVersion","obj":XMLVersion,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") ) union ExtNodes; End; //Attributes //Nodes - AppApplication; - AppDocSecurity; - AppScaleCrop; - AppManager; - AppCompany; - AppLinksUpToDate; - AppSharedDoc; - AppHyperlinkBase; - AppHyperlinksChanged; - AppVersion; + XMLApplication; + XMLDocSecurity; + XMLScaleCrop; + XMLManager; + XMLCompany; + XMLLinksUpToDate; + XMLSharedDoc; + XMLHyperlinkBase; + XMLHyperlinksChanged; + XMLVersion; End; /////////////////////////////////////////////////////////////// @@ -4065,130 +4051,121 @@ type TCoreProperty=class(NodeInfo) //TODO... End; - Property Title read readCoreTitle write writeCoreTitle; - Function readCoreTitle(); + Property Title read readXMLTitle write writeXMLTitle; + Function readXMLTitle(); Begin - if ifObj(Root()) then - return class(TSXml).Utf8ToCurCodePage(Value('CoreTitle')); - else - return CoreTitle; + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Title')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLTitle); End; - Function writeCoreTitle(str); + Function writeXMLTitle(str); Begin - CoreTitle := class(TSXml).CurCodePageToUtf8(str); + XMLTitle := class(TSXml).CurCodePageToUtf8(str); End; - Property Subject read readCoreSubject write writeCoreSubject; - Function readCoreSubject(); + Property Subject read readXMLSubject write writeXMLSubject; + Function readXMLSubject(); Begin - if ifObj(Root()) then - return class(TSXml).Utf8ToCurCodePage(Value('CoreSubject')); - else - return CoreSubject; + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Subject')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLSubject); End; - Function writeCoreSubject(str); + Function writeXMLSubject(str); Begin - CoreSubject := class(TSXml).CurCodePageToUtf8(str); + XMLSubject := class(TSXml).CurCodePageToUtf8(str); End; - Property Creator read readCoreCreator write writeCoreCreator; - Function readCoreCreator(); + Property Creator read readXMLCreator write writeXMLCreator; + Function readXMLCreator(); Begin - if ifObj(Root()) then - return class(TSXml).Utf8ToCurCodePage(Value('CoreCreator')); - else - return CoreCreator; + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Creator')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLCreator); End; - Function writeCoreCreator(str); + Function writeXMLCreator(str); Begin - CoreCreator := class(TSXml).CurCodePageToUtf8(str); + XMLCreator := class(TSXml).CurCodePageToUtf8(str); End; - Property Keywords read readCoreKeywords write writeCoreKeywords; - Function readCoreKeywords(); + Property Keywords read readXMLKeywords write writeXMLKeywords; + Function readXMLKeywords(); Begin - if ifObj(Root()) then - return class(TSXml).Utf8ToCurCodePage(Value('CoreKeywords')); - else - return CoreKeywords; + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Keywords')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLKeywords); End; - Function writeCoreKeywords(str); + Function writeXMLKeywords(str); Begin - CoreKeywords := class(TSXml).CurCodePageToUtf8(str); + XMLKeywords := class(TSXml).CurCodePageToUtf8(str); End; - Property Description read readCoreDescription write writeCoreDescription; - Function readCoreDescription(); + Property Description read readXMLDescription write writeXMLDescription; + Function readXMLDescription(); Begin - if ifObj(Root()) then - return class(TSXml).Utf8ToCurCodePage(Value('CoreDescription')); - else - return CoreDescription; + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Description')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLDescription); End; - Function writeCoreDescription(str); + Function writeXMLDescription(str); Begin - CoreDescription := class(TSXml).CurCodePageToUtf8(str); + XMLDescription := class(TSXml).CurCodePageToUtf8(str); End; - Property LastModifiedBy read readCoreLastModifiedBy write writeCoreLastModifiedBy; - Function readCoreLastModifiedBy(); + Property LastModifiedBy read readXMLLastModifiedBy write writeXMLLastModifiedBy; + Function readXMLLastModifiedBy(); Begin - if ifObj(Root()) then - return class(TSXml).Utf8ToCurCodePage(Value('CoreLastModifiedBy')); - else - return CoreLastModifiedBy; + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('LastModifiedBy')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLLastModifiedBy); End; - Function writeCoreLastModifiedBy(str); + Function writeXMLLastModifiedBy(str); Begin - CoreLastModifiedBy := class(TSXml).CurCodePageToUtf8(str); + XMLLastModifiedBy := class(TSXml).CurCodePageToUtf8(str); End; - Property LastPrinted read readCoreLastPrinted write writeCoreLastPrinted; - Function readCoreLastPrinted(); + Property LastPrinted read readXMLLastPrinted write writeXMLLastPrinted; + Function readXMLLastPrinted(); Begin - if ifObj(Root()) then - return class(TSXml).Utf8ToCurCodePage(Value('CoreLastPrinted')); - else - return CoreLastPrinted; + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('LastPrinted')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLLastPrinted); End; - Function writeCoreLastPrinted(str); + Function writeXMLLastPrinted(str); Begin - CoreLastPrinted := class(TSXml).CurCodePageToUtf8(str); + XMLLastPrinted := class(TSXml).CurCodePageToUtf8(str); End; - Property Category read readCoreCategory write writeCoreCategory; - Function readCoreCategory(); + Property Category read readXMLCategory write writeXMLCategory; + Function readXMLCategory(); Begin - if ifObj(Root()) then - return class(TSXml).Utf8ToCurCodePage(Value('CoreCategory')); - else - return CoreCategory; + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Category')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLCategory); End; - Function writeCoreCategory(str); + Function writeXMLCategory(str); Begin - CoreCategory := class(TSXml).CurCodePageToUtf8(str); + XMLCategory := class(TSXml).CurCodePageToUtf8(str); End; - Property ContentStatus read readCoreContentStatus write writeCoreContentStatus; - Function readCoreContentStatus(); + Property ContentStatus read readXMLContentStatus write writeXMLContentStatus; + Function readXMLContentStatus(); Begin - if ifObj(Root()) then - return class(TSXml).Utf8ToCurCodePage(Value('CoreContentStatus')); - else - return CoreContentStatus; + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ContentStatus')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLContentStatus); End; - Function writeCoreContentStatus(str); + Function writeXMLContentStatus(str); Begin - CoreContentStatus := class(TSXml).CurCodePageToUtf8(str); + XMLContentStatus := class(TSXml).CurCodePageToUtf8(str); End; Function GetAttrs(); override; @@ -4200,30 +4177,30 @@ type TCoreProperty=class(NodeInfo) Function GetChildren(); override; Begin HandleChildren(); - return array(("field":"CoreTitle","name":"dc:title","obj":CoreTitle,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") - ,("field":"CoreSubject","name":"dc:subject","obj":CoreSubject,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") - ,("field":"CoreCreator","name":"dc:creator","obj":CoreCreator,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") - ,("field":"CoreKeywords","name":"cp:keywords","obj":CoreKeywords,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") - ,("field":"CoreDescription","name":"dc:description","obj":CoreDescription,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") - ,("field":"CoreLastModifiedBy","name":"cp:lastModifiedBy","obj":CoreLastModifiedBy,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") - ,("field":"CoreLastPrinted","name":"cp:lastPrinted","obj":CoreLastPrinted,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") - ,("field":"CoreCategory","name":"cp:category","obj":CoreCategory,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") - ,("field":"CoreContentStatus","name":"cp:contentStatus","obj":CoreContentStatus,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") + return array(("field":"Title","name":"dc:title","obj":XMLTitle,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") + ,("field":"Subject","name":"dc:subject","obj":XMLSubject,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") + ,("field":"Creator","name":"dc:creator","obj":XMLCreator,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") + ,("field":"Keywords","name":"cp:keywords","obj":XMLKeywords,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") + ,("field":"Description","name":"dc:description","obj":XMLDescription,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") + ,("field":"LastModifiedBy","name":"cp:lastModifiedBy","obj":XMLLastModifiedBy,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") + ,("field":"LastPrinted","name":"cp:lastPrinted","obj":XMLLastPrinted,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") + ,("field":"Category","name":"cp:category","obj":XMLCategory,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") + ,("field":"ContentStatus","name":"cp:contentStatus","obj":XMLContentStatus,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"") ) union ExtNodes; End; //Attributes //Nodes - CoreTitle; - CoreSubject; - CoreCreator; - CoreKeywords; - CoreDescription; - CoreLastModifiedBy; - CoreLastPrinted; - CoreCategory; - CoreContentStatus; + XMLTitle; + XMLSubject; + XMLCreator; + XMLKeywords; + XMLDescription; + XMLLastModifiedBy; + XMLLastPrinted; + XMLCategory; + XMLContentStatus; End; /////////////////////////////////////////////////////////////// @@ -4284,10 +4261,127 @@ type TwFont=class(NodeInfo) //TODO... End; + Property eastAsia read readXMLeastAsia write writeXMLeastAsia; + Function readXMLeastAsia(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('eastAsia')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLeastAsia); + End; + + Function writeXMLeastAsia(str); + Begin + XMLeastAsia := class(TSXml).CurCodePageToUtf8(str); + End; + + Property eastAsiaTheme read readXMLeastAsiaTheme write writeXMLeastAsiaTheme; + Function readXMLeastAsiaTheme(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('eastAsiaTheme')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLeastAsiaTheme); + End; + + Function writeXMLeastAsiaTheme(str); + Begin + XMLeastAsiaTheme := class(TSXml).CurCodePageToUtf8(str); + End; + + Property hAnsi read readXMLhAnsi write writeXMLhAnsi; + Function readXMLhAnsi(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('hAnsi')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLhAnsi); + End; + + Function writeXMLhAnsi(str); + Begin + XMLhAnsi := class(TSXml).CurCodePageToUtf8(str); + End; + + Property hAnsiTheme read readXMLhAnsiTheme write writeXMLhAnsiTheme; + Function readXMLhAnsiTheme(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('hAnsiTheme')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLhAnsiTheme); + End; + + Function writeXMLhAnsiTheme(str); + Begin + XMLhAnsiTheme := class(TSXml).CurCodePageToUtf8(str); + End; + + Property hint read readXMLhint write writeXMLhint; + Function readXMLhint(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('hint')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLhint); + End; + + Function writeXMLhint(str); + Begin + XMLhint := class(TSXml).CurCodePageToUtf8(str); + End; + + Property ascii read readXMLascii write writeXMLascii; + Function readXMLascii(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ascii')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLascii); + End; + + Function writeXMLascii(str); + Begin + XMLascii := class(TSXml).CurCodePageToUtf8(str); + End; + + Property asciiTheme read readXMLasciiTheme write writeXMLasciiTheme; + Function readXMLasciiTheme(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('asciiTheme')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLasciiTheme); + End; + + Function writeXMLasciiTheme(str); + Begin + XMLasciiTheme := class(TSXml).CurCodePageToUtf8(str); + End; + + Property cs read readXMLcs write writeXMLcs; + Function readXMLcs(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('cs')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLcs); + End; + + Function writeXMLcs(str); + Begin + XMLcs := class(TSXml).CurCodePageToUtf8(str); + End; + + Property csTheme read readXMLcsTheme write writeXMLcsTheme; + Function readXMLcsTheme(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('csTheme')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLcsTheme); + End; + + Function writeXMLcsTheme(str); + Begin + XMLcsTheme := class(TSXml).CurCodePageToUtf8(str); + End; + Function GetAttrs(); override; Begin HandleAttrs(); - return array(("eastAsia", "w:eastAsia", eastAsia, "东亚字体"),("eastAsiaTheme", "w:eastAsiaTheme", eastAsiaTheme, "东亚主题字体"),("hAnsi", "w:hAnsi", hAnsi, "Specifies a font which shall be used to format all characters in a Unicode range within the parent run which does not fall into one of the three categories defined above, which is called the high ANSI range in WordprocessingML."),("hAnsiTheme", "w:hAnsiTheme", hAnsiTheme, "Specifies a theme font which shall be used to format all characters in a Unicode range within the parent run which does not fall into one of the three categories defined above, which is called the high ANSI range in WordprocessingML. "),("hint", "w:hint", hint, "Specifies the font type which shall be used to format any ambiguous characters in the current run."),("ascii", "w:ascii", ascii, "Specifies a font which shall be used to format all characters in the ASCII range (0 - 127) within the parent run."),("asciiTheme", "w:asciiTheme", asciiTheme, "Specifies a theme font which shall be used to format all characters in the ASCII range (0 - 127) within the parent run."),("cs", "w:cs", cs, "Specifies a font which shall be used to format all characters in a complex script Unicode range within the parent run."),("csTheme", "w:csTheme", csTheme, "Specifies a theme font which shall be used to format all characters in a complex script Unicode range within the parent run. ")) union ExtAttr; + return array(("eastAsia", "w:eastAsia", XMLeastAsia, "东亚字体"),("eastAsiaTheme", "w:eastAsiaTheme", XMLeastAsiaTheme, "东亚主题字体"),("hAnsi", "w:hAnsi", XMLhAnsi, "Specifies a font which shall be used to format all characters in a Unicode range within the parent run which does not fall into one of the three categories defined above, which is called the high ANSI range in WordprocessingML."),("hAnsiTheme", "w:hAnsiTheme", XMLhAnsiTheme, "Specifies a theme font which shall be used to format all characters in a Unicode range within the parent run which does not fall into one of the three categories defined above, which is called the high ANSI range in WordprocessingML. "),("hint", "w:hint", XMLhint, "Specifies the font type which shall be used to format any ambiguous characters in the current run."),("ascii", "w:ascii", XMLascii, "Specifies a font which shall be used to format all characters in the ASCII range (0 - 127) within the parent run."),("asciiTheme", "w:asciiTheme", XMLasciiTheme, "Specifies a theme font which shall be used to format all characters in the ASCII range (0 - 127) within the parent run."),("cs", "w:cs", XMLcs, "Specifies a font which shall be used to format all characters in a complex script Unicode range within the parent run."),("csTheme", "w:csTheme", XMLcsTheme, "Specifies a theme font which shall be used to format all characters in a complex script Unicode range within the parent run. ")) union ExtAttr; End; Function GetChildren(); override; @@ -4297,15 +4391,15 @@ type TwFont=class(NodeInfo) End; //Attributes - eastAsia; - eastAsiaTheme; - hAnsi; - hAnsiTheme; - hint; - ascii; - asciiTheme; - cs; - csTheme; + XMLeastAsia; + XMLeastAsiaTheme; + XMLhAnsi; + XMLhAnsiTheme; + XMLhint; + XMLascii; + XMLasciiTheme; + XMLcs; + XMLcsTheme; //Nodes End; @@ -4363,14 +4457,19 @@ type TwrPr=class(NodeInfo) Property Name write writeName; Function writeName(n); + Begin + SetName(n, false); + End; + + Function SetName(n, isUtf8); Begin nName := n; - if not class(TSXml).IsUtf8() then + if not isUtf8 then nName := class(TSXml).CurCodePageToUtf8(n); - rFont.cs := nName; - rFont.eastAsia := nName; - rFont.hAnsi := nName; - rFont.ascii := nName; + rFont.XMLcs := nName; + rFont.XMLeastAsia := nName; + rFont.XMLhAnsi := nName; + rFont.XMLascii := nName; End; //Attributes @@ -5720,10 +5819,23 @@ type TOptInfo=class(NodeInfo) //TODO... End; + Property Author read readXMLAuthor write writeXMLAuthor; + Function readXMLAuthor(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Author')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLAuthor); + End; + + Function writeXMLAuthor(str); + Begin + XMLAuthor := class(TSXml).CurCodePageToUtf8(str); + End; + Function GetAttrs(); override; Begin HandleAttrs(); - return array(("Author", "w:author", Author, "作者"),("Date", "w:date", Date, "修改日期"),("ID", "w:id", ID, "disable")) union ExtAttr; + return array(("Author", "w:author", XMLAuthor, "作者"),("Date", "w:date", Date, "修改日期"),("ID", "w:id", ID, "disable")) union ExtAttr; End; Function GetChildren(); override; @@ -5733,7 +5845,7 @@ type TOptInfo=class(NodeInfo) End; //Attributes - Author; + XMLAuthor; Date; ID; @@ -5760,10 +5872,23 @@ type TRevisionImpl=class(NodeInfo) //TODO... End; + Property Author read readXMLAuthor write writeXMLAuthor; + Function readXMLAuthor(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Author')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLAuthor); + End; + + Function writeXMLAuthor(str); + Begin + XMLAuthor := class(TSXml).CurCodePageToUtf8(str); + End; + Function GetAttrs(); override; Begin HandleAttrs(); - return array(("Author", "w:author", Author, "作者"),("Date", "w:date", Date, "修改日期"),("ID", "w:id", ID, "disable")) union ExtAttr; + return array(("Author", "w:author", XMLAuthor, "作者"),("Date", "w:date", Date, "修改日期"),("ID", "w:id", ID, "disable")) union ExtAttr; End; Function GetChildren(); override; @@ -5773,7 +5898,7 @@ type TRevisionImpl=class(NodeInfo) End; //Attributes - Author; + XMLAuthor; Date; ID; @@ -5801,10 +5926,23 @@ type TDocCommentImpl=class(NodeInfo) //TODO... End; + Property Author read readXMLAuthor write writeXMLAuthor; + Function readXMLAuthor(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Author')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLAuthor); + End; + + Function writeXMLAuthor(str); + Begin + XMLAuthor := class(TSXml).CurCodePageToUtf8(str); + End; + Function GetAttrs(); override; Begin HandleAttrs(); - return array(("Author", "w:author", Author, "作者"),("Date", "w:date", Date, "修改日期"),("ID", "w:id", ID, "disable")) union ExtAttr; + return array(("Author", "w:author", XMLAuthor, "作者"),("Date", "w:date", Date, "修改日期"),("ID", "w:id", ID, "disable")) union ExtAttr; End; Function GetChildren(); override; @@ -5815,7 +5953,7 @@ type TDocCommentImpl=class(NodeInfo) End; //Attributes - Author; + XMLAuthor; Date; ID; @@ -6211,10 +6349,23 @@ type TcellMerge=class(NodeInfo) //TODO... End; + Property Author read readXMLAuthor write writeXMLAuthor; + Function readXMLAuthor(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Author')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLAuthor); + End; + + Function writeXMLAuthor(str); + Begin + XMLAuthor := class(TSXml).CurCodePageToUtf8(str); + End; + Function GetAttrs(); override; Begin HandleAttrs(); - return array(("Author", "w:author", Author, ""),("Date", "w:date", Date, ""),("ID", "w:id", ID, ""),("vmerge", "w:vmerge", vmerge, ""),("vmergeOrig", "w:vmergeOrig", vmergeOrig, "")) union ExtAttr; + return array(("Author", "w:author", XMLAuthor, ""),("Date", "w:date", Date, ""),("ID", "w:id", ID, ""),("vmerge", "w:vmerge", vmerge, ""),("vmergeOrig", "w:vmergeOrig", vmergeOrig, "")) union ExtAttr; End; Function GetChildren(); override; @@ -6224,7 +6375,7 @@ type TcellMerge=class(NodeInfo) End; //Attributes - Author; + XMLAuthor; Date; ID; vmerge; @@ -7381,7 +7532,6 @@ type TStdPr=class(NodeInfo) HandleChildren(); return array(("field":"rPr","name":rPr.NodeName,"obj":rPr,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"TwrPr") ,("field":"ID","name":"w:id","obj":ID,"attrEx":"w:val","nodeType":"","attrName":"", "desc":"", "class":"") - ,("field":"Color","name":"w15:color","obj":Color,"attrEx":"w:val","nodeType":"","attrName":"", "desc":"", "class":"") ,("field":"docPartObj","name":docPartObj.NodeName,"obj":docPartObj,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"TDocPartObj") ) union ExtNodes; End; @@ -7391,7 +7541,6 @@ type TStdPr=class(NodeInfo) //Nodes rPr; ID; - Color; docPartObj; End; @@ -8009,13 +8158,6 @@ Type DocObject = Class Begin obj.NodeName := 'w:ins'; obj.name_ := obj.NodeName; - tmpAuthor := obj.Author; - tmpTxt := obj.InsText; - if not class(TSXml).IsUtf8() then Begin - if ifstring(obj.Author) then - obj.Author := class(TSXml).CurCodePageToUtf8(obj.Author); - obj.InsText := class(TSXml).CurCodePageToUtf8(obj.InsText); - End; r := _split_range(obj.sPos, 0); if length(r) then Begin rNode := r[length(r)-1]['rNode']; @@ -8038,8 +8180,6 @@ Type DocObject = Class End; run := new TRun(node2); run.SetText(obj.InsText, true); - obj.InsText := tmpTxt; - obj.Author := tmpAuthor; obj.Init(node); return true; End; @@ -8049,9 +8189,6 @@ Type DocObject = Class ///返回:成功 true,失败 false Function DelRevision(obj); Begin - tmpAuthor := obj.Author; - if ifstring(obj.Author) and not class(TSXml).IsUtf8() then - obj.Author := class(TSXml).CurCodePageToUtf8(obj.Author); r := _split_range(obj.sPos, obj.SelectLength); for i:=0 to length(r)-1 do Begin rNode := r[i]['rNode']; @@ -8061,7 +8198,6 @@ Type DocObject = Class delNode.InsertFirstChild(rXml); rNode.Parent().DeleteChild(rNode); End; - obj.Author := tmpAuthor; return length(r); End; @@ -9706,7 +9842,7 @@ private strRef.F := name; return; End; - [err, col] := ColumnNumberToName(2*i + 2); + [err, col] := ColumnNumberToName(i + 2); strRef.F := 'Sheet1!$' $ col $ '$1'; strRef.strCache.ptCount := 1; strRef.strCache.pt.IDx := 0; @@ -9751,7 +9887,8 @@ private Val.NumRef.F := data; //excel图表(Sheet1!$C$2:$C$6) else if istable(data) then Begin //word 图表 cnt := length(data); - [err, axis] := ColumnNumberToName(2 * ind + 2); + //[err, axis] := ColumnNumberToName(2 * ind + 2); + [err, axis] := ColumnNumberToName(ind + 2); Val.NumRef.F := fmt('Sheet1!${}$2:${}${}',axis, axis, cnt+1); Val.NumRef.NumCache.PtCount := cnt; Val.NumRef.NumCache.formatCode := 'General'; @@ -9759,7 +9896,8 @@ private Tpt := TOfficeObj('Tpt'); Tpt.IDx := i; Tpt.V := data[i]; - [err,cell] := CoordinatesToCellName(2*ind+2, i+2); + //[err,cell] := CoordinatesToCellName(2*ind+2, i+2); + [err,cell] := CoordinatesToCellName(ind+2, i+2); _setExcelCellVal(cell, data[i]); Val.NumRef.NumCache.NewChildNode( array("field":"", "name":"c:pt", "obj":Tpt, "attrEx":"", "nodeType":"") ); End; @@ -9779,15 +9917,17 @@ private cat.StrRef.F := Categories; //excel图表(Sheet1!$A$2:$A$6) else if istable(Categories) then Begin //word 图表 cnt := length(Categories); - [err, axis] := ColumnNumberToName(2 * ind + 1); - cat.StrRef.F := fmt('Sheet1!${}$2:${}${}',axis, axis, cnt+1); + //[err, axis] := ColumnNumberToName(2 * ind + 1); + //cat.StrRef.F := fmt('Sheet1!${}$2:${}${}',axis, axis, cnt+1); + cat.StrRef.F := fmt('Sheet1!$A$2:$A${}', cnt+1); cat.StrRef.StrCache.PtCount := cnt; for i:=0 to cnt-1 do Begin Tpt := TOfficeObj('Tpt'); Tpt.IDx := i; Tpt.V := Categories[i]; [err,cell] := CoordinatesToCellName(2*ind+1, i+2); - _setExcelCellVal(cell, Tpt.V); + if ind = 0 then + _setExcelCellVal(cell, Tpt.V); cat.StrRef.StrCache.NewChildNode( array("field":"", "name":"c:pt", "obj":Tpt, "attrEx":"", "nodeType":"") ); End; End; @@ -10972,8 +11112,10 @@ Type TDocumentBody = Class(DocObject) else flag := ''; '[TSL]': - if c = '[' then + if c = '[' then Begin flag := '[TSL]['; + endPos := 0; + End '[TSL][': if c = '/' then flag := '[TSL][/'; @@ -11033,7 +11175,7 @@ Type TDocumentBody = Class(DocObject) pNode.Parent().DeleteChild(pNode); End; //run inner tsl - code := leftstr(code, lengthW(code) - 5); + code := leftstr(code, lengthW(code) - 5 - endPos); CodePage := TOfficeApi().Get('CodePage'); TOfficeApi().Set('Docx', docx); TOfficeApi().Set('CurrentParagraph', curParagraphNode); @@ -11139,7 +11281,8 @@ Type TDocumentBody = Class(DocObject) if length(tslArr) then Begin //println('pIndex={},txt={},i={}',tArr[i]['pIndex'], txt, i); if i and i < length(tArr) and tArr[i]['pIndex'] <> tArr[i+1]['pIndex'] then Begin - code += ' \n'; + code += '\n'; + endPos ++; End; ind := length(tslArr) - 1; if tslArr[ind]['pIndex'] <> tArr[i]['pIndex'] or tslArr[ind]['rIndex'] <> tArr[i]['rIndex'] then @@ -11331,12 +11474,13 @@ Type TDocumentBody = Class(DocObject) End; return strtoint(width); End; - + Function _set_lastParagraph_(node); Begin - if ifObj(lastParagraph_) then - lastParagraph_.BigChild(node); - else + if not ifObj(lastParagraph_) then Begin + lastParagraph_ := node; + End + else if node.BigChild(lastParagraph_) then lastParagraph_ := node; End; diff --git a/funcext/TSOffice/TSDocxFile.tsf b/funcext/TSOffice/TSDocxFile.tsf index 3862538..4d9e736 100644 --- a/funcext/TSOffice/TSDocxFile.tsf +++ b/funcext/TSOffice/TSDocxFile.tsf @@ -1,4 +1,4 @@ -// Version 1.0.7 +// Version 1.0.8 Type TSDocxFile = Class ///Version: V1.0 2022-09-20 @@ -136,7 +136,7 @@ Type TSDocxFile = Class return document_.Body().AddBreak(getPosNode(posOpt), 'column'); End; - ///删除指定段落 + ///删除指定段落(表格、图片、图表、文本框等) ///posOpt: 段落位置,0 DOCX文件开头;-1 文件尾;N 第N段;posOpt段落 ///返回:true Function DelParagraph(posOpt); @@ -309,8 +309,6 @@ Type TSDocxFile = Class c := TOfficeObj('TDocComment'); c.p.Run.SetText( txt ); c.Author := author; - if author and not class(TSXml).IsUtf8() then - c.Author := class(TSXml).CurCodePageToUtf8(author); c.ID := id; xmlfile.FirstChildElement('w:comments').InsertEndChild(c.Marshal()); return c; diff --git a/funcext/TSOffice/TSExcelFile.tsf b/funcext/TSOffice/TSExcelFile.tsf index 092148a..f7c346f 100644 --- a/funcext/TSOffice/TSExcelFile.tsf +++ b/funcext/TSOffice/TSExcelFile.tsf @@ -1,4 +1,4 @@ -// Version 1.0.7 +// Version 1.0.8 Type TSExcelFile = Class ///Version: V1.0 2022-08-08 diff --git a/funcext/TSOffice/TSUtils/NodeInfo.tsf b/funcext/TSOffice/TSUtils/NodeInfo.tsf index 23abb26..e9507d1 100644 --- a/funcext/TSOffice/TSUtils/NodeInfo.tsf +++ b/funcext/TSOffice/TSUtils/NodeInfo.tsf @@ -161,6 +161,7 @@ public rootNode := p.Root(); p := p.Parent; End; + if not ifObj(rootNode) then return nil; attrs := GetAttrsEx(); lName := lowerCase(name); @@ -187,9 +188,9 @@ public key := r['attrName'] ? r['attrName'] : r['attrEx'] ? r['attrEx'] : 'val'; if r['nodeType'] = 'empty_string' then begin - value := node.GetAttribute(key); - if not value then return true; - return value; + val := node.GetAttribute(key); + if not val then return true; + return val; end return node.GetAttribute(key);//返回属性 End; diff --git a/funcext/TSOffice/TSUtils/TOfficeApi.tsf b/funcext/TSOffice/TSUtils/TOfficeApi.tsf index 6201cb0..222b8fe 100644 --- a/funcext/TSOffice/TSUtils/TOfficeApi.tsf +++ b/funcext/TSOffice/TSUtils/TOfficeApi.tsf @@ -191,4 +191,4 @@ private End; hash_; -End; +End; \ No newline at end of file diff --git a/funcext/TSOffice/document/TTableContent.tsf b/funcext/TSOffice/document/TTableContent.tsf index dfabac7..fd9d29c 100644 --- a/funcext/TSOffice/document/TTableContent.tsf +++ b/funcext/TSOffice/document/TTableContent.tsf @@ -20,18 +20,19 @@ Type TTableContent = class Begin defultFont := impl_.stdPr.rPr; defultFont.rFont.cstheme := 'minorBidi'; - defultFont.rFont.eastAsia := '宋体'; - defultFont.rFont.hAnsi := '宋体'; - defultFont.rFont.ascii := '宋体'; + defultFont.rFont.XMLeastAsia := '宋体'; + defultFont.rFont.XMLhAnsi := '宋体'; + defultFont.rFont.XMLascii := '宋体'; //defultFont.kern := 2; defultFont.Size := 21; defultFont.SzCs := 24; defultFont.Lang := 'en-US'; defultFont.bidi := 'ar-SA'; defultFont.eastAsia := 'zh-CN'; + defultFont.Color := 'DBDBDB'; defultFormat := impl_.stdPr; defultFormat.ID := integer(time()*24*3600); - defultFormat.Color := 'DBDBDB'; + //defultFormat.Color := 'DBDBDB'; defultFormat.docPartObj.docPartGallery := 'Table of Contents'; defultFormat.docPartObj.docPartUnique := 1; //impl_.stdEndPr.rPr.Size := 20; @@ -68,7 +69,7 @@ Type TTableContent = class mParagraph.pPr.LeftChars := 0; mParagraph.pPr.LeftIndent := 0; mParagraph.Run.T := '目录'; - mParagraph.Run.rPr.Name := '宋体'; + mParagraph.Run.rPr.SetName('宋体', true); mParagraph.Run.rPr.Size := 21; mParagraph.Run.rPr.Bold := true; _AddStdContent(mParagraph); @@ -154,7 +155,7 @@ Type TTableContent = class //目录条目文字内容 r7 := p.AddRun(); - r7.Font.Name := '宋体'; + r7.Font.SetName('宋体', true); numStr := ''; //数字项目编号 if r[i]['numId'] then Begin style := docx_.NumberingObject().NumberStyle(r[i]['numId']);//支持数字、字符串StyleId diff --git a/更新日志.md b/更新日志.md index 5c0fb84..edd6b2b 100644 --- a/更新日志.md +++ b/更新日志.md @@ -1,5 +1,13 @@ # 更新日志 +## 2023-1-11 + +### V1.0.8 + +#### word + +1. 修复`copyFormat`和`AddTableContent` + ## 2023-1-10 ### V1.0.7