The 'br' start tag on line 19 position 30 does not match the end tag of 'u'.

Jun 5, 2013 at 11:43 AM
Hello,

In the below code, I just tried to update the cell values, but, while saving back to excel i got the exception. May anyone know the reason for it. Thanks in advance.

CODE:
var workBook = new XLWorkbook(fileName);
            workBook.CalculateMode = XLCalculateMode.Auto;
            IXLWorksheet worksheet = null;
            workBook.Worksheets.TryGetWorksheet("Transverse", out worksheet);
            if (worksheet != null)
            {
                var firstDataCell = worksheet.Cell("A8");
                var lastDataCell = worksheet.LastCellUsed();
                var rngData = worksheet.Range(firstDataCell.Address, lastDataCell.Address);
                string value = string.Empty;
                IXLCells cells = rngData.CellsUsed(p => p.ValueCached != null && p.ValueCached.ToString().ToLower().Equals("12799"));
                if (cells.Any())
                {
                    foreach (var xlCell in cells)
                    {
                        int rowNumber = xlCell.WorksheetRow().RowNumber();
                        worksheet.Row(rowNumber).Cells(p => p.Address.ColumnLetter.Equals("B")).Value = "Karthik";
                        worksheet.Row(rowNumber).Cells(p => p.Address.ColumnLetter.Equals("D")).Value = 200;
                        worksheet.Cells("D" + rowNumber).Style.Alignment.WrapText = true;
                        worksheet.Range("D" + rowNumber + ":" + "D" + (rowNumber + 1)).Column(1).Merge();
                    }
                }
                workBook.SaveAs("C:\\Users\\20003522\\Desktop\\Combine_1.xlsx");
EXCEPTION:

at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
at System.Xml.XmlTextReaderImpl.ParseEndElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r)
at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r, LoadOptions o)
at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
at System.Xml.Linq.XDocument.Load(XmlReader reader)
at ClosedXML.Excel.XDocumentExtensions.Load(Stream stream)
at ClosedXML.Excel.XLWorkbook.DeleteComments(WorksheetPart worksheetPart, XLWorksheet worksheet, SaveContext context)
at ClosedXML.Excel.XLWorkbook.CreateParts(SpreadsheetDocument document)
at ClosedXML.Excel.XLWorkbook.CreatePackage(String filePath)
at ClosedXML.Excel.XLWorkbook.SaveAs(String file)
at ClosedXMLTEST.Form1.ReadAndUpdateExcel(String fileName) in D:\Rnd\Learning\ClosedXMLTEST\Form1.cs:line 56