Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

OfficeUnifiedDiff

OfficeIMO.Diff

Namespace
OfficeIMO.Diff
Assembly
OfficeIMO.Core
Source revision
ba882f6b0d07 with working tree changes
Modifiers
static

Writes line diffs in the unified format read by patch and git apply.

Inheritance

  • object
  • OfficeUnifiedDiff

Methods

public static string Create(string? oldText, string? newText, string oldName = "a", string newName = "b", int contextLines = 3, OfficeDiffOptions? options = null, CancellationToken cancellationToken = default) #

Compares two texts line by line and writes a unified diff. Returns an empty string when the texts are equal.

Parameters

oldText string? required
Old text.
newText string? required
New text.
oldName string = "a" optional
Name on the --- header line.
newName string = "b" optional
Name on the +++ header line.
contextLines int = 3 optional
Unchanged lines shown around each change.
options OfficeIMO.Diff.OfficeDiffOptions? = null optional
Diff settings.
cancellationToken System.Threading.CancellationToken = default optional
Cancels the alignment.

Returns

string
public static string Format(OfficeDiffResult<OfficeTextToken> lineDiff, string oldName = "a", string newName = "b", int contextLines = 3) #

Writes a unified diff for a line diff produced by OfficeDiff.CompareLines.

Parameters

lineDiff OfficeIMO.Diff.OfficeDiffResult<OfficeIMO.Diff.OfficeTextToken> required
oldName string = "a" optional
newName string = "b" optional
contextLines int = 3 optional

Returns

string