Hi , Could not get json from DetailFileJsonWithUid for some XLS files.
Failing due to NullReference Exception
Thanks for the report. I have not confirmed this yet and can only confirm it after reproducing on our side. Based on your description, this might be a bug in Aspose.Cells when converting xls to json. To confirm and log it internally, I need a few details.
- Which version of Aspose.Cells (including GridJS) are you using?
- Can you share a minimal code snippet that calls
DetailFileJSONByUidand the exact request parameters you pass? - Do the failing XLS files have any special features (e.g., macros, password protection, unusual formats) compared to the ones that work?
- Could you provide the full stack trace of the NullReferenceException?
A support engineer will review this information and get back to you.
Once I have the missing details, I’ll try to reproduce this. If I can confirm it, I’ll log it internally and follow up here.
A support engineer will follow up in this thread if needed.
at .e(String )
at .e()
at .(Font , String , String[] , Int32 , Int32 , Int32& , Int32 , Int32& , Boolean& , Worksheet , String )
at .(Workbook , String , String )
at .(String )
at Aspose.Cells.GridJs.GridJsWorkbook.ExportToJsonStringBuilder(String filename)
at Aspose.Cells.GridJs.GridJsService.DetailFileJsonWithUid(String filePath, String uid)
at ExcelPreview.Web.API.ExcelApiController.d__3.MoveNext() in ExcelPreview.Web\API\ExcelApiController.cs:line 31
Could you please zip and attach the Excel file? Also, share the sample code that you are using. We will check your issue soon.
14381c09-6113-4767-8ac8-e78b6c4f8fb1-file.zip (32.4 KB)
public async Task<IActionResult> ExcelJson(string fileName)
{
if (string.IsNullOrWhiteSpace(fileName))
return BadRequest("fileName is required.");
// These come from appsettings.json
var excelSourceRoot = _configuration["Paths:ExcelSourceRoot"];
var cacheRoot = _configuration["Paths:ExcelCacheRoot"];
var filePath = Path.Combine(excelSourceRoot, fileName);
if (!System.IO.File.Exists(filePath))
return NotFound("Excel file not found.");
var uid = Path.Combine(cacheRoot, Path.GetFileNameWithoutExtension(fileName));
var jsonCachePath = Path.ChangeExtension(uid, ".json");
string json;
if (await _cache.IsExistedAsync(jsonCachePath))
{
json = await _cache.LoadJsonAsync(jsonCachePath);
}
else
{
var sb = _gridJsService.DetailFileJsonWithUid(filePath, uid);
await _cache.SaveJsonStreamAsync(sb.ToString(), jsonCachePath);
json = sb.ToString();
}
return Content(json, "application/json");
}
Thanks for the file and code snippet.
We require a thorough evaluation of the issue. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CELLSGRIDJS-2261
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@arunkv
what version are you using?
Please try using the latest v26.2 version.
I can not reproduce this issue in the latest version.
We are currently using the latest version.
Attached another document which is failing with same issue.
skjk-asalk.zip (82.9 KB)
Thanks for confirming you’re using the latest Aspose.Cells.GridJs version. We’ve logged your new Excel file under ticket “CELLSGRIDJS-2261” and will review it to share our findings.
Sorry CorssChecked the version again. Found that it is in 25.12.0, I will update and try again. Thank you for your support!.
Thank you for rechecking and confirming you are using an older version of the API. Kindly test with the latest version of Aspose.Cells.GridJs as recommended and let us know your feedback.
@amjad.sahi @peter.zhou
After trying with latest version Aspose.Cells.GridJS 26.2.0.The Json generated with out any issues.
But facing another issue in rendering excel with client side script.This is happening only when chart name contains ‘&’ character
<script src="https://unpkg.com/gridjs-spreadsheet@26.2.0/xspreadsheet.js"></script>
Error Screenshot: image.png (4.4 KB)
Excel Doc: skjk-asalk.zip (82.9 KB)
Thank you for your feedback. We’re glad to hear that the latest version has resolved the issue and is generating the JSON data file correctly. The ticket (“CELLSGRIDJS-2261”) has now been closed.
Thanks for the sample file and screenshot.
After initial testing, I confirmed the issue (exception) using your Excel file. We require a thorough evaluation of the issue.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CELLSGRIDJS-2265
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
I apologize, but since the ticket was logged only yesterday, please allow us some time to assess it properly. We will work on resolving it and will inform you of any updates as soon as we have them.
The developers/teams responsible for this part have been on their holidays for their traditional festival for several days across last week and this week, so they have not been able to thoroughly investigate this issue. We will try to provide update/feedback few days later this week. Sorry for the inconvenience caused by it.