Compare

Compare(string, string, string, string, DateTime)

Compares two documents and saves the differences to the specified output file, producing changes as a number of edit and format revisions.

public static void Compare(string v1, string v2, string outputFileName, string author, 
    DateTime dateTime)
ParameterTypeDescription
v1StringThe original document.
v2StringThe modified document.
outputFileNameStringThe output file name.
authorStringInitials of the author to use for revisions.
dateTimeDateTimeThe date and time to use for revisions.

Examples

Shows how to simple compare documents.

// There is a several ways to compare documents:
string firstDoc = MyDir + "Table column bookmarks.docx";
string secondDoc = MyDir + "Table column bookmarks.doc";

Comparer.Compare(firstDoc, secondDoc, ArtifactsDir + "LowCode.CompareDocuments.1.docx", "Author", new DateTime());
Comparer.Compare(firstDoc, secondDoc, ArtifactsDir + "LowCode.CompareDocuments.2.docx", SaveFormat.Docx, "Author", new DateTime());
Comparer.Compare(firstDoc, secondDoc, ArtifactsDir + "LowCode.CompareDocuments.3.docx", "Author", new DateTime(), new CompareOptions() { IgnoreCaseChanges = true });
Comparer.Compare(firstDoc, secondDoc, ArtifactsDir + "LowCode.CompareDocuments.4.docx", SaveFormat.Docx, "Author", new DateTime(), new CompareOptions() { IgnoreCaseChanges = true });

See Also


Compare(string, string, string, SaveFormat, string, DateTime)

Compares two documents and saves the differences to the specified output file in the provided save format, producing changes as a number of edit and format revisions.

public static void Compare(string v1, string v2, string outputFileName, SaveFormat saveFormat, 
    string author, DateTime dateTime)
ParameterTypeDescription
v1StringThe original document.
v2StringThe modified document.
outputFileNameStringThe output file name.
saveFormatSaveFormatThe output’s save format.
authorStringInitials of the author to use for revisions.
dateTimeDateTimeThe date and time to use for revisions.

Examples

Shows how to simple compare documents.

// There is a several ways to compare documents:
string firstDoc = MyDir + "Table column bookmarks.docx";
string secondDoc = MyDir + "Table column bookmarks.doc";

Comparer.Compare(firstDoc, secondDoc, ArtifactsDir + "LowCode.CompareDocuments.1.docx", "Author", new DateTime());
Comparer.Compare(firstDoc, secondDoc, ArtifactsDir + "LowCode.CompareDocuments.2.docx", SaveFormat.Docx, "Author", new DateTime());
Comparer.Compare(firstDoc, secondDoc, ArtifactsDir + "LowCode.CompareDocuments.3.docx", "Author", new DateTime(), new CompareOptions() { IgnoreCaseChanges = true });
Comparer.Compare(firstDoc, secondDoc, ArtifactsDir + "LowCode.CompareDocuments.4.docx", SaveFormat.Docx, "Author", new DateTime(), new CompareOptions() { IgnoreCaseChanges = true });

See Also


Compare(string, string, string, string, DateTime, CompareOptions)

Compares two documents with additional options and saves the differences to the specified output file, producing changes as a number of edit and format revisions.

public static void Compare(string v1, string v2, string outputFileName, string author, 
    DateTime dateTime, CompareOptions compareOptions)
ParameterTypeDescription
v1StringThe original document.
v2StringThe modified document.
outputFileNameStringThe output file name.
authorStringInitials of the author to use for revisions.
dateTimeDateTimeThe date and time to use for revisions.
compareOptionsCompareOptionsDocument comparison options.

Examples

Shows how to simple compare documents.

// There is a several ways to compare documents:
string firstDoc = MyDir + "Table column bookmarks.docx";
string secondDoc = MyDir + "Table column bookmarks.doc";

Comparer.Compare(firstDoc, secondDoc, ArtifactsDir + "LowCode.CompareDocuments.1.docx", "Author", new DateTime());
Comparer.Compare(firstDoc, secondDoc, ArtifactsDir + "LowCode.CompareDocuments.2.docx", SaveFormat.Docx, "Author", new DateTime());
Comparer.Compare(firstDoc, secondDoc, ArtifactsDir + "LowCode.CompareDocuments.3.docx", "Author", new DateTime(), new CompareOptions() { IgnoreCaseChanges = true });
Comparer.Compare(firstDoc, secondDoc, ArtifactsDir + "LowCode.CompareDocuments.4.docx", SaveFormat.Docx, "Author", new DateTime(), new CompareOptions() { IgnoreCaseChanges = true });

See Also


Compare(string, string, string, SaveFormat, string, DateTime, CompareOptions)

Compares two documents with additional options and saves the differences to the specified output file in the provided save format, producing changes as a number of edit and format revisions.

public static void Compare(string v1, string v2, string outputFileName, SaveFormat saveFormat, 
    string author, DateTime dateTime, CompareOptions compareOptions)
ParameterTypeDescription
v1StringThe original document.
v2StringThe modified document.
outputFileNameStringThe output file name.
saveFormatSaveFormatThe output’s save format.
authorStringInitials of the author to use for revisions.
dateTimeDateTimeThe date and time to use for revisions.
compareOptionsCompareOptionsDocument comparison options.

Examples

Shows how to simple compare documents.

// There is a several ways to compare documents:
string firstDoc = MyDir + "Table column bookmarks.docx";
string secondDoc = MyDir + "Table column bookmarks.doc";

Comparer.Compare(firstDoc, secondDoc, ArtifactsDir + "LowCode.CompareDocuments.1.docx", "Author", new DateTime());
Comparer.Compare(firstDoc, secondDoc, ArtifactsDir + "LowCode.CompareDocuments.2.docx", SaveFormat.Docx, "Author", new DateTime());
Comparer.Compare(firstDoc, secondDoc, ArtifactsDir + "LowCode.CompareDocuments.3.docx", "Author", new DateTime(), new CompareOptions() { IgnoreCaseChanges = true });
Comparer.Compare(firstDoc, secondDoc, ArtifactsDir + "LowCode.CompareDocuments.4.docx", SaveFormat.Docx, "Author", new DateTime(), new CompareOptions() { IgnoreCaseChanges = true });

See Also


Compare(Stream, Stream, Stream, SaveFormat, string, DateTime)

Compares two documents loaded from streams and saves the differences to the provided output stream in the specified save format, producing changes as a number of edit and format revisions.

public static void Compare(Stream v1, Stream v2, Stream outputStream, SaveFormat saveFormat, 
    string author, DateTime dateTime)
ParameterTypeDescription
v1StreamThe original document.
v2StreamThe modified document.
outputStreamStreamThe output stream.
saveFormatSaveFormatThe output’s save format.
authorStringInitials of the author to use for revisions.
dateTimeDateTimeThe date and time to use for revisions.

Examples

Shows how to compare documents from the stream.

// There is a several ways to compare documents from the stream:
using (FileStream firstStreamIn = new FileStream(MyDir + "Table column bookmarks.docx", FileMode.Open, FileAccess.Read))
{
    using (FileStream secondStreamIn = new FileStream(MyDir + "Table column bookmarks.doc", FileMode.Open, FileAccess.Read))
    {
        using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.CompareStreamDocuments.1.docx", FileMode.Create, FileAccess.ReadWrite))
            Comparer.Compare(firstStreamIn, secondStreamIn, streamOut, SaveFormat.Docx, "Author", new DateTime());

        using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.CompareStreamDocuments.2.docx", FileMode.Create, FileAccess.ReadWrite))
            Comparer.Compare(firstStreamIn, secondStreamIn, streamOut, SaveFormat.Docx, "Author", new DateTime(), new CompareOptions() { IgnoreCaseChanges = true });
    }
}

See Also


Compare(Stream, Stream, Stream, SaveFormat, string, DateTime, CompareOptions)

Compares two documents loaded from streams with additional options and saves the differences to the provided output stream in the specified save format, producing changes as a number of edit and format revisions.

public static void Compare(Stream v1, Stream v2, Stream outputStream, SaveFormat saveFormat, 
    string author, DateTime dateTime, CompareOptions compareOptions)
ParameterTypeDescription
v1StreamThe original document.
v2StreamThe modified document.
outputStreamStreamThe output stream.
saveFormatSaveFormatThe output’s save format.
authorStringInitials of the author to use for revisions.
dateTimeDateTimeThe date and time to use for revisions.
compareOptionsCompareOptionsDocument comparison options.

Examples

Shows how to compare documents from the stream.

// There is a several ways to compare documents from the stream:
using (FileStream firstStreamIn = new FileStream(MyDir + "Table column bookmarks.docx", FileMode.Open, FileAccess.Read))
{
    using (FileStream secondStreamIn = new FileStream(MyDir + "Table column bookmarks.doc", FileMode.Open, FileAccess.Read))
    {
        using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.CompareStreamDocuments.1.docx", FileMode.Create, FileAccess.ReadWrite))
            Comparer.Compare(firstStreamIn, secondStreamIn, streamOut, SaveFormat.Docx, "Author", new DateTime());

        using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.CompareStreamDocuments.2.docx", FileMode.Create, FileAccess.ReadWrite))
            Comparer.Compare(firstStreamIn, secondStreamIn, streamOut, SaveFormat.Docx, "Author", new DateTime(), new CompareOptions() { IgnoreCaseChanges = true });
    }
}

See Also