Free Support Forum - aspose.com

Threaded comments order after import to Office365

Hello! I have code snippet (Aspose.Cells 19.10) for create workbook and several threaded comments.
After import to OneDrive and open in Office365 Excel I got comments order randomized:
image.png (35.2 KB)

Please help with this problem, I want to save comments order.

Snippet (Java)
import com.aspose.cells.*;

public class AsposeThreadCommentsOrderMain {

    public static void main(String[] args) throws Exception {
        License license = new License();
        license.setLicense("aspose.lic");

        Workbook workbook = new Workbook();
        Worksheet worksheet = workbook.getWorksheets().get(0);
        int author1Index = workbook.getWorksheets().getThreadedCommentAuthors()
                                   .add("Author 1", "author1", "OV");
        int author2Index = workbook.getWorksheets().getThreadedCommentAuthors()
                                   .add("Author 2", "author2", "OV");

        ThreadedCommentAuthor author1 = workbook.getWorksheets().getThreadedCommentAuthors().get(author1Index);
        ThreadedCommentAuthor author2 = workbook.getWorksheets().getThreadedCommentAuthors().get(author2Index);

        addThreadedComment(worksheet, "C2", "1", author1);
        addThreadedComment(worksheet, "C2", "2", author1);
        addThreadedComment(worksheet, "C2", "3", author1);
        addThreadedComment(worksheet, "C2", "4", author2);
        addThreadedComment(worksheet, "C2", "5", author1);
        addThreadedComment(worksheet, "C2", "6", author1);
        addThreadedComment(worksheet, "C2", "7", author1);
        addThreadedComment(worksheet, "C2", "8", author1);
        addThreadedComment(worksheet, "C2", "9", author1);
        addThreadedComment(worksheet, "C2", "10", author2);
        addThreadedComment(worksheet, "C2", "11", author1);
        addThreadedComment(worksheet, "C2", "12", author2);

        workbook.save("output.xlsx");
    }

    private static void addThreadedComment(Worksheet worksheet, String cellName, String text, ThreadedCommentAuthor author) {
        Cell cell = worksheet.getCells().get(cellName);
        CommentCollection commentCollection = cell.getWorksheet().getComments();
        Comment comment = commentCollection.get(cell.getRow(), cell.getColumn());
        if (comment == null) {
            int commentIdx = commentCollection.add(cell.getRow(), cell.getColumn());
            comment = commentCollection.get(commentIdx);
        }
        comment.getThreadedComments().add(text, author);
    }
}

@VasiliyKupchinskiy,

Thanks for the sample code segment and screenshot.

Please try our latest version/fix: Aspose.Cells for Java v20.1.7 (attached)
aspose-cells-20.1.7-java.zip (6.8 MB)

If you still find the issue with 20.1.7, kindly do share your output file (you may zip it prior attaching) and screenshot to highlight the issue, we will log a ticket to figure it out soon.

With 20.1.7 issue not resolved too. Comments order changed after import to OneDrive:
image.png (33.4 KB)

Output xlsx file from code snippet:
output.zip (8.1 KB)

@VasiliyKupchinskiy,

Thanks for the screenshot and output file.

Please notice I have logged a ticket with an id “CELLSJAVA-43122” for your issue. We will look into it to figure it out soon. The issue is logged as following:
CELLSJAVA-43122 - Issue with Threaded comments’ order after import to Office365 XLSX file format

Once we have an update on it, we will let you know.

1 Like

@VasiliyKupchinskiy,

Please try our latest version/fix: Aspose.Cells for Java v20.1.9 (attached)

Your issue should be fixed in it.

Let us know your feedback.
aspose-cells-20.1.9-java.zip (6.8 MB)

:confused:
I made about 10 attempts and got 1 success only (correct order) after import to OneDrive.

@VasiliyKupchinskiy,
We have observed the issue and re-opened the ticket for analysis. We will write back here when feedback is ready to share.

@VasiliyKupchinskiy,
Could you please share a template file with ordered threaded comments?