Click here to Skip to main content
15,902,447 members
Home / Discussions / C#
   

C#

 
GeneralRe: Navigate to file, rename and move in mvc net core app Pin
OriginalGriff8-Apr-21 2:28
mveOriginalGriff8-Apr-21 2:28 
GeneralRe: Navigate to file, rename and move in mvc net core app Pin
Lmm Cams8-Apr-21 8:18
Lmm Cams8-Apr-21 8:18 
GeneralRe: Navigate to file, rename and move in mvc net core app Pin
SeanChupas8-Apr-21 9:28
SeanChupas8-Apr-21 9:28 
QuestionHow to detect inconsistencies in data? Pin
Alex Dunlop7-Apr-21 7:33
Alex Dunlop7-Apr-21 7:33 
AnswerRe: How to detect inconsistencies in data? Pin
Alex Dunlop7-Apr-21 8:06
Alex Dunlop7-Apr-21 8:06 
AnswerRe: How to detect inconsistencies in data? Pin
SeanChupas7-Apr-21 8:19
SeanChupas7-Apr-21 8:19 
GeneralRe: How to detect inconsistencies in data? Pin
Alex Dunlop7-Apr-21 8:32
Alex Dunlop7-Apr-21 8:32 
AnswerRe: How to detect inconsistencies in data? Pin
Alex Dunlop8-Apr-21 9:31
Alex Dunlop8-Apr-21 9:31 
Finally, I found my own solution:
C#
IWorkbook workbook = spreadsheetControl.Document;
Worksheet worksheet = workbook.Worksheets["DataSet1"];
CellRange range = worksheet.GetDataRange();
int LastRow = range.BottomRowIndex;
var detected_rows = new List<string>();
var mydic1 = new Dictionary<string, string>();
var keys1 = new List<string>();
var keys2 = new List<string>();
var keys3 = new List<string>();
var my_table4 = new DataTable();

for (int i = 1; i < LastRow + 1; i++)
{
    if (worksheet.Cells[i, 10].DisplayText == "خاتمه یافته")
    {
        keys1.Add(string.Join(",", worksheet.Cells[i, 4].DisplayText, worksheet.Cells[i, 14].DisplayText, worksheet.Cells[i, 19].DisplayText));
        keys2.Add(string.Join(",", worksheet.Cells[i, 26].DisplayText));
        keys3.Add(string.Join(",", worksheet.Cells[i, 28].DisplayText));
    }
}

for (int i = 0; i < keys1.Count; i++)
{
    if (keys2[i] == keys3[i])
    {
        detected_rows.Add(keys1[i]);
    }
}

for (int i = 0; i < keys1.Count; i++)
{
    if (!mydic1.ContainsKey(keys1[i]))
    {
        mydic1.Add(keys1[i], keys2[i]);
    }
}
for (int i = 0; i < detected_rows.Count; i++)
{
    mydic1.Remove(detected_rows[i]);
}

List<string> my_keys = new List<string>(mydic1.Keys);

my_table4.Columns.Add("شماره دستورکار");
my_table4.Columns.Add("مرکز هزینه");
my_table4.Columns.Add("سال");

for (int i = 0; i < my_keys.Count; i++)
{
    string text = my_keys[i];
    string[] my_list = text.Split(',');
    my_table4.Rows.Add(my_list[0], my_list[1], my_list[2]);
}

spreadsheetControl.Invoke((MethodInvoker)delegate { CreateSheet("Error Detection"); });
spreadsheetControl.Invoke((MethodInvoker)delegate { ClearSheet("Error Detection"); });
spreadsheetControl.Invoke((MethodInvoker)delegate { Filldata("Error Detection", my_table4, 0, 0, true); });
Wink | ;)
QuestionA question of microoptimization Pin
Jörgen Andersson2-Apr-21 21:51
professionalJörgen Andersson2-Apr-21 21:51 
AnswerRe: A question of microoptimization Pin
Richard MacCutchan2-Apr-21 22:32
mveRichard MacCutchan2-Apr-21 22:32 
GeneralRe: A question of microoptimization Pin
OriginalGriff3-Apr-21 0:59
mveOriginalGriff3-Apr-21 0:59 
GeneralRe: A question of microoptimization Pin
Richard MacCutchan3-Apr-21 1:05
mveRichard MacCutchan3-Apr-21 1:05 
GeneralRe: A question of microoptimization Pin
Jörgen Andersson5-Apr-21 20:15
professionalJörgen Andersson5-Apr-21 20:15 
AnswerRe: A question of microoptimization Pin
OriginalGriff3-Apr-21 1:01
mveOriginalGriff3-Apr-21 1:01 
GeneralRe: A question of microoptimization Pin
Jörgen Andersson3-Apr-21 1:08
professionalJörgen Andersson3-Apr-21 1:08 
GeneralRe: A question of microoptimization Pin
OriginalGriff3-Apr-21 1:17
mveOriginalGriff3-Apr-21 1:17 
GeneralRe: A question of microoptimization Pin
harold aptroot3-Apr-21 1:37
harold aptroot3-Apr-21 1:37 
AnswerRe: A question of microoptimization Pin
#realJSOP3-Apr-21 2:04
professional#realJSOP3-Apr-21 2:04 
GeneralRe: A question of microoptimization Pin
harold aptroot3-Apr-21 2:14
harold aptroot3-Apr-21 2:14 
GeneralRe: A question of microoptimization Pin
#realJSOP3-Apr-21 2:19
professional#realJSOP3-Apr-21 2:19 
GeneralRe: A question of microoptimization Pin
harold aptroot3-Apr-21 2:23
harold aptroot3-Apr-21 2:23 
AnswerRe: A question of microoptimization Pin
Dave Kreskowiak3-Apr-21 5:50
mveDave Kreskowiak3-Apr-21 5:50 
GeneralRe: A question of microoptimization Pin
Jörgen Andersson3-Apr-21 5:56
professionalJörgen Andersson3-Apr-21 5:56 
QuestionHow to remove rows of a DataTable based on checkboxes? Pin
Alex Dunlop1-Apr-21 8:47
Alex Dunlop1-Apr-21 8:47 
AnswerRe: How to remove rows of a DataTable based on checkboxes? Pin
OriginalGriff1-Apr-21 9:33
mveOriginalGriff1-Apr-21 9:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.