Hi RPA,
HTML
<asp:Button ID="btnImport" runat="server" Text="Import" OnClick="Import" />
<br />
<br />
<asp:GridView ID="gvQuestions" runat="server" AutoGenerateColumns="true" />
<br />
C#
protected void Import(object sender, EventArgs e)
{
Application word = new Application();
Document doc = new Document();
string filePath = Server.MapPath("~/Files/Test.docx");
object missing = System.Type.Missing;
object fileName = filePath;
doc = word.Documents.Open(ref fileName,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing);
String read = string.Empty;
List<string> data = new List<string>();
for (int i = 0; i < doc.Paragraphs.Count; i++)
{
string temp = doc.Paragraphs[i + 1].Range.Text.Trim();
if (temp != string.Empty)
data.Add(temp);
}
doc.Close(ref missing, ref missing, ref missing);
System.Data.DataTable dt = new System.Data.DataTable();
dt.Columns.AddRange(new System.Data.DataColumn[] {
new System.Data.DataColumn("Id",typeof(int)),
new System.Data.DataColumn("Question"),
new System.Data.DataColumn("Answer1"),
new System.Data.DataColumn("Answer2"),
new System.Data.DataColumn("Answer3"),
new System.Data.DataColumn("Answer4"),
new System.Data.DataColumn("CorrectAnswer")
});
int totalQuestionCount = 0;
int rowNo = 1;
System.Data.DataRow dr = dt.NewRow();
for (int i = 0; i < data.Count; i++)
{
string type = string.Empty;
if (data[i].Contains("$") || data[i].Contains("©"))
{
type = "option";
if (i != 0)
{
if ((!data[i - 1].Contains("@")))
{
type = "new line option";
}
}
}
else
{
type = "question";
}
int optionCount = 2;
switch (type)
{
case "question":
dr[0] = rowNo;
string str = rowNo.ToString();
dr[1] = data[i].Replace("@", "").Replace(str, "").Replace(".", "").Trim();
rowNo++;
break;
case "option":
foreach (string option in data[i].Split(';'))
{
if (!string.IsNullOrEmpty(option))
{
if (option.Contains("$"))
{
dr[optionCount] = option.Replace("$", "").Replace("A)", "").Replace("B)", "").Replace("C)", "").Replace("D)", "").Trim();
}
else if (option.Contains("©"))
{
//* Option*//
dr[optionCount] = option.Replace("©", "").Replace("A)", "").Replace("B)", "").Replace("C)", "").Replace("D)", "").Trim();
dr[6] = option.Split(')')[1].Trim();
}
optionCount++;
}
}
break;
case "new line option":
foreach (string option in data[i].Split(';'))
{
if (!string.IsNullOrEmpty(option))
{
int colIndex = 0;
if (option.Contains("$A") || option.Contains("©A"))
{
colIndex = 2;
}
if (option.Contains("$B") || option.Contains("©B"))
{
colIndex = 3;
}
if (option.Contains("$C") || option.Contains("©C"))
{
colIndex = 4;
}
if (option.Contains("$D") || option.Contains("©D"))
{
colIndex = 5;
}
dt.Rows[dt.Rows.Count - 1][colIndex] = option.Replace("$", "").Trim();
if (option.Contains("©"))
{
dt.Rows[dt.Rows.Count - 1][colIndex] = option.Replace("©", "").Trim();
dt.Rows[dt.Rows.Count - 1][6] = option.Split(')')[1].Trim();
}
}
}
break;
}
if (i != 0 && data[i - 1].Contains("@"))
{
dt.Rows.Add(dr);
totalQuestionCount++;
dr = dt.NewRow();
}
}
((_Application)word).Quit();
gvQuestions.DataSource = dt;
gvQuestions.DataBind();
}
Screenshot

I hope this will works for you.