Hi!
I want use progressbar till finishing adding question.
My code in below.
ofd.Filter = "All files(*.doc,*.rtf,*.docx)|*.doc;*.rtf;*.docx";
if (ofd.ShowDialog() != DialogResult.OK)
{
MessageBox.Show("File not choose");
}
else
{
object filename = ofd.FileName;
Microsoft.Office.Interop.Word.Application app = new Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word.Document doc = new Microsoft.Office.Interop.Word.Document();
object readOnly = false;
object isVisible = true;
object missing = System.Reflection.Missing.Value;
doc = app.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);
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);
}
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[] { new DataColumn("question"), new DataColumn("clas") });
DataRow dr = dt.NewRow();
for (int i = 0; i < data.Count; i++)
{
dr[0] = data[i].Replace("@", "");
dt.Rows.Add(dr);
dr = dt.NewRow();
// I want use here
int min = 1;
proBar.Value = min;
}
Grid.Columns["question"].Width = 520;
Grid.Columns["question"].HeaderText = "Саволҳо";
Grid.Columns["question"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
Grid.Columns["clas"].Width = 50;
Grid.Columns["clas"].HeaderText = "Синф";
Grid.Columns["clas"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
Grid.DataSource = dt;
doc.Close(ref missing, ref missing, ref missing);
}