Note that there are some explanatory texts on larger screens.

plurals
  1. POReading special characters like ρ,λ from word using interop word library of visual studio 2008
    primarykey
    data
    text
    <p>I am reading a word file using <code>Microsoft.Office.Interop.Word.Document</code> library of visual studio.The problem is the file contain special characters like <strong>ρ,λ</strong> .And when i read in C# they are converted in <strong>?</strong> Question mark .<br> For example i am reading a line like <code>A child drinks a liquid of density ρ through a vertical straw.</code> <br> So this line is converted into <code>A child drinks a liquid of density ? through a vertical straw.</code> So please help me how they are preserved in their original form.</p> <p><br> Here is the code</p> <pre><code> public void ReadMsWord() { // variable to store file path string filePath = null; // open dialog box to select file OpenFileDialog file = new OpenFileDialog(); // dilog box title name file.Title = "Word File"; // set initial directory of computer system file.InitialDirectory = "c:\\"; // set restore directory file.RestoreDirectory = true; // execute if block when dialog result box click ok button if (file.ShowDialog() == DialogResult.OK) { // store selected file path filePath = file.FileName.ToString(); } Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.ApplicationClass(); // create object of missing value object miss = System.Reflection.Missing.Value; // create object of selected file path object path = filePath; // set file path mode object readOnly = false; // open document 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 miss, ref miss, ref miss, ref miss, ref miss, ref miss); try { // create word application // select whole data from active window document docs.ActiveWindow.Selection.WholeStory(); // handover the data to cllipboard docs.ActiveWindow.Selection.Copy(); // clipboard create reference of idataobject interface which transfer the data IDataObject data = Clipboard.GetDataObject(); //set data into richtextbox control in text format string t = ""; string[] y = {}; t = data.GetData(DataFormats.Text).ToString(); string[] options = { }; y = t.Split('\n'); } catch(Exception ex) { throw ex; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload