老师好!
我利用代码更改Word文档的后缀为.rtf后,通过RichTextBox打开会出现乱码。打开rtf代码如下。
Dim ct As New System.Windows.Forms.RichTextBox
ct.Dock = System.Windows.Forms.DockStyle.Fill
ct.Name ="RichTextBox1"
e.Form.Controls("Panel1").BaseControl.Controls.Add(ct)
Dim f As Font = New Font("Verdana", 16F, FontStyle.Regular, GraphicsUnit.Point)
ct.Font = f
ct.LoadFile("d:\test.rtf",System.Windows.Forms.RichTextBoxStreamType.PlainText)
-----------------
打开Word后另存为rtf文件,没有出现乱码问题。因此请教怎样把Word文件另存为rtf文件?
Dim app As New MSWord.Application
try
Dim fileName = "e:\test.docx"
app.Documents.Open(fileName)
app.
catch ex As exception
msgbox(ex.message)
finally
app.Quit
End try
[此贴子已经被作者于2020/11/19 8:28:04编辑过]