Class RevisionCellChange
Contents
[
Hide
]RevisionCellChange class
Represents the revision that changing cells.
public class RevisionCellChange : Revision
Properties
| Name | Description |
|---|---|
| CellName { get; } | Gets the name of the cell. |
| Column { get; } | Gets the column index of the cell. |
| Id { get; } | Gets the number of this revision.(Inherited from Revision.) |
| IsNewFormatted { get; } | Indicates whether this cell is new formatted. |
| IsOldFormatted { get; } | Indicates whether this cell is old formatted. |
| NewFormula { get; } | Gets the old formula. |
| NewStyle { get; } | Gets the new style of the cell. |
| NewValue { get; } | Gets new value of the cell. |
| OldFormula { get; } | Gets the old formula. |
| OldStyle { get; } | Gets the old style of the cell. |
| OldValue { get; } | Gets old value of the cell. |
| Row { get; } | Gets the row index of the cell. |
| override Type { get; } | Represents the type of revision. |
| Worksheet { get; } | Gets the worksheet.(Inherited from Revision.) |
Examples
using System;
using Aspose.Cells;
using Aspose.Cells.Revisions;
namespace AsposeCellsExamples
{
public class RevisionsClassRevisionCellChangeDemo
{
public static void Run()
{
// Create output directory if it doesn't exist
string outputDir = "output/";
System.IO.Directory.CreateDirectory(outputDir);
string filePath = outputDir + "RevisionsClassRevisionCellChangeDemo_out.xlsx";
// Create initial workbook and enable sharing
Workbook workbook = new Workbook();
workbook.Settings.Shared = true;
workbook.Save(filePath, SaveFormat.Xlsx);
// Reopen workbook to make tracked changes
Workbook workbook2 = new Workbook(filePath);
Worksheet sheet = workbook2.Worksheets[0];
// First revision: Set initial values
sheet.Cells["A1"].PutValue("Initial Value");
sheet.Cells["B2"].PutValue(100);
workbook2.Save(filePath, SaveFormat.Xlsx);
// Second revision: Modify values
sheet.Cells["A1"].PutValue("Updated Value");
sheet.Cells["B2"].PutValue(200);
workbook2.Save(filePath, SaveFormat.Xlsx);
// Load workbook to access revision logs
Workbook workbook3 = new Workbook(filePath);
// Process all revision logs
foreach (RevisionLog log in workbook3.Worksheets.RevisionLogs)
{
foreach (Revision rev in log.Revisions)
{
if (rev.Type == RevisionType.ChangeCells)
{
RevisionCellChange rcc = (RevisionCellChange)rev;
Console.WriteLine($"Revision Type: {rev.Type}");
Console.WriteLine($"Cell: {rcc.CellName} (Row: {rcc.Row}, Column: {rcc.Column})");
Console.WriteLine($"Old Value: {rcc.OldValue ?? "null"}");
Console.WriteLine($"New Value: {rcc.NewValue ?? "null"}");
Console.WriteLine("------------------------------------");
}
}
}
}
}
}
See Also
- class Revision
- namespace Aspose.Cells.Revisions
- assembly Aspose.Cells