I am trying to get everything in the pdf (hidden column, comments & track changes). I am able to get hidden columns and comments. But I am not able to find any way to get the Track changes or revision.
I find any method which is “workbook.acceptAllRevisions()” it accept all the revision not return anything.
I find a class called RevisionLog - RevisionLog | Aspose.Cells for Java API Reference but as per the document It has revision changes but I am not able to find any method which returns this object
Do you want to render render track changes or revisions in the source (input) Excel file to output PDF by Aspose.Cells? Could you please share your input Excel file (having track changes/revisions) and current output PDF file by Aspose.Cells. Also, share your expected PDF file having your desired track changes or revisions in it. We will check it soon.
@amjad.sahi here is the expected file which I got from Mac OS Excel appExcel With Multi-User Track Changes Hidden Col_native.pdf (94.3 KB). Here is the pdf which I am able to get using Aspose.Cells Java SDK - Excel With Multi-User Track Changes Hidden Col.pdf (68.4 KB). Here is the Native Excel file - Excel With Multi-User Track Changes Hidden Col.xlsx.zip (15.4 KB)
Below is the code snippet:
public void convert(String inputPath, String outputPath) throws Exception {
log.info("FilePath={}",inputPath);
File file = new File(inputPath);
String fileName = file.getName();
log.info("FileName={}",fileName);
String fileParent = file.getParent();
log.info("fileParent={}",fileParent);
Workbook workbook = new Workbook(inputPath);
Iterator<Worksheet> iteratorWorkSheet = workbook.getWorksheets().iterator();
while(iteratorWorkSheet.hasNext()) {
Worksheet sheet = iteratorWorkSheet.next();
// Print the comments at the end of sheet
sheet.getPageSetup().setPrintComments(PrintCommentsType.PRINT_SHEET_END);
Iterator<Column> iteratorCol = sheet.getCells().getColumns().iterator();
while (iteratorCol.hasNext()) {
Column col = iteratorCol.next();
col.setHidden(false);
}
}
// Set all sheets to output
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.setCalculateFormula(true);
// Set text criss type
pdfSaveOptions.setTextCrossType(TextCrossType.CROSS_KEEP);
workbook.save(outputPath,pdfSaveOptions);
}
I am looking for “Track changes”, which is in the Native app comes under menu: Tools > Track Changes
Also, is there better way to get hidden column in the pdf output right now I am not able find single call method that is why I am going through all the columns of all worksheets and setting hidden as false.
Thanks for the sample files.
We need to investigate and evaluate on how to get track changes or revisions of Excel file into PDF. 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): CELLSJAVA-45414
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.
What is the name of the Native app you used?
Could you please highlight that what are track changes in the output pdf generated by the Native app?
I opened your source xlsx file in Microsoft Excel, and then manually saved it to pdf. There is no track changes in the output pdf generated by Microsoft Excel.
Native app means “Microsoft Excel for Mac OS”. please find the attached screenshot of the option to enable the track changes - Screenshot 2023-05-19 at 12.54.41 PM.jpg (262.1 KB)
Screenshot 2023-05-19 at 12.55.47 PM.png (55.2 KB)
We plan to support to output changes history list.(The content in Page 5,6,7,8 of your shared expected pdf file.)
However, for highlighting changed cells by red/blue borders, we can’t support it currently. Please let us know whether this feature is important for you.
Highlighting is needed but whatever we can get as part of history that is great.
Thanks
@pankaj1983
1, About highlighting, it’s strange that the color of borders are different in different machine.
We will try to add borders for those changed cells.
2, History worksheet
We only support exporting all revisions to the sheet,.The “when” “who” “where” filters can not be supported now.
Great, is there any timeline?
It looks great, thanks
The issues you have found earlier (filed as CELLSJAVA-45414) have been fixed in Aspose.Cells for Java 23.6.
How to use the feature, could you please share the sample code
We added the following APIs to highlight changes for revision logs:
RevisionLogCollection.HighlightChanges(HighlightChangesOptions) method and HighlightChangesOptions class.
Exports and highlights all revision logs to a new worksheet
See the following sample code for your reference. I used your Excel file you attached earlier:
e.g.
Sample code:
Workbook workbook = new Workbook("f:\\files\\Excel With Multi-User Track Changes Hidden Col.xlsx");
HighlightChangesOptions options = new HighlightChangesOptions(true, true);
workbook.getWorksheets().getRevisionLogs().highlightChanges(options);
PdfSaveOptions saveOptions = new PdfSaveOptions();
workbook.save("f:\\files\\out1.pdf", saveOptions);
Hope, this helps a bit.
I am able to get the revision history in the pdf but if the content of revision history too much then it is overflowing to other column.
Excel With Multi-User Track Changes Hidden Col.zip (92.2 KB)