Skip to content

Unable to add more than one cell comment #2779

Closed

Description

@AbhinanduReddy

I m trying to add cell comments in my angular project but and error pop shows
image
image

Activity

  1. SheetJSDev commented on Sep 2, 2022

    @SheetJSDev
    Contributor

    What version of Excel are you using? Can you share the bad file as well as the comment structure for one of the comments that was removed?

    Excel recently changed how comments worked, and SheetJS shifted to support the new threaded comments, so it's possible the fallback isn't compatible with some older versions.

  2. AbhinanduReddy commented on Sep 2, 2022

    @AbhinanduReddy
    Author

    Thank you for responding i have used the latest version now I'm not getting error, but Thereaded comments are coming blank now

  3. AbhinanduReddy commented on Sep 2, 2022

    @AbhinanduReddy
    Author

    image
    image

  4. SheetJSDev commented on Sep 2, 2022

    @SheetJSDev
    Contributor

    What version of Excel are you using?

    Also, can you test the attached file? comments_example.xlsx

    It was generated as follows:

    var wb = XLSX.utils.book_new();
    
    var ws = XLSX.utils.aoa_to_sheet([["A1"], ["A2"]]);
    
    if(!ws.A1.c) ws.A1.c = [];
    ws.A1.c.push({a:"SheetJS", t:"This comment is visible"});
    
    if(!ws.A2.c) ws.A2.c = [];
    ws.A2.c.hidden = true;
    ws.A2.c.push({a:"SheetJS", t:"This comment will be hidden"});
    
    XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
    
    
    var ws = XLSX.utils.aoa_to_sheet([["A1"], ["A2"]]);
    
    if(!ws.A1.c) ws.A1.c = [];
    ws.A1.c.push({a:"SheetJS", t:"This is not threaded"});
    
    if(!ws.A2.c) ws.A2.c = [];
    ws.A2.c.hidden = true;
    ws.A2.c.push({a:"SheetJS", t:"This is threaded", T: true});
    ws.A2.c.push({a:"JSSheet", t:"This is also threaded", T: true});
    
    
    XLSX.utils.book_append_sheet(wb, ws, "Sheet2");
    XLSX.writeFile(wb, "comments_example.xlsx")
  5. SheetJSDev commented on Sep 2, 2022

    @SheetJSDev
    Contributor

    The updated logic is now aligned with how the Pro builds write comments.

    SheetJSThreadedComments.xlsx
    small example generated using the same example code. That should have visible comments both in Excel 2019 and in older versions of Excel. If the file is showing blank comments or looks corrupted, let us know what version of Excel you are using.

  6. locked and limited conversation to collaborators on Dec 29, 2022
  7. added a commit that references this issue on Apr 2, 2024
    6c9010f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions