Ms word rtf文件格式更改

Ms word rtf文件格式更改,ms-word,rtf,file-format,Ms Word,Rtf,File Format,我想知道一些关于富文本格式的有趣细节 下面是在记事本中打开的富文本格式内容示例 {\rtf1\mac\deff2 {\fonttbl{\f0\fswiss Chicago;}{\f2\froman New York;}{\f3\fswiss Geneva;}{\f4\fmodern Monaco;}{\f11\fnil Cairo;}{\f13\fnil Zapf Dingbats;}{\f16\fnil Palatino;}{\f18\fnil Zapf Chancery;}{\f20\fro

我想知道一些关于富文本格式的有趣细节 下面是在记事本中打开的富文本格式内容示例

{\rtf1\mac\deff2 {\fonttbl{\f0\fswiss Chicago;}{\f2\froman New York;}{\f3\fswiss Geneva;}{\f4\fmodern Monaco;}{\f11\fnil Cairo;}{\f13\fnil Zapf Dingbats;}{\f16\fnil Palatino;}{\f18\fnil Zapf Chancery;}{\f20\froman Times;}{\f21\fswiss Helvetica;}
{\f22\fmodern Courier;}{\f23\ftech Symbol;}{\f24\fnil Mobile;}{\f100\fnil FoxFont;}{\f107\fnil MathMeteor;}{\f164\fnil Futura;}{\f1024\fnil American Heritage;}{\f2001\fnil Arial;}{\f2005\fnil Courier New;}{\f2010\fnil Times New Roman;}
{\f2011\fnil Wingdings;}{\f2515\fnil MT Extra;}{\f3409\fnil FoxPrint;}{\f11132\fnil InsigniaLQmono;}{\f11133\fnil InsigniaLQprop;}{\f14974\fnil LB Helvetica Black;}{\f14976\fnil L Helvetica Light;}}{\colortbl\red0\green0\blue0;\red0\green0\blue255;
\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;}{\stylesheet{\f4\fs18 \sbasedon222\snext0 Normal;}}{\info{\title samplepostscript.msw}{\author 
Computer Science Department}}\widowctrl\ftnbj \sectd \sbknone\linemod0\linex0\cols1\endnhere \pard\plain \qc \f4\fs18 {\plain \b\f21 Sample Rich Text Format Document\par 
}\pard {\plain \f20 \par 
}\pard \ri-80\sl-720\keep\keepn\absw570 {\caps\f20\fs92\dn6 T}{\plain \f20 \par 
}\pard \qj {\plain \f20 his is a sample rich text format (RTF), document. This document was created using Microsoft Word and then printing the document to a RTF file. It illustrates the very basic text formatting effects that can be achieved using RTF. 
\par 
\par 
}\pard \qj\li1440\ri1440\box\brdrs \shading1000 {\plain \f20 RTF }{\plain \b\f20 contains codes for producing advanced editing effects. Such as this indented, boxed, grayed background, entirely boldfaced paragraph.\par 
}\pard \qj {\plain \f20 \par 
Microsoft  Word developed RTF for document transportability and gives a user access to the complete set of the effects that can be achieved using RTF. \par 
}}
在MS word中编辑此文件后,它发生了很大的变化。我没有通过在MS word中打开来删除或添加任何内容。我删除了单词“图解”(可以在上面的rtf文件中看到),然后再次将单词添加回相同的位置。因此,文件内容没有任何更改。但在保存文件后,我在文本编辑器中打开了它,并做了很多更改

\par }\pard \ltrpar\ql \li0\ri-80\sl-720\slmult0\keep\keepn\widctlpar\absw570\wrapdefault\faauto\rin-80\lin0\itap0 {\rtlch\fcs1 \af46\afs92 \ltrch\fcs0 \caps\f46\fs92\dn6\insrsid1866410 \hich\af46\dbch\af31505\loch\f46 T}{\rtlch\fcs1 \af46\afs24 \ltrch\fcs0 
\f46\fs24\insrsid1866410 
\par }\pard \ltrpar\qj \li0\ri0\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af46\afs24 \ltrch\fcs0 \f46\fs24\insrsid1866410 \hich\af46\dbch\af31505\loch\f46 
his is a sample rich text format (RTF), document. This document was created using Microsoft Word and then printing the document to a RTF file. It }{\rtlch\fcs1 \af46\afs24 \ltrch\fcs0 \f46\fs24\insrsid1866410 \hich\af46\dbch\af31505\loch\f46 illustrates }
{\rtlch\fcs1 \af46\afs24 \ltrch\fcs0 \f46\fs24\insrsid1866410 \hich\af46\dbch\af31505\loch\f46 the very basic text formatting effects that can be achieved using RTF. 
\par 
\par }\pard \ltrpar\qj \li1440\ri1440\widctlpar\brdrt\brdrs\brdrw15 \brdrl\brdrs\brdrw15 \brdrb\brdrs\brdrw15 \brdrr\brdrs\brdrw15 \wrapdefault\faauto\rin1440\lin1440\itap0 \shading1000 {\rtlch\fcs1 \af46\afs24 \ltrch\fcs0 \f46\fs24\insrsid1866410 
\hich\af46\dbch\af31505\loch\f46 RTF }{\rtlch\fcs1 \ab\af46\afs24 \ltrch\fcs0 \b\f46\fs24\insrsid1866410 \hich\af46\dbch\af31505\loch\f46 contains codes for pr\hich\af46\dbch\af31505\loch\f46 
oducing advanced editing effects. Such as this indented, boxed, grayed background, entirely boldfaced paragraph.
 \par }\pard \ltrpar\qj \li0\ri0\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af46\afs24 \ltrch\fcs0 \f46\fs24\insrsid1866410 
主要的变化是以下几行

}\pard \qj {\plain \f20 his is a sample rich text format (RTF), document. This document was created using Microsoft Word and then printing the document to a RTF file. It illustrates the very basic text formatting effects that can be achieved using RTF.
被替换为

\par }\pard \ltrpar\qj \li0\ri0\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af46\afs24 \ltrch\fcs0 \f46\fs24\insrsid1866410 \hich\af46\dbch\af31505\loch\f46 
his is a sample rich text format (RTF), document. This document was created using Microsoft Word and then printing the document to a RTF file. It }{\rtlch\fcs1 \af46\afs24 \ltrch\fcs0 \f46\fs24\insrsid1866410 \hich\af46\dbch\af31505\loch\f46 illustrates }
{\rtlch\fcs1 \af46\afs24 \ltrch\fcs0 \f46\fs24\insrsid1866410 \hich\af46\dbch\af31505\loch\f46 the very basic text formatting effects that can be achieved using RTF. 
您可以在我剪切并粘贴单词“图解”到文件的部分中看到更改。在这一部分中,添加了如下内容

illustrates }
{\rtlch\fcs1 \af46\afs24 \ltrch\fcs0 \f46\fs24\insrsid1866410 \hich\af46\dbch\af31505\loch\f46 the very basic text formatting effects that can be achieved using RTF. "
那么为什么会发生这种变化呢

更新: 通过下面的回答,我发现这是由于微软word添加了一些自己的风格等等
现在我的问题是,我可以使用二进制工具手动从rtf文件中删除这个附加的源代码或代码(例如{\rtlch\fcs1\af46\afs24\ltrch\fcs0\f46\fs24\insrsid1866410\hich\af46\dbch\af31505\loch\f46)吗?如果我删除它,是否会出错?(对于一个文件,我手动删除它,并且在检查内容时没有删除任何数据)。但我想知道是否可以删除它?

部分原因是Word的每个版本都引入了新功能,这些功能需要RTF标准中的新功能来表示它们。特别是Word中提供的对不同非Unicode字符编码标准和混合脚本的支持(LTR和LTR scrips以及“东亚”脚本)意味着很多rtf代码都与编码和文本方向有关,即使您的文档中除了LTR文本和Unicode编码之外什么都不包含。(这就是所有ltrpar、hich、dbch、ltrch的内容

许多程序都会生成RTF,而较旧的代码通常会生成与旧版本标准相对应的RTF。如果您在新版本的Word中打开此类文档并重新另存为RTF,则通常会使用新标准保存该文档。

今天,我们得到了文件和修复的最佳方法:查找。您需要了解的第一件事是:下面是查找字符串的位置-使用rtf conftol单词作为“\rtlch”“\ltrch”或类似于smthn的“\loch\”和“\hich\”参数。在这种情况下,我们将所有“\loch\f616\hich\f616”和其他fxxx匹配项更改为f0

fN是字体编号(afN关联的字体编号)。N是指字体表中的一个条目。fsNafsN是指字体大小

例如:

这段文字看起来像abrakadabra- ÄåîÀ40-63383/2018

我们可以使用ctrl+f“63383/2018”找到这个字符串,现在我们可以在Sublime raw.rtf中看到:

{\rtlch\fcs1\af793\afs24\ltrch\fcs0\b\f793\fs24\lang1033\langfe1033\langnp1033\insrsid7292261\charrsid9138747\c0\f0\e1\e8\f2\f0
\“e0”e6“ed”fb“e9”f1“f3”e4“e3”ee“f0”ee“e4”e0“cc”ee“f1”ea“e2”fb}{\rtlch\fcs1\af0\afs24\ltrch\fcs0\b\f0\fs24\lang1033\langfe1033\langnp1033\insrsid5809263\charrsid9138747
\par}{\rtlch\fcs1\af793\afs24\ltrch\fcs0\f793\fs24\lang1033\langfe1033\langnp1033\insrsid9842406\charrsid9138747\c4\e5\eb\ee\b9\c040-63383/2018}

如果我们将所有“\af793”“\f793”更改为“af0”“f0”


{\rtlch\fcs1\af0\afs24\ltrch\fcs0\b\f0\fs24\lang1033\langfe1033\langnp1033\insrsid7292261\charrsid9138747\c0\f0\e1\e8\f2\f0
\“e0”e6“ed”fb“e9”f1“f3”e4“e3”ee“f0”ee“e4”e0“cc”ee“f1”ea“e2”fb}{\rtlch\fcs1\af0\afs24\ltrch\fcs0\b\f0\fs24\lang1033\langfe1033\langnp1033\insrsid5809263\charrsid9138747
\par}{\rtlch\fcs1\af0\afs24\ltrch\fcs0\f0\fs24\lang1033\langfe1033\langnp1033\insrsid9842406\charrsid9138747\c4\e5\eb\ee\b9\c040-63383/2018}

利润!-利润 Дело № А40-63383/2018

\b\如您所见,字符前面表示粗体文本。
您可以看到,其他字符仍然有“af739”和“f793”
,我们无法用俄语阅读它们,但我们的示例有af0,所以MS Word实际上向我们显示了正确的文本。

正如我在问题中所说的{\rtlch\fcs1\af46\afs24\ltrch\fcs0\f46\fs24\insrsid1866410\hich\af46\dbch\af31505\loch\f46被附加在句子之间。我可以从rtf中删除这些附加的内容吗?如果我删除它会出错吗?