在VB.NET中更改要由流写入程序写入的文件的字体样式 [英] Changing Font style of a file which is to be write by a stream writer in VB.NET

查看:71
本文介绍了在VB.NET中更改要由流写入程序写入的文件的字体样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,



我尝试使用 FILE STREAM 在VB.NET中创建一个.doc文件。内容来自< b> RICH TEXT BOX 。现在我需要从编码本身改变字体样式和大小。





这是我的编码创建一个DOC文件:



hi friends,

I tried to create a .doc file in VB.NET using FILE STREAM .The Contents are from RICH TEXT BOX .Now i need to change the font style and size from coding itself.


THIS IS MY CODING TO CREATE A DOC FILE:

Dim fs As New FileStream("MyData.doc", FileMode.Create, FileAccess.Write)
Dim writer As New StreamWriter(fs)
writer.WriteLine("Hello")
writer.Flush()
fs.Close()

推荐答案

不能工作,我很害怕。

如果你想用所有应用程序创建DOC文件ropriate格式化,那么你将需要一些比文本的Stream.WriteLine更复杂的东西。只给文件.DOC扩展并不意味着系统会为您处理所有细节。它没有。



这里有一个简单的解决方案: http://en.allexperts.com/q/Visual-Basic-1048/Writing-Word-file-Vb.htm [ ^ ]但它依赖于你在运行应用程序的机器上安装了Word。
Not going to work, I''m afraid.
If you want to create DOC files, with all the appropriate formatting, then you are going to need something rather more sophisticated than just Stream.WriteLine of your text. Just giving a file the ".DOC" extension does not mean that teh system handles all teh details for you. It doesn''t.

There is a simple solution here: http://en.allexperts.com/q/Visual-Basic-1048/Writing-Word-file-Vb.htm[^] but it relies on you having Word installed on the machine the application runs on.


这篇关于在VB.NET中更改要由流写入程序写入的文件的字体样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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