Author Topic: Invalid XML Error while binding programmatically edited .xlsx Excel Sheet  (Read 1792 times)

Punit

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 46
    • View Profile

.XLSX excel sheet binding working fine but after making some changes through c# to the physical file we received an invalid XML error.

Error Message :

Uncaught Error: Invalid XML: <?xml version="1.0" encoding="utf-8"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" /><Default Extension="xml" ContentType="application/xml" /><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml" /><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml" /><Override PartName="/xl/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml" /><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml" /><Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml" /><Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml" /><Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml" /></Types>

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Invalid XML Error while binding programmatically edited .xlsx Excel Sheet
« Reply #1 on: February 02, 2022, 10:37:28 am »
How are you making changes directly to physical xlsx file?

Punit

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: Invalid XML Error while binding programmatically edited .xlsx Excel Sheet
« Reply #2 on: February 02, 2022, 11:03:23 am »
First I made ajax call with cell address to c# mvc and then later in c# I used third party dll like closedXML for edit physical XLSX and then try to load this edited bind excel but it gives error.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Invalid XML Error while binding programmatically edited .xlsx Excel Sheet
« Reply #3 on: February 02, 2022, 04:20:29 pm »
I'm able to use closedXML in C# to manipulate pqgrid generated xlsx file and then save and then again open it without any issues.

Please share a complete test case reproducing the error along with mention of pqgrid version.

Punit

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: Invalid XML Error while binding programmatically edited .xlsx Excel Sheet
« Reply #4 on: February 02, 2022, 06:22:25 pm »
1. Code I Write in c# for change excel cell color.
string path = Server.MapPath("~/Excel/ExcelTagging.xlsx") ;
XLWorkbook wb = new XLWorkbook(path);
IXLWorksheet ws = wb.Worksheets.First();
ws.Cell(2, "A").Style.Fill.BackgroundColor = XLColor.Yellow;
wb.SaveAs(path);
wb.Dispose();

2. My code of paramquery for bind excel data
var excelPath = '../../Excel/ExcelTagging.xlsx";
pq.excel.importXl({ url: excelPath }, function (wb) {
grid.importWb({ workbook: wb, extraRows: 100, extraCols: 100 });
grid.hideLoading();
})


Second code give error if bind modfied excel sheet.

Uncaught Error: Invalid XML: <?xml version="1.0" encoding="utf-8"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" /><Default Extension="xml" ContentType="application/xml" /><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml" /><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml" /><Override PartName="/xl/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml" /><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml" /><Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml" /><Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml" /><Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml" /></Types>
    at Function.error (VM9 jquery.min.js:3:4022)
    at Function.parseXML (VM9 jquery.min.js:3:4787)
    at Object.readPaths (pqgrid.min.js:11890:25)
    at Object.getWorkBook (pqgrid.min.js:11775:105)
    at l (pqgrid.min.js:11839:54)
    at XMLHttpRequest.r.onload (pqgrid.min.js:663:17)

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Invalid XML Error while binding programmatically edited .xlsx Excel Sheet
« Reply #5 on: February 06, 2022, 10:07:00 pm »
Thanks for sharing the details. Closedxml / pqgrid interoperability would be released in the upcoming version.

Punit

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: Invalid XML Error while binding programmatically edited .xlsx Excel Sheet
« Reply #6 on: February 07, 2022, 02:54:01 pm »
could you please inform tentative Date of next release.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Invalid XML Error while binding programmatically edited .xlsx Excel Sheet
« Reply #7 on: February 08, 2022, 11:34:43 am »
ETA: By end of Feb

Punit

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: Invalid XML Error while binding programmatically edited .xlsx Excel Sheet
« Reply #8 on: February 21, 2022, 03:10:55 pm »
Hello,

Did you fixed the bug?

Punit

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 46
    • View Profile
Hello Paramvir,

Have you fixed excel bug and released new version?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
It's fixed in v8.3.0