I want to read the formatted (bold,underline,italics) text of a word dcoument using c#
i can read the document even the paragraphn in it but not the formatted text
plzz help
following is the code
private void btnRead_Click(object sender, EventArgs e)
{
// ReadFile(textBox1.Text);
// Use the open file dialog to choose a word document
if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
{
// set the file name from the open file dialog
object fileName = openFileDialog1.FileName;
object readOnly = false;
object isVisible = true;
object nullobj = System.Reflection.Missing.Value;
// Here is the way to handle parameters you don't care about in .NET
object missing = System.Reflection.Missing.Value;
// Make word visible, so you can see what's happening
WordApp.Visible = true;
// Open the document that was chosen by the dialog
Word.Document aDoc = WordApp.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible);
Word.ApplicationClass wordApp = new Word.ApplicationClass();
aDoc.ActiveWindow.Selection.WholeStory();
aDoc.ActiveWindow.Selection.Copy();
IDataObject data = Clipboard.GetDataObject();
txtFileContent.Text = data.GetData(DataFormats.Text).ToString();
}
}