i am developing a online examination system. I have to upload Questions from ms-word( with images) to Database table. I have read the text but unable to read the images included in Questions.
To read the text From word I have used the following code :
var wordApp = new Microsoft.Office.Interop.Word.Application();
object pathToYourDocument = string.Concat(Server.MapPath("~/TempFiles/"), FileUpExcel.FileName);
//Save File as Temp then you can delete it if you want
FileUpExcel.SaveAs(pathToYourDocument.ToString());
object readOnly = false;
object isVisible = true;
object missing = System.Reflection.Missing.Value;
var wordDoc = wordApp.Documents.Open(ref pathToYourDocument,
ref missing, ref readOnly,
ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing,
ref missing, ref missing, ref isVisible,
ref missing, ref missing, ref missing, ref missing);
var txt = wordDoc.Content.Text;
wordDoc.Close(ref missing, ref missing, ref missing);
//var regex = new Regex(@"(Q.\: )(.+?)[\r\n]");
#region Fetch Data
// Fetch Questions
var regexQue = new Regex(@"(" + ddlQue.SelectedItem.Text + "\t)(.+?)[\r]");
var AllQue = regexQue.Matches(txt);
string[] Quelist = new string[AllQue.Count];
int i = 0;
foreach (Match match in AllQue)
{
object QueValue = match.Groups[2].Value;
Quelist.SetValue(QueValue, i);
i++;
}
// Fetch Question Detail
var regexQueDetail = new Regex(@"(" + ddlQuesDetail.SelectedItem.Text + "\t)(.+?)[\r]");
var AllQueDetail = regexQueDetail.Matches(txt);
string[] QueDetaillist = new string[AllQueDetail.Count];
i = 0;
foreach (Match match in AllQueDetail)
{
object QueDetailValue = match.Groups[2].Value;
QueDetaillist.SetValue(QueDetailValue, i);
i++;
}
Somebody Help me. Thanks.