public void SerializeToXML(yourclass obj)
{
XmlSerializer serializer = new XmlSerializer(typeof(yourclass));
TextWriter txtWriter = new StreamWriter(@"Physicaladdress\fielName.xml");
serializer.Serialize(txtWriter, obj);
txtWriter.Close();
}
this blog to share the problems, technical challenges and their solutions what I faced in my day to day development activity. https://www.gopaisa.com/ref/M6UVCW
public void Upload()
{
HttpPostedFileBase flExcell = Request.Files["flExcell"];
if (flExcell.ContentLength != 0)
{
string Extenstion = Path.GetExtension(flExcell.FileName);
string ExcelName = MethodFactory.GenerateUniqueFileName("Excel") + Extenstion.ToString();
string FilePath = "~/UploadExcel/" + ExcelName;
flExcell.SaveAs(Server.MapPath(FilePath));
using (var package = SpreadsheetDocumentWrapper.Open(@FilePhysicalAddress + ExcelName))
{
var part = package.WorkbookPart.WorksheetParts["Sheet1"];
foreach (var row in part.Worksheet.SheetData.Rows)
{
if (row.RowIndex > 1 && row.RowIndex < part.Worksheet.SheetData.Rows.Count())
{
string Module = row.GetCellValue<string>(0);
string TopicContent = row.GetCellValue<string>(1);
string TGroup = row.GetCellValue<string>(2);
string TGroupComplexity = row.GetCellValue<string>(3);
string TopicInstructions = row.GetCellValue<string>(4);
string QGroupID = row.GetCellValue<string>(5);
string PatternID = row.GetCellValue<string>(6);
string QGInstructions = row.GetCellValue<string>(7);
string Question = row.GetCellValue<string>(8);
string Options = row.GetCellValue<string>(9);
string CorrectAnswer = row.GetCellValue<string>(10);
}
}
}
}
}