Click here to Skip to main content
15,886,026 members

Comments by Subramanyam Shankar (Top 66 by date)

Subramanyam Shankar 7-May-15 13:06pm View    
Do you mean you want to set the format of columns to text?
Subramanyam Shankar 7-May-15 12:50pm View    
You can use Visual Studio setup or WIX. You have options for all those.
Subramanyam Shankar 19-Mar-15 5:03am View    
Your code should be able to handle the exceptions. Please add code to Catch the exception. The see from where the issue occurs in the stack trace. and see for which reference an object is not created and is null.
Subramanyam Shankar 18-Mar-15 12:15pm View    
Do you have knowledge of WIX Bootstrapper?
because I cannot write all the steps.
Subramanyam Shankar 18-Mar-15 4:49am View    
void CompareData(DataTable dataTab)
{
string filePath = @"F:\Book2.xlsx";

Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook xlWorkBook;

try
{
xlWorkBook = xlApp.Workbooks.Open(filePath, 0, true, 5, "", "", false, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", true, false, 0, true, 0);

Microsoft.Office.Interop.Excel.Worksheet worksheet1 = (Microsoft.Office.Interop.Excel.Worksheet)xlApp.Worksheets["Sheet1"];
//Reading for rows 10 to 15 and columns 5 to 10.
//j is used for rows
//Note:- 1st row in excel will be header values. so starting with +1.
for (int j = 10; j <16 ; j++)
{
//i is used for columns
for (int i = 5; i < 11; i++)
{
//In the datatable the row starts with 0 .so doing a subtraction.
if (dataTab.Rows[j-10][i-5] == Convert.ToString(worksheet1.Cells[j, i].Value2))
{
Console.WriteLine(dataTab.Rows[j][i]);
Console.WriteLine("Data matched");
}
else
{
Console.WriteLine("Data mismatch");
}
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
finally
{
xlApp.Quit();
}

}