将文件导入具有所有OLE信息的RTF文本框中 [英] Importing a file into richtext box with all OLE information present

查看:66
本文介绍了将文件导入具有所有OLE信息的RTF文本框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我编写了一个程序,将文件内容导入到RichTextBox中,修改了我需要的部分,然后将更改重写到文件中.我一切正常,但是有一个问题.

输出Richtextbox时,我可以使用

Hi Guys,

I have written a program that imports a files contents into a richtextbox, modifies the section i need and then rewrites the changes to the file. I have everything working but I have got one problem.

When outputting the richtextbox, i can use

<pre>richTextBox1.SaveFile(outputFile, RichTextBoxStreamType.TextTextOleObjs)



哪个工作正常,我发现的问题是我导入时.发生这种情况时,所有00字节都变成20,我需要将其保持为零.

我没有如下所示的带有负载的功能:



Which works fine, the problem i have found is when i import. When this happens, all the 00 bytes turn into 20 , i need these to remain as zero''s.

I do not have this function with load as shown below:

<pre>richTextBox1.LoadFile(lkmFile, RichTextBoxStreamType.TextTextOleObjs)



由于流类型TextTextOleObs仅可与.SaveFile一起使用,因此将引发异常.

有人可以帮忙吗?

干杯



It throws an exception as the stream type TextTextOleObs can only be used with .SaveFile.

Can anybody help?

Cheers

推荐答案

只需尝试调用不带RichTextBoxStreamType参数的LoadFile方法. RichTextBox应该能够推断流类型.
Simply try calling the LoadFile method without the RichTextBoxStreamType argument. The RichTextBox should be able to infer the stream type.
richTextBox1.LoadFile(lkmFile);


我认为我有解决方案,我只会使用File.ReadAllLines,将其放入ASCII格式,因此它引入了纯文件,只需要知道解决如何在数组中查找和替换字节的方法即可.

再次欢呼
I think i have the solution, i will just use File.ReadAllLines instead, brings it in a ASCII format so it brings in the file pure, just need to know work out how to find and replace bytes in the array.

Cheers again


这篇关于将文件导入具有所有OLE信息的RTF文本框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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