无法使用Microsoft.Office.Interop将文本(ascii代码0到31)添加到word文档中?

时间:2016-12-07 17:43:19

标签: vb.net office-interop

当我在word文档中添加一个字符串,其中字符串包含ASCII 0到31.字符串不存储在word应用程序中。谁能告诉我这里发生了什么? 有关详细信息,请查看我的简单代码

 dim app As Word.Application
 dim doc As Word.Document
 dim para As Word.Paragraph

    Dim str As String = Chr(26) + "A" + Chr(26) + "A" + Chr(26)

    app= CreateObject("word.application")
    doc= app.Documents.Add
    para= doc.Content.Paragraphs.Add
    para.Range.Text = str
    doc.SaveAs("d:\zzz.docx")
    app.Quit()

    Dim app As Application = New Application
    Dim doc As Document = app.Documents.Open("d:\zzz.docx")
    Dim str2 As String = doc.Content.Text
    doc.Close()
    app.Quit()

str lenght = 5 and str2 lenght = 2

0 个答案:

没有答案