{"id":299674,"date":"2020-03-04T21:00:09","date_gmt":"2020-03-04T21:00:09","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=299674"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=299674","title":{"rendered":"\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f rtf \u0432 xml \u043d\u0430 \u0421#"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/491110\/\">\n<p>\u0412 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0438 \u0441\u0435\u0440\u0438\u0438 \u043f\u043e\u0441\u0442\u043e\u0432 \u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 xml \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0421# \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 <strong><em>rtf<\/em><\/strong>. <\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0434\u0430\u043d\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0434\u0440\u0435\u0432\u043d\u0438\u0439, \u043f\u0440\u0438\u0447\u0435\u043c \u0432\u0435\u0441\u044c\u043c\u0430 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0439 \u0438, \u0435\u0441\u043b\u0438 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u0438 \u043d\u0435\u0442 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 xml \u043f\u0443\u0442\u0435\u043c \u0432\u044b\u0437\u043e\u0432\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430, \u0442\u043e \u0443\u0436 \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u0442 Microsoft \u0442\u043e\u0447\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c, \u0445\u043e\u0442\u044f \u0431\u044b \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0435 OpenXML. \u041e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u0431\u044b \u0431\u044b\u043b\u043e \u043e\u043d\u043e \u0442\u0430\u043a, \u0442\u043e \u0434\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u0431\u044b\u043b\u0430 \u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u0447\u0442\u043e \u0438\u0437 \u0441\u0435\u0431\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0444\u0430\u0439\u043b \u0444\u043e\u0440\u043c\u0430\u0442\u0430 <strong><em>ReachTextFile (rtf)<\/em><\/strong>? \u041f\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u043c\u0443 \u0441\u0447\u0435\u0442\u0443, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 \u0443\u0436\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0438 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438 \u0447\u0435\u043c-\u0442\u043e \u0434\u0430\u0436\u0435 \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 \u0441\u043c\u0435\u0441\u044c json, xml \u0438 xpath. \u0412 \u044d\u0442\u043e\u043c \u043b\u0435\u0433\u043a\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0432 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0432\u043e\u0440\u0434\u043e\u0432\u0441\u043a\u0438\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 <em>rtf<\/em>, \u0430 \u043f\u043e\u0442\u043e\u043c \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 \u0442\u0438\u043f\u0430 <em>Notepad++<\/em>:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/8m\/b3\/li\/8mb3li9-qvtjhwpdvf2ftbuhfim.png\"><\/p>\n<p>  <\/p>\n<p>\u042f \u0432\u044b\u0434\u0435\u043b\u0438\u043b \u043a\u0440\u0430\u0441\u043d\u044b\u043c \u043a\u0443\u0441\u043e\u043a \u0444\u0430\u0439\u043b\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0435: \u0432 \u043e\u0431\u0449\u0435\u043c, \u0442\u0435\u0433\u0438 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u044b \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u043e\u0439 ansi, \u0430 \u0441\u0430\u043c \u0442\u0435\u043a\u0441\u0442 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u043e\u0439 ansicpg1251. \u0421\u0430\u043c \u0436\u0435 \u0442\u0435\u043a\u0441\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ww\/9o\/1r\/ww9o1rm_ou0vzllefyqgqm8wyc0.png\"><\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u0440\u043e\u0447\u0435, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043f\u043e \u0442\u0435\u0433\u0430\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u0433\u0434\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043d\u0443\u0436\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442, \u043f\u043e\u0442\u043e\u043c \u0435\u0433\u043e \u043f\u043e\u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c\u2026 \u0418, \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u0434\u0430\u0436\u0435 \u0435\u0441\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0438 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f <a href=\"https:\/\/habr.com\/ru\/post\/70119\/\">\u0441\u0442\u0430\u0442\u044c\u044f<\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u043a\u0430\u043a \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043f\u0440\u0430\u0432\u0434\u0430 \u043d\u0430 <em>php<\/em>. <\/p>\n<p>  <\/p>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c, \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0447\u0443\u0433\u0443\u043d\u043d\u043e\u0433\u043e \u0441\u0438\u0434\u0430\u043b\u0438\u0449\u0430, \u043a\u0430\u043f\u0435\u043b\u044c \u0412\u0438\u0437\u0438\u043d \u0438 \u044d\u0442\u0438\u043b\u043e\u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0433\u043e \u043f\u043e\u0439\u043b\u0430, \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e, \u043d\u043e \u0432\u0440\u044f\u0434 \u043b\u0438 \u0431\u0438\u0437\u043d\u0435\u0441 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442 \u0412\u0430\u043c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043a\u0430\u043a\u0438\u0445-\u043d\u0438\u0431\u0443\u0434\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439. <\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u0443\u043c, \u0438 \u0447\u0442\u043e \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0433\u0443\u0433\u043e\u043b, \u044d\u0442\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 rtf \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>RichTextBox<\/code>, \u043e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0438\u043c\u0435\u0435\u0442 \u0440\u044f\u0434 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432: <\/p>\n<p>  <\/p>\n<ul>\n<li>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u044d\u0442\u043e \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u0441 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c <code>Windows.Forms<\/code>, \u0447\u0442\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0440\u0430\u0437\u0434\u0443\u0432\u0430\u0435\u0442 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. <\/li>\n<li>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u043c. \u0422\u0430\u043a, <code>RichTextBox<\/code> \u0432\u0441\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a \u043f\u0440\u043e\u0441\u0442\u043e\u043c\u0443 \u0442\u0435\u043a\u0441\u0442\u0443, \u0430 \u044f\u0447\u0435\u0439\u043a\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442 \u043d\u0435 \u0442\u0435\u0433\u0430\u043c\u0438, \u0430 \u0442\u0430\u0431\u0430\u043c\u0438 \u0438 \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0447\u0435\u0440\u0435\u0437 nuget \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <strong><em>RtfPipe<\/em><\/strong>. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u044d\u0442\u0443 \u043b\u0438\u0431\u0443 \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/github.com\/erdomke\/RtfPipe\" rel=\"nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <em>RtfPipe<\/em> \u043f\u0440\u0438\u0437\u0432\u0430\u043d\u0430 \u0440\u0435\u0448\u0430\u0442\u044c \u043e\u0434\u043d\u0443 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443. \u041e\u043d\u0430 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 <strong>rtf <\/strong>\u0432 <strong>html<\/strong>. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0443\u044e\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0443 \u043e\u0442 \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0445 \u0442\u0435\u0433\u043e\u0432, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u043e\u0433\u043e \u0436\u0435 <em>HtmlAgilityPack<\/em>. <\/p>\n<p>  <\/p>\n<p>\u0421\u043f\u0440\u043e\u0441\u0438\u0442\u0435, \u0437\u0430\u0447\u0435\u043c \u0442\u0430\u043a \u0432\u0441\u0435 \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0442\u044c \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435\u043b\u044c\u0437\u044f \u043a\u0430\u043a-\u0442\u043e \u043f\u043e\u043f\u0440\u043e\u0449\u0435? \u041d\u0430 \u0447\u0442\u043e \u044f \u043e\u0442\u0432\u0435\u0447\u0443: <del>\u044f \u0443\u0441\u0442\u0430\u043b, \u044f \u0443\u0445\u043e\u0436\u0443<\/del> \u0430 \u0432\u043e\u0442 \u043d\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u043d\u0443 \u0438\u043b\u0438, \u0432\u043e \u0432\u0441\u044f\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u044f \u0438\u0445 \u043d\u0435 \u043d\u0430\u0448\u0435\u043b. \u0410 \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 rtf-\u0444\u0430\u0439\u043b \u043f\u043e\u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u043e, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044f, \u0447\u0442\u043e \u0437\u0430 \u0442\u0435\u0433 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b\u0441\u044f \u0438 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u043e\u043d \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u043c, \u0434\u0435\u0448\u0438\u0444\u0440\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043d\u0443\u0436\u043d\u043e\u0439 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0435, \u0430 \u043f\u043e\u0442\u043e\u043c \u0435\u0449\u0435 \u0438 \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u0432 \u043d\u0443\u0436\u043d\u044b\u0435 \u0442\u0435\u0433\u0438 \u2014 \u044d\u0442\u043e, \u0438\u0437\u0432\u0438\u043d\u0438\u0442\u0435, \u0443\u0436 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430, \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0430\u044f \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0434\u0440\u0443\u0433\u0438\u0445, \u0438 \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435 \u043e\u0431\u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445, \u0437\u0430\u0442\u0440\u0430\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u0434\u0435\u043d\u0435\u0433.<\/p>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u043a\u043e\u0434\u0443.<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">public string Convert(Stream stream)         {             stream.Position = 0;             string rtf = string.Empty;             using (StreamReader sr = new StreamReader(stream))             {                 rtf = sr.ReadToEnd();             }             \/\/ \u042d\u0442\u0430 \u0441\u0442\u0440\u043e\u0447\u043a\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b RtfPipe \u0432 Core              Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);             \/\/ \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043b\u0438\u0431\u044b RtfPipe \u0441\u043e\u0437\u0434\u0430\u0435\u043c html             var html = Rtf.ToHtml(rtf);             \/\/ \u043e\u0447\u0438\u0449\u0430\u0435\u043c html \u043e\u0442 \u043b\u0438\u0448\u043d\u0438\u0445 \u0442\u0435\u0433\u043e\u0432 \u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043c \u0433\u043e\u0442\u043e\u0432\u0443\u044e xml             return ClearHtml(html);         }<\/code><\/pre>\n<p>  <\/p>\n<ol>\n<li>\u0421\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043f\u043e\u0442\u043e\u043a\u0430 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0438\u043f\u0430 string. \u042d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 <code>RtfPipe<\/code>. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0432 \u043d\u0435\u0439 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043f\u043e\u0442\u043e\u043a \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430<\/li>\n<li>\u0414\u0430\u043b\u0435\u0435, \u0435\u0441\u043b\u0438 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434 .Net Core <u>\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e <\/u>\u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u043e\u0442 \u044d\u0442\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 <code>Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);<\/code>. \u041e\u0431 \u044d\u0442\u043e\u043c \u043f\u0440\u044f\u043c\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 RtfPipe. \u041c\u043e\u0436\u0435\u0442\u0435 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u043f\u0435\u0440\u0435\u0439\u0434\u044f \u043f\u043e <a href=\"https:\/\/github.com\/erdomke\/RtfPipe\" rel=\"nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a>.<br \/>  \u0415\u0441\u043b\u0438 \u0412\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 .Net Framework, \u0442\u043e \u043e\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0438\u043b\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f.<\/li>\n<li><code>var html = Rtf.ToHtml(rtf);<\/code> \u2014 \u0432 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0441 \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u0440\u0438\u043b\u0438\u0447\u043d\u043e\u0439 html \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u043e\u0439. \u041e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0432 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0435, \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u0442\u0435\u0433\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u0430 (\u0435\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435), \u043d\u043e \u0438 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u044f\u0442\u044c \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u0435.<\/li>\n<\/ol>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gi\/a9\/7x\/gia97x3knsms05eekeqlv1nbtgi.png\"><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0432 \u043c\u0435\u0442\u043e\u0434 <code>string ClearHtml(string html)<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0435\u0440\u043d\u0435\u0442 \u043d\u0430\u043c \u0447\u0438\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 <em>xml<\/em>:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">string ClearHtml(string html) {     \/\/ \u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c html \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e HtmlAgilityPack     HtmlDocument doc = new HtmlDocument();     doc.LoadHtml(html);     \/\/ \u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 (\u0442\u0435\u0433\u043e\u0432), \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0435\u0441\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 style     var elementsWithStyleAttribute = doc.DocumentNode.SelectNodes(&quot;\/\/@style&quot;);     \/\/ \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u0442\u0435\u0433\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u044b      var excessNodes = doc.DocumentNode.SelectNodes(&quot;\/\/b|\/\/u|\/\/strong|\/\/br&quot;);     \/\/ \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u043b\u0438\u0448\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 html     foreach (var element in excessNodes)     {         element.ParentNode.InnerHtml = element.InnerText;         element.Remove();     }     foreach (var element in elementsWithStyleAttribute)     {         element.Attributes[&quot;style&quot;].Remove();     }     \/\/ \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 html     using (StringWriter writer = new StringWriter())     {         doc.Save(writer);         html = writer.ToString();     }     \/\/ \u043f\u0438\u0448\u0435\u043c \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 html \u0432 xml     StringBuilder xml = new StringBuilder();     xml.Append(&quot;&lt;?xml version=\\&quot;1.0\\&quot;?&gt;&lt;documents&gt;&lt;document&gt;&quot;);     xml.Append(html);     xml.Append(&quot;&lt;\/documents&gt;&lt;\/document&gt;&quot;);     return xml.ToString(); }<\/code><\/pre>\n<p>  <\/p>\n<ol>\n<li>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c HtmlAgilityPack \u0447\u0435\u0440\u0435\u0437 nuget<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <code>doc<\/code> \u0442\u0438\u043f\u0430 <code>HtmlDocument<\/code> \u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043d\u0430\u0448\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 <code>html<\/code><\/li>\n<li>\u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0438\u0437 \u0442\u0435\u0433\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435, \u043f\u043e \u043d\u0430\u0448\u0435\u043c\u0443 \u043c\u043d\u0435\u043d\u0438\u044e \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043b\u0438\u0448\u043d\u0438\u043c\u0438. \u042f \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u044d\u0442\u043e \u0442\u0435\u0433\u0438 \u0441 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c <code>style<\/code>, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u044b \u0443\u0434\u0430\u043b\u0438\u043c \u044d\u0442\u043e\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0442\u0435\u0433\u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0432\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0443\u0434\u0430\u043b\u0438\u043c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e, \u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u0432 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435.<\/li>\n<li>C\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 \u0438, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>StringBuilder<\/code> \u043e\u0444\u043e\u0440\u043c\u043b\u044f\u0435\u043c \u0432 \u0432\u0438\u0434\u0435 xml, \u043e\u0431\u0435\u0440\u043d\u0443\u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0442\u0435\u0433\u0438.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a\u043e\u0435 \u043a\u043e\u0440\u043e\u0442\u0435\u043d\u044c\u043a\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u044c\u0438\u0446\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435, \u043a\u0430\u043a \u043d\u0438 \u0441\u0442\u0440\u0430\u043d\u043d\u043e, \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0442\u0440\u0443\u0434\u043d\u043e \u0433\u0443\u0433\u043b\u0438\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<p>\u041e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u043b\u043d\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/github.com\/ipetrovanton\/OfficeToXml\/blob\/master\/ConverterToXml\/Converters\/RtfToXml.cs\" rel=\"nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 <strong>docx<\/strong> \u0438 <strong>xlsx<\/strong> \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 <a href=\"https:\/\/habr.com\/ru\/post\/491090\/\">\u0437\u0434\u0435\u0441\u044c<\/a><\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/491110\/\"> https:\/\/habr.com\/ru\/post\/491110\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/491110\/\">\n<p>\u0412 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0438 \u0441\u0435\u0440\u0438\u0438 \u043f\u043e\u0441\u0442\u043e\u0432 \u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 xml \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0421# \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 <strong><em>rtf<\/em><\/strong>. <\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0434\u0430\u043d\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0434\u0440\u0435\u0432\u043d\u0438\u0439, \u043f\u0440\u0438\u0447\u0435\u043c \u0432\u0435\u0441\u044c\u043c\u0430 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0439 \u0438, \u0435\u0441\u043b\u0438 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u0438 \u043d\u0435\u0442 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 xml \u043f\u0443\u0442\u0435\u043c \u0432\u044b\u0437\u043e\u0432\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430, \u0442\u043e \u0443\u0436 \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u0442 Microsoft \u0442\u043e\u0447\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c, \u0445\u043e\u0442\u044f \u0431\u044b \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0435 OpenXML. \u041e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u0431\u044b \u0431\u044b\u043b\u043e \u043e\u043d\u043e \u0442\u0430\u043a, \u0442\u043e \u0434\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u0431\u044b\u043b\u0430 \u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-299674","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/299674","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=299674"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/299674\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=299674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=299674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=299674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}