Working with object in Tags

Posted by: lpagliaro on 21 July 2021, 5:49 am EST

  • Posted 21 July 2021, 5:49 am EST

    Hi! We have a tag set to a sheet done using SpreadJs, we assign an object as tag. When loading the workbook on Docs4Excel, we need to modify some values of this object in the tag and then save it again. Would you please help us out to achieve this?
  • Replied 21 July 2021, 6:30 pm EST


    There is no direct way to edit the tag value. But you can find the property in the GcExcel API and update it as per your need.

    If there is any specific value that you want to update and not finding it, then please let us know.

    Prabhat Sharma.
  • Marked as Answer

    Replied 26 July 2021, 2:35 am EST

    We managed to solve it. We did this:

    var sheetTag = (JsonConvert.DeserializeObject(worksheet.Tag.ToString()) as Newtonsoft.Json.Linq.JObject).ToObject<YourTagObjectClass>();

    ...[update sheetTag]...

    var jsonSheetTag = JObject.FromObject(sheetTag, new Newtonsoft.Json.JsonSerializer {
    ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver(),
    NullValueHandling = NullValueHandling.Ignore,

    worksheet.Tag = new StringBuilder(jsonSheetTag.ToString());

    The key was using the JObject.FromObject after serializing and StringBuilder when reassigning the tag to the worksheet.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels