RTF的问题 [英] A Problem with RTF

查看:102
本文介绍了RTF的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用VB 2008 Express ...

我知道.Net RichTextBox有很多限制.我想基于RichTextBox构建一个简单的编辑器,以便可以在这些限制内编写.rtf文件.我以为这将为我提供RTF内容,该内容可以正确显示在其他应用程序的RichtextBox中.仅仅花了一个小时就完成了.但是...

当我为所选文本设置背景色并保存文件(使用RTB.SaveFile),然后重新打开它时,将保留bkgnd颜色.但是,如果我为选定的文本(RTB.SelectionColor)设置了不同的颜色,则当我重新打开文件时,该文本始终是控件的默认文本颜色.它甚至无法正确读取自己的RTF.

因此,我使用编辑器MS Works,AbiWord,写字板和OpenOffice Writer创建了几乎相同的文件.在这些程序中,所有程序都可以正确读取自己的RTF文件,但是几乎没有一个程序可以正确读取彼此的文件(在大多数情况下(但不是所有情况下),写字板都可以正确读取).而且我的RTF编辑器总是使用RTB的默认字体打开一个文件,而不管它是以哪种字体保存的.OOWriter往往会丢失bkgnd颜色,而AbiWord却是火车残骸.

所以我的问题是:我想念一些技巧吗?我给人的印象是,RTF在支持它的任何编辑器中应该至少看起来大致相同.我愿意就遇到问题的原因提出任何建议.

Using VB 2008 Express...

I''m aware that the .Net RichTextBox has numerous limitations. I wanted to build a simple editor, based on the RichTextBox, so that I could compose .rtf files within those limitations. I assumed that this would give me RTF content that would appear properly in a RichtextBox in other applications. Only took about an hour to build it. But...

When I set a background color for selected text and save the file (with RTB.SaveFile), then reopen it, the bkgnd color is preserved. But if I set a different color for the selected text (RTB.SelectionColor), the text is always the control''s default text color when I reopen the file. It can''t even properly read its own RTF.

So I created near-identical files with my editor, MS Works, AbiWord, WordPad and OpenOffice Writer. Of these programs, all could properly read their own RTF files, but almost none of them properly read each other''s files (WordPad got it right in most but not all cases). And my RTF editor always opens a file with the RTB''s default font regardless of the font it was saved in. OO Writer tends to lose bkgnd colors, and AbiWord was a train wreck.

So my question is: Is there some trick I''m missing? I was under the impression that RTF should appear at least mostly the same in any editor that supports it. I am open to ANY suggestions as to why I''m encountering the problem.

推荐答案

hello;
请检查链接:
链接1 [链接2 [ ^ ]
获取所有所需内容! [
hello ;
kindly check that links :
link1[^]
link2[^]
get all what you want !!![^]
regards..


您要保存文件.rtf或.text?
但是如果您想读取rtf,则需要特殊的解析器控件..检查
likn [ ^ ]
和那个 [
you are sacing your files .rtf or .text??
but if you want to read a rtf you need a special parser control .. check that likn[^]
and that one[^] regards..


至少弄清楚了一部分.从此处获得了提示. [ ^ ]

在应用创建新的RTB之前,在读取文本之前,我正在设置默认字体和detecturl属性.我不是很聪明.我的rtf应用现在可以正确读取自己的文件了.关于OO,AbiWord,Works和写字板如何读取彼此的文件,仍然大受打击或错过.也许他们使用了不同版本的RTF规范?
Figured out at least part of it. Had a hint from here.[^]

I was setting the default font and detecturl properties BEFORE reading the text when the app created a new RTB. Not real smart on my part. My rtf app now reads its own files correctly. It''s still hit or miss as to how OO, AbiWord, Works and WordPad read each other''s files. Maybe they''re using different releases of the RTF Spec?


这篇关于RTF的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆