Get tracked changes from file

Hello,

We are using Aspose Cells 7.0.3 (Java) and we would like to get the list of changes from a file with “track changes” on.

I saw the methods hasRevisions and acceptAllRevisions, but I found no way of getting the revisions.

Is there one?


Regards

Hi,

Well, Aspose.Cells for Java only supports to check whether a workbook has revisions or not and also it does support to enable you to accept all revisions in the workbook.
e.g
Workbook.hasRevisions() -- Boolean method to check whether the file has tracked changes.
Workbook.acceptAllRevisions() -- Allow to accept all revisions.

Thank you.

PS. we already logged a ticket for it into our database to investigate and support the feature. Once we have any news on it, we will let you know.

The ticket was recorded as follows:
CELLSJAVA-42557 - Extract change history as text from track changes

Hi @lubenitza ,

Have you found any solution for tracking changes? I have similar requirement and looking for solution to achieve this.

Thank you

@ksupriya, @lubenitza,

We have a good news for you. We have analyzed the feature already. We plan to publish more APIs about Revision collections (e.g Revisions.RevisionLogCollection). We will try to complete the feature before the end of April, 2020.

@ksupriya, @lubenitza,

Please try our latest version/fix: Aspose.Cells for Java v20.3.3 (attached)
aspose-cells-20.3.3-java.zip (7.0 MB)

Your issue should be fixed in it. See the following sample code for reference.
e.g
Sample code:

Workbook workbook = new Workbook(file);
                foreach(RevisionLog log in workbook.Worksheets.RevisionLogs)
                {
                    RevisionCollection rvs = log.Revisions;
                    foreach (Revision rv in rvs)
                    {
                        switch (rv.Type)
                        {

                            case RevisionType.InsertDelete:
                                RevisionInsertDelete rrc = (RevisionInsertDelete)rv;
                                Console.WriteLine(string.Format("ActionType :{0}; newArea : {1}.", rrc.ActionType, rrc.CellArea));
                                Console.WriteLine(rrc.CellArea);
                                break;
                            case RevisionType.ChangeCells:
                                RevisionCellChange rcc = (RevisionCellChange)rv;
                                string str = string.Format("CellName :{0}; OldValue : {1} ;NewOld : {2}.", rcc.CellName, rcc.OldValue, rcc.NewValue);
                                Console.WriteLine(str);
                                break;
                            case RevisionType.MoveCells:
                                RevisionCellMove rm = (RevisionCellMove)rv;
                                Console.WriteLine(string.Format("SourceArea :{0}; newArea : {1}.", rm.SourceArea, rm.DestinationArea));
                                break;
                            case RevisionType.CustomView:
                                RevisionCustomView rcv = (RevisionCustomView)rv;
                                Console.WriteLine(string.Format("ActionType :{0}; guid : {1}.", rcv.ActionType, rcv.Guid));
                                break;
                            case RevisionType.Format:
                                RevisionFormat rfmt = (RevisionFormat)rv;
                                Console.WriteLine(string.Format("worksheet :{0}; area : {1}.", rfmt.Worksheet.Name, rfmt.Areas[0]));
                                break;
                            case RevisionType.InsertSheet:
                                RevisionInsertSheet ris = (RevisionInsertSheet)rv;
                                Console.WriteLine(string.Format("newsheet :{0}; sheetPosition : {1}.", ris.Name, ris.SheetPosition));
                                break;
                            case RevisionType.DefinedName:
                                RevisionDefinedName rdn = (RevisionDefinedName)rv;
                                Console.WriteLine(string.Format("Test :{0}; oldFormula :{1};  newformula : {2}.", rdn.Text, rdn.OldFormula, rdn.NewFormula));

                                break;
                            case RevisionType.RenameSheet:
                                RevisionRenameSheet rsnm = (RevisionRenameSheet)rv;
                                Console.WriteLine(string.Format("OldName :{0}; newName :{1}.", rsnm.OldName, rsnm.NewName));
                                break;
                            default:
                                Console.WriteLine(rv.Type);
                                break;
                        }
                    }
                }

hi @Amjad_Sahi,
I’m have upgrated to lastest verison Aspose for Java 20.6

Is there a way to get the list of track changes in a similar way how Word shows the revisions?
Actually I need to get them in a different way. I need to get all tracked changes group by the section so I would need to get the changes but each change should be able to tell me what section it belongs to.

Thanks!

@rimolma1,
You can track revisions by using above code snippet. To generate a text file or add revision data grouped by section is not supported yet. Could you share how do you perform this task in MS Excel manually. It will help if you can share steps details, sample file and screenshot to demonstrate your needs.