尝试从 word 文档中读取 unicode 字符但获取符号 (????)。
这是我的代码:
Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
object miss = System.Reflection.Missing.Value;
object enc = Microsoft.Office.Core.MsoEncoding.msoEncodingEUCJapanese;
object path = @"C:\Users\file.doc"
object readOnly = true;
Microsoft.Office.Interop.Word.Document docs = word.Documents.Open(ref path, ref miss, ref readOnly, ref miss, ref miss,
ref miss, ref miss, ref miss, ref miss, ref miss, ref enc, ref miss, ref miss, ref miss, ref miss, ref miss);
string totaltext = "";
for (int i = 0; i < docs.Paragraphs.Count; i++)
{
totaltext += " \r\n " + docs.Paragraphs[i + 1].Range.Text.ToString();
Console.WriteLine(totaltext);
}
// Console.WriteLine(totaltext);
docs.Close();
word.Quit();