更改写字板中的字体颜色

发布于 2024-08-19 22:42:45 字数 302 浏览 5 评论 0原文

是否可以在将文本重定向到写字板时更改文本的字体颜色?

示例:

C:\echo greencolor>> C:\colors.rtf ----->该文本在写字板中应显示为绿色

C:\echo redcolor >> C:\colors.rtf ----->此文本在写字板中应显示为红色

C:\echo Browncolor >> C:\colors.rtf ----->该文本在写字板中应显示为棕色

Is it possible to change the font color of text while redirecting it to WordPad?

Examples:

C:\echo greencolor >> C:\colors.rtf -----> This text should appear green in WordPad

C:\echo redcolor >> C:\colors.rtf -----> This text should appear red in WordPad

C:\echo browncolor >> C:\colors.rtf -----> This text should appear brown in WordPad

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

归途 2024-08-26 22:42:45

RTF 使用自己的标记。例如,单词bluered在各自的颜色中表示为:

{\rtf1\ansi\ansicpg1252\deff0\deflang1033
   {\fonttbl
       {\f0\fswiss\fprq2\fcharset0 Arial;}
       {\f1\fswiss\fcharset0 Arial;}
   }
   {\colortbl ;\red0\green0\blue255;\red255\green0\blue0;}
   {\*\generator Msftedit 5.41.15.1515;}
   \viewkind4\uc1\pard\cf1\f0\fs20 blue, \cf2 red\cf0\f1\par
}

因此,您需要输出其他颜色的此类标记并基本上创建一个RTF文档。

RTF uses its own markup. E.g. the words blue and red in respective colors are represented as:

{\rtf1\ansi\ansicpg1252\deff0\deflang1033
   {\fonttbl
       {\f0\fswiss\fprq2\fcharset0 Arial;}
       {\f1\fswiss\fcharset0 Arial;}
   }
   {\colortbl ;\red0\green0\blue255;\red255\green0\blue0;}
   {\*\generator Msftedit 5.41.15.1515;}
   \viewkind4\uc1\pard\cf1\f0\fs20 blue, \cf2 red\cf0\f1\par
}

So, you need to output such markup for other colors and basically create a RTF document.

め七分饶幸 2024-08-26 22:42:45

dirkgently 是完全正确的。举个例子,以下命令行将在 C:\colors.rtf 中生成一个 RTF 文档,其中包含绿色的“green”一词。

C:\>echo {\rtf1\ansi\deff0{\fonttbl{\f0\fswiss\fcharset0 Arial;}}{\colortbl ;\red0\green128\blue0;}{\*\generator Msftedit 5.41.15.1515;}\viewkind4\uc1\pard\cf1\lang1033\f0\fs20 green\cf0\par} >> c:\colors.rtf

然后您可以在写字板中打开 c:\colors.rtf。

dirkgently is entirely correct. To take your examples, the following command line will produce a RTF document at C:\colors.rtf, containing the word 'green' in green.

C:\>echo {\rtf1\ansi\deff0{\fonttbl{\f0\fswiss\fcharset0 Arial;}}{\colortbl ;\red0\green128\blue0;}{\*\generator Msftedit 5.41.15.1515;}\viewkind4\uc1\pard\cf1\lang1033\f0\fs20 green\cf0\par} >> c:\colors.rtf

You can then open c:\colors.rtf in Wordpad.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文