منابع پایان نامه درباره dt_index=0;، dt_index، DataTable("MyTable");

for (int dt_index=0; dt_index<5; dt_index++)
dtp[dt_index] = new DataTable(“MyTable”);
OpenFileDialog openFileDialog1 = new OpenFileDialog();
// Set filter options and filter index.
openFileDialog1.Filter = “Text Files (.xlsx)|*.xlsx|All Files (*.*)|*.*”;
openFileDialog1.FilterIndex = 1; openFileDialog1.Multiselect = false; // Call the ShowDialog method to show the dialog box.
// Process input if the user clicked OK.
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
Excel tmp_exel = new Excel();
tmp_exel.excel_init(openFileDialog1.FileName);
int[] length = tmp_exel.Excel_Length(“Sheet1”);
string Start = “A”;
string Finish = Make_Title(length[1]);
int i = 1;
Array tmp_array = tmp_exel.GetRange(Start + i.ToString() + “:” + Finish + i.ToString(), “sheet1”);
string[] arrays = ConvertToStringArray(tmp_array);
string field_type = “Double”;
int col_index = 0;
foreach (string tmp_item in arrays)
{
if (tmp_item.Trim() == string.Empty)
{
break;
}
field_type = “Double”;
if ((col_index == 1) || (col_index == 3))
field_type = “String”;
addColumn(ref dt, tmp_item.Trim(), field_type);
for (int dt_index = 0; dt_index < 5; dt_index++)
addColumn(ref dtp[dt_index], tmp_item.Trim(), field_type); col_index++;
}
for (i = 2; i <= length[0]; i++)
{
tmp_array = tmp_exel.GetRange(Start + i.ToString() + “:” + Finish + i.ToString(), “sheet1”);
arrays = ConvertToStringArray(tmp_array);
if (arrays[0].Trim() == string.Empty)
{
break;
}
DataRow dtr = dtp[(i-2) % 5].NewRow();
DataRow dtr2 = dt.NewRow();
col_index = 0;
foreach (string tmp_item in arrays)
{
if (tmp_item.Trim() == string.Empty)
{
break;
}
if ((col_index == 1) || (col_index == 3))
{
dtr[col_index] = tmp_item;
dtr2[col_index++] = tmp_item;
}
else
{
dtr[col_index] = Convert.ToDouble(tmp_item);
dtr2[col_index++] = Convert.ToDouble(tmp_item);
}
}
dtp[(i – 2) % 5].Rows.Add(dtr);
dt.Rows.Add(dtr2);
}
tmp_exel.excel_close();
Converts();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
} string[] ConvertToStringArray(System.Array values)
{ // create a new string array
string[] theArray = new string[values.Length]; // loop through the 2-D System.Array and populate the 1-D String Array
for (int i = 1; i <= values.Length; i++)
]]>

Author: مدیر سایت

پاسخی بگذارید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *