{"id":4984,"date":"2024-03-04T18:01:01","date_gmt":"2024-03-04T10:01:01","guid":{"rendered":""},"modified":"2024-03-04T18:01:01","modified_gmt":"2024-03-04T10:01:01","slug":"\u89e3\u6790word\u6587\u4ef6\u7684\u7b80\u5355\u5b9e\u73b0","status":"publish","type":"post","link":"https:\/\/mushiming.com\/4984.html","title":{"rendered":"\u89e3\u6790word\u6587\u4ef6\u7684\u7b80\u5355\u5b9e\u73b0"},"content":{"rendered":"

\n <\/path> \n<\/svg> <\/p>\n

\u4e00\u3001\u4e86\u89e3word\u7ed3\u6784<\/h4>\n
\n

\u6587\u7ae0\uff1a\u300aOffice\u6587\u4ef6\u683c\u5f0f\u57fa\u7840\u77e5\u8bc6\u300b\u3001\u300aAnatomy of a WordProcessingML File\u300b<\/p>\n<\/blockquote>\n

office 97-03<\/h5>\n

office 97-03\u7684\u5b58\u50a8\u89c4\u8303\u4e3aOLE\u3002\u5b83\u662fCOM\u5bf9\u8c61\u7684\u5b50\u96c6\uff0c\u662f\u4e00\u79cd\u5bf9\u8c61\u94fe\u63a5\u548c\u5d4c\u5165\u7684\u6280\u672f\uff0c\u8be5\u6280\u672f\u53ef\u4ee5\u5305\u542b\u6587\u672c\uff0c\u56fe\u5f62\uff0c\u7535\u5b50\u8868\u683c\u751a\u81f3\u5176\u4ed6\u4e8c\u8fdb\u5236\u6570\u636e\u3002<\/p>\n

OLE\u5bf9\u8c61\u7531\u5bf9\u8c61\u5934\uff08ObjectHeader\uff09\u548c\u6570\u636e\u6d41\uff08ObjectStream\uff09\u7ec4\u6210\u3002<\/p>\n

\uff081\uff09\u5bf9\u8c61\u5934\u5404\u5b57\u6bb5\u89e3\u6790\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n\n\n\n\n\n\n\n\n\n
\u6570\u636e<\/th>\n\u89e3\u91ca<\/th>\n<\/tr>\n<\/thead>\n
01050000<\/td>\nOLE Version<\/td>\n<\/tr>\n
02000000<\/td>\nFormat ID<\/td>\n<\/tr>\n
09000000<\/td>\nProgName Size\uff080x09\uff09<\/td>\n<\/tr>\n
4f4c45324c696e6b00<\/td>\nProgName (OLE2Link)<\/td>\n<\/tr>\n
000a0000<\/td>\nData Size<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\uff082\uff09\u5bf9\u8c61\u5934\u548c\u6570\u636e\u6d41\u901a\u8fc7d0cf11e0a1b11ae1<\/code>\u5206\u9694
\uff083\uff09\u89e3\u6790\u6570\u636e\u6d41\u7684\u65f6\u5019\u9700\u8981\u5c06ascii\u8f6c\u6362\u6210hex<\/p>\n

office 07-*<\/h5>\n

Doc\u6587\u4ef6\u7684\u683c\u5f0f\u89c4\u8303\u4e3aOpenXML\uff08OOXML\uff09\uff0c\u662f\u5fae\u8f6f\u5728Office 2007\u4e2d\u63d0\u51fa\u7684\u4e00\u79cd\u65b0\u7684\u6587\u6863\u683c\u5f0f\u3002
Office 2007\u4e2d\u7684Word\u3001Excel\u3001PowerPoint\u9ed8\u8ba4\u5747\u91c7\u7528OpenXML\u683c\u5f0f\u3002OpenXML\u57282006\u5e7412\u6708\u6210\u4e3a\u4e86ECMA\u89c4\u8303\u7684\u4e00\u90e8\u5206\uff0c\u7f16\u53f7\u4e3aECMA376\uff1b\u5e76\u4e8e2008\u5e744\u6708\u901a\u8fc7\u56fd\u9645\u6807\u51c6\u5316\u7ec4\u7ec7\u7684\u8868\u51b3\uff0c\u5e76\u4e8e\u4e24\u4e2a\u6708\u540e\u516c\u5e03\u4e3aISO\uff0fIEC 29500\u56fd\u9645\u6807\u51c6\u3002<\/p>\n

Doc\u6587\u4ef6\u5b9e\u9645\u4e0a\u4e00\u4e2a\u538b\u7f29\u5305\uff0c\u53ef\u4ee5\u89e3\u538b\u4e3a\u76ee\u5f55\u3002\u76ee\u5f55\u7ed3\u6784\u5982\u4e0b\uff1a<\/p>\n

    \n
  • _rels\u6587\u4ef6\u5939\uff1a\u5b58\u653e\u4e86\u6240\u6709\u6307\u5b9a\u7684rels\u6587\u4ef6<\/li>\n
  • docProps\u6587\u4ef6\u5939\uff1a\u5b58\u653e\u4e86docx\u6587\u6863\u7684\u4e3b\u8981\u5c5e\u6027\u4fe1\u606f<\/li>\n
  • word\u6587\u4ef6\u5939\uff1a\u5b58\u653e\u4e86docx\u6587\u6863\u7684\u5177\u4f53\u5185\u5bb9<\/li>\n
  • [Content_Types].xml\uff1a\u63cf\u8ff0\u7684\u662f\u6574\u4e2a\u6587\u6863\u5185\u5bb9\u7684\u7c7b\u578b\uff0c\u628a\u5404\u4e2axml\u6587\u4ef6\u7ec4\u5408\u6210\u4e00\u4e2a\u6574\u4f53<\/li>\n<\/ul>\n

    \u4e8c\u3001\u521d\u6b65\u63a2\u7d22<\/h4>\n
      \n
    1. \n

      \u65b0\u5efaword\u6587\u6863\uff0c\u8f93\u5165\u4e00\u4e9b\u5185\u5bb9\uff08\u6700\u597d\u662f\u6709\u89c4\u5f8b\uff0c\u6613\u8fa8\u8bc6\u7684\u5185\u5bb9\uff09\uff1a\u6b63\u6587\u3001\u6587\u672c\u6846\u3001\u8868\u683c\u3001\u5728\u7b2c\u4e8c\u9875\u518d\u8f93\u5165\u6b63\u6587
      \"\u89e3\u6790word\u6587\u4ef6\u7684\u7b80\u5355\u5b9e\u73b0<\/p>\n<\/li>\n

    2. \n

      \u4fee\u6539word\u540e\u7f00\u4e3azip\uff0c\u89e3\u538b\u7f29\u540e\u4f1a\u53d1\u73b0\u6587\u4ef6\u683c\u5f0f\u786e\u5b9e\u5982\u7b2c\u4e00\u8282\u4e2d\u6240\u8ff0
      \"\u89e3\u6790word\u6587\u4ef6\u7684\u7b80\u5355\u5b9e\u73b0
      \"\u89e3\u6790word\u6587\u4ef6\u7684\u7b80\u5355\u5b9e\u73b0<\/p>\n<\/li>\n

    3. \n

      \u6253\u5f00\u6bcf\u4e2axml\u6587\u4ef6\uff0c\u641c\u7d22\u5728\u7b2c1\u6b65\u8f93\u5165\u7684\u5185\u5bb9\uff0c\u5bfb\u627e\u5185\u5bb9\u4e0exml\u7684\u5bf9\u5e94\u5173\u7cfb\u3002
      \"\u89e3\u6790word\u6587\u4ef6\u7684\u7b80\u5355\u5b9e\u73b0<\/p>\n<\/li>\n<\/ol>\n

      \u5927\u81f4\u53ef\u4ee5\u5f97\u51fa\u7ed3\u8bba\uff1aword\u7684\u4e3b\u8981\u5185\u5bb9\u5b58\u5728word\\document.xml<\/code>\u4e2d\u3002\u5982\u679c\u53ea\u8981\u89e3\u6790\u6b63\u6587\u4e2d\u7684\u5185\u5bb9\uff0c\u76f4\u63a5\u89e3\u6790\u8fd9\u4e2axml\u6587\u4ef6\u5373\u53ef\u3002<\/strong><\/p>\n

      \u5982\u679c\u60f3\u9875\u7709\u548c\u9875\u811a\u7684\u6587\u5b57\u5185\u5bb9\uff0c\u5219\u9700\u8981\u53e6\u5916\u89e3\u6790word\\header1.xml<\/code>\u548cword\\foot1.xml<\/code>\u7b49\u6587\u4ef6\u3002<\/em><\/p>\n

      \u4e09\u3001\u89e3\u6790document.xml\u6587\u4ef6\uff0c\u8bfb\u53d6doc\u4e2d\u7684\u6587\u5b57<\/h4>\n

      \u6587\u5b57\u53ef\u80fd\u5b58\u5728\u4e8e\u6b63\u6587\uff08\u6bb5\u843d\uff09\u3001\u8868\u683c\u3001\u6587\u672c\u6846\u7b49\u4f4d\u7f6e\u3002<\/p>\n

      \u6b63\u6587\uff08\u6bb5\u843d\uff09\u4e2d\u7684\u6587\u5b57\u76f4\u63a5\u8bfb\u53d6XMLStreamConstants.CHARACTERS\u7c7b\u578b\u7684\u5185\u5bb9\u5373\u53ef\u83b7\u53d6\u3002<\/p>\n

      \u4f46\u662f\u5982\u679c\u6587\u6863\u4e2d\u6df7\u5408\u4e86\u8868\u683c\u548c\u6587\u672c\u6846\u7684\u5143\u7d20\uff0c\u5219\u76f4\u63a5\u83b7\u53d6\u4f1a\u51fa\u73b0\u4ee5\u4e0b\u95ee\u9898\uff1a<\/p>\n

        \n
      1. \u8868\u683c\u4f1a\u5931\u53bb\u5f62\u72b6\uff0c\u8868\u683c\u4e2d\u6bcf\u4e2a\u5355\u5143\u683c\u7684\u6587\u672c\u90fd\u4f1a\u5360\u4e00\u884c<\/li>\n
      2. \u6587\u672c\u6846\u4e2d\u7684\u6587\u672c\u4f1a\u591a\u6b21\u51fa\u73b0\uff0c\u539f\u56e0\u662f\u9ad8\u7248\u672c\u7684docx\u6587\u4ef6\u4e3a\u4e86\u517c\u5bb9\u4f4e\u7248\u672c\u7684word\u628a\u6587\u672c\u6846\u4e2d\u7684\u5185\u5bb9\u5b58\u4e86\u591a\u4efd<\/li>\n<\/ol>\n

        \u95ee\u98981\u7684\u89e3\u51b3\u65b9\u6cd5\uff1a
        \u6839\u636e\u7ed3\u675f\u6807\u7b7e\u7684\u4e0d\u540c\uff0c\u6267\u884c\u4e0d\u540c\u7684\u52a8\u4f5c\uff1a<\/p>\n

          \n
        • \u6b63\u6587\u4e2d\u7684\u6bb5\u843d\u7ed3\u675f\u6807\u8bb0\uff1a\u6253\u5370\u5185\u5bb9<\/li>\n
        • \u8868\u683c\u4e2d\u5355\u5143\u683c\u7ed3\u675f\u6807\u8bb0\uff1a\u8ffd\u52a0\\t<\/li>\n
        • \u8868\u683c\u4e2d\u884c\u7ed3\u675f\u6807\u8bb0\uff1a\u8ffd\u52a0\\n<\/li>\n
        • \u8868\u683c\u7ed3\u675f\u6807\u8bb0\uff1a\u6253\u5370\u5185\u5bb9<\/li>\n<\/ul>\n

          \u95ee\u98982\u7684\u89e3\u51b3\u65b9\u6cd5\uff1a<\/p>\n

            \n
          1. \u5f53\u9047\u5230\u4e0d\u5e0c\u671b\u89e3\u6790\u7684\u8282\u70b9\u7684\u5f00\u59cb\u6807\u7b7e\u65f6\uff0c\u5f00\u542f\u5c4f\u853d\u6807\u8bb0<\/li>\n
          2. \u5f00\u542f\u5c4f\u853d\u6807\u8bb0\u4e4b\u540e\uff0c\u4e0d\u5728\u6536\u96c6\u5185\u5bb9\u8282\u70b9<\/li>\n
          3. \u76f4\u5230\u9047\u5230\u8be5\u8282\u70b9\u7684\u7ed3\u675f\u6807\u7b7e\u65f6\uff0c\u5173\u95ed\u5c4f\u853d\u6807\u8bb0<\/li>\n<\/ol>\n

            \u56db\u3001\u5b8c\u6574\u4ee3\u7801<\/h4>\n
            import<\/span> javax.<\/span>xml.<\/span>namespace.<\/span>QName;<\/span>\nimport<\/span> javax.<\/span>xml.<\/span>stream.<\/span>XMLEventReader;<\/span>\nimport<\/span> javax.<\/span>xml.<\/span>stream.<\/span>XMLInputFactory;<\/span>\nimport<\/span> javax.<\/span>xml.<\/span>stream.<\/span>XMLStreamConstants;<\/span>\nimport<\/span> javax.<\/span>xml.<\/span>stream.<\/span>XMLStreamException;<\/span>\nimport<\/span> javax.<\/span>xml.<\/span>stream.<\/span>events.<\/span>Characters;<\/span>\nimport<\/span> javax.<\/span>xml.<\/span>stream.<\/span>events.<\/span>EndElement;<\/span>\nimport<\/span> javax.<\/span>xml.<\/span>stream.<\/span>events.<\/span>StartElement;<\/span>\nimport<\/span> javax.<\/span>xml.<\/span>stream.<\/span>events.<\/span>XMLEvent;<\/span>\nimport<\/span> java.<\/span>io.<\/span>*;<\/span>\nimport<\/span> java.<\/span>nio.<\/span>charset.<\/span>Charset;<\/span>\nimport<\/span> java.<\/span>util.<\/span>Enumeration;<\/span>\nimport<\/span> java.<\/span>util.<\/span>HashSet;<\/span>\nimport<\/span> java.<\/span>util.<\/span>Set;<\/span>\nimport<\/span> java.<\/span>util.<\/span>zip.<\/span>ZipEntry;<\/span>\nimport<\/span> java.<\/span>util.<\/span>zip.<\/span>ZipFile;<\/span>\n\n\/** * \u89e3\u6790word\u6587\u6863\uff0c\u6253\u5370\u51fa\u6587\u4ef6\u4e2d\u7684\u5185\u5bb9\uff08\u76ee\u524d\u53ea\u652f\u63012010\u7248word\u6587\u4ef6\uff09 * <p> * \u652f\u6301\u6b63\u6587\uff08\u6bb5\u843d\uff09\u3001\u8868\u683c\u3001\u6587\u672c\u6846 * <p> * \u6ce8\uff1a\u8868\u683c\u6253\u5370\u540e\u4ecd\u7136\u53ef\u4ee5\u4fdd\u6301\u57fa\u672c\u5f62\u72b6 *\/<\/span>\npublic<\/span> class<\/span> ParseWord<\/span> { \n   <\/span>\n\n    \/** * \u662f\u5426\u5f00\u542f\u8c03\u8bd5 *\/<\/span>\n    private<\/span> static<\/span> boolean<\/span> DEBUG =<\/span> <\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"\u89e3\u6790word\u6587\u4ef6\u7684\u7b80\u5355\u5b9e\u73b0\u4e00\u3001\u4e86\u89e3word\u7ed3\u6784\u63a8\u8350\u6587\u7ae0\uff1a\u300aOffice\u6587\u4ef6\u683c\u5f0f\u57fa\u7840\u77e5\u8bc6\u300b\u3001\u300aAnatomyofaWordProcessingMLFile\u300boffice9...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/4984"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=4984"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/4984\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=4984"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=4984"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=4984"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}