this is my code:
int rowno=2;
for(j=from;j
{
if (j.Equals(from))
{
myExcelWorksheet.get_Range("A1", misValue).Formula = "REGISTER NUMBER";
myExcelWorksheet.get_Range("B1", misValue).Formula = "NAME";
//retrieve the first column values of 1st roll number
var query = from table in doc.DocumentNode.SelectNodes("//table[2]").Cast
from row in table.SelectNodes("tr[position()>2]").Cast
from cell in row.SelectNodes("td[1]").Cast
select new { CellText = cell.InnerText };
int cc = 1;
foreach (var cell in query)
{
int rwn = 1;
if (cc == 1)
{
myExcelWorksheet.get_Range("C" + rwn, misValue).Formula = cell.CellText;
}
if (cc == 2)
{
myExcelWorksheet.get_Range("D" + rwn, misValue).Formula = cell.CellText;
}
if (cc == 2)
{
myExcelWorksheet.get_Range("D" + rwn, misValue).Formula = cell.CellText;
}
if (cc == 3)
{
myExcelWorksheet.get_Range("E" + rwn, misValue).Formula = cell.CellText;
}
}
//retrieve the second column values of all roll number
var query1 = from table in doc.DocumentNode.SelectNodes("//table[2]").Cast
from row in table.SelectNodes("tr[position()>2]").Cast
from cell in row.SelectNodes("td[2]").Cast
select new { CellText = cell.InnerText };
string ans = "";
int cc = 1;
foreach (var cell in query1)
{
Console.WriteLine("{0}", cell.CellText);
ans = ans + cell.CellText + "*" + "\n";
if (cc == 1)
{
myExcelWorksheet.get_Range("C" + rowno, misValue).Formula = cell.CellText;
}
if (cc == 2)
{
myExcelWorksheet.get_Range("D" + rowno, misValue).Formula = cell.CellText;
}
if (cc == 3)
{
myExcelWorksheet.get_Range("E" + rowno, misValue).Formula = cell.CellText;
}}
This code works fine,when the sequential numbers do not have arrear results,when there is an arrear result(which will not be orderedly displayed in the website,then the values are overwritten in the excel sheet,and finally extra subjects(arrear subject codes)are not displayed with their code in the 1st row(that is cause,the 1st roll number might have not had an arrear) now im unable to solve this issue,im having no idea how to retrieve the column values and correctly display,pls help.
Replies
Know the answer? Post it — somebody with the same question will find it here.