Skip to content

Commit 1b05ce0

Browse files
Basic Examples
1 parent 4c554ad commit 1b05ce0

40 files changed

Lines changed: 1763 additions & 0 deletions

File tree

content/english/net/_index.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: Comprehensive Tutorials and Examples of GroupDocs.Comparison for .NET
3+
linktitle: GroupDocs.Comparison for .NET Tutorials
4+
type: docs
5+
weight: 10
6+
url: /net/
7+
description:
8+
is_root: true
9+
---
10+
11+
### [Documents and Folder Comparison](./documents-and-folder-comparison/)
12+
13+
### [Document Comparison](./document-comparison/)
14+
15+
### [Loading and Saving Documents](./loading-and-saving-documents/)
16+
17+
### [Image Comparison](./image-comparison/)
18+
19+
### [Basic Usage](./basic-usage/)
20+
21+
### [Quick Start](./quick-start/)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: Basic Usage
3+
linktitle: Basic Usage
4+
second_title: GroupDocs.Comparison .NET API
5+
description:
6+
type: docs
7+
weight: 24
8+
url: /net/basic-usage/
9+
---
10+
11+
## Basic Usage Tutorials
12+
### [Compare Cells from Path - GroupDocs.Comparison for .NET](./compare-cells-from-path/)
13+
### [Compare Cells from Stream - GroupDocs.Comparison for .NET](./compare-cells-from-stream/)
14+
### [Get Document Info from Result Document - GroupDocs.Comparison for .NET](./get-document-info-from-result-document/)
15+
### [Get Document Info from Path - GroupDocs.Comparison for .NET](./get-document-info-from-path/)
16+
### [Get Document Info from Stream - GroupDocs.Comparison for .NET](./get-document-info-from-stream/)
17+
### [Get Supported Formats - GroupDocs.Comparison for .NET](./get-supported-formats/)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: Compare Cells from Path - GroupDocs.Comparison for .NET
3+
linktitle: Compare Cells from Path - GroupDocs.Comparison for .NET
4+
second_title: GroupDocs.Comparison .NET API
5+
description:
6+
type: docs
7+
weight: 10
8+
url: /net/basic-usage/compare-cells-from-path/
9+
---
10+
11+
## Complete Source Code
12+
```csharp
13+
using System;
14+
using System.IO;
15+
16+
namespace GroupDocs.Comparison.Examples.CSharp.BasicUsage
17+
{
18+
/// <summary>
19+
/// This example demonstrates comparing of two cells files
20+
/// </summary>
21+
class CompareCellsFromPath
22+
{
23+
public static void Run()
24+
{
25+
Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
26+
Console.WriteLine("[Example Basic Usage] # CompareCellsFromPath : comparing of two cells files\n");
27+
28+
string outputDirectory = "Your Document Directory";
29+
string outputFileName = Path.Combine(outputDirectory, "result.xlsx");
30+
31+
using (Comparer comparer = new Comparer("source.xlsx"))
32+
{
33+
comparer.Add("target.xlsx");
34+
comparer.Compare(outputFileName);
35+
}
36+
Console.WriteLine($"\nDocuments compared successfully.\nCheck output in {outputDirectory}.");
37+
}
38+
}
39+
}
40+
41+
```
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: Compare Cells from Stream - GroupDocs.Comparison for .NET
3+
linktitle: Compare Cells from Stream - GroupDocs.Comparison for .NET
4+
second_title: GroupDocs.Comparison .NET API
5+
description:
6+
type: docs
7+
weight: 11
8+
url: /net/basic-usage/compare-cells-from-stream/
9+
---
10+
11+
## Complete Source Code
12+
```csharp
13+
using System;
14+
using System.IO;
15+
16+
namespace GroupDocs.Comparison.Examples.CSharp.BasicUsage
17+
{
18+
/// <summary>
19+
/// This example demonstrates comparing of two cells files
20+
/// </summary>
21+
class CompareCellsFromStream
22+
{
23+
public static void Run()
24+
{
25+
Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
26+
Console.WriteLine("[Example Basic Usage] # CompareCellsFromStream : comparing of two cells files\n");
27+
28+
string outputDirectory = "Your Document Directory";
29+
string outputFileName = Path.Combine(outputDirectory, "result.xlsx");
30+
31+
using (Comparer comparer = new Comparer(File.OpenRead("source.xlsx")))
32+
{
33+
comparer.Add(File.OpenRead("target.xlsx"));
34+
comparer.Compare(File.Create(outputFileName));
35+
}
36+
Console.WriteLine($"\nDocuments compared successfully.\nCheck output in {outputDirectory}.");
37+
}
38+
}
39+
}
40+
41+
```
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: Get Document Info from Path - GroupDocs.Comparison for .NET
3+
linktitle: Get Document Info from Path - GroupDocs.Comparison for .NET
4+
second_title: GroupDocs.Comparison .NET API
5+
description:
6+
type: docs
7+
weight: 13
8+
url: /net/basic-usage/get-document-info-from-path/
9+
---
10+
11+
## Complete Source Code
12+
```csharp
13+
using System;
14+
15+
namespace GroupDocs.Comparison.Examples.CSharp.BasicUsage
16+
{
17+
using GroupDocs.Comparison.Interfaces;
18+
/// <summary>
19+
/// This example demonstrates document info extraction
20+
/// </summary>
21+
class GetDocumentInfoPath
22+
{
23+
public static void Run()
24+
{
25+
Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
26+
Console.WriteLine("[Example Basic Usage] # GetDocumentInfoPath : document info extraction\n");
27+
28+
using (Comparer comparer = new Comparer("SOURCE.docx"))
29+
{
30+
IDocumentInfo info = comparer.Source.GetDocumentInfo();
31+
Console.WriteLine("\nFile type: {0}\nNumber of pages: {1}\nDocument size: {2} bytes", info.FileType, info.PageCount, info.Size);
32+
}
33+
Console.WriteLine($"\nDocument info extracted successfully.");
34+
}
35+
}
36+
}
37+
```
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: Get Document Info from Result Document - GroupDocs.Comparison for .NET
3+
linktitle: Get Document Info from Result Document - GroupDocs.Comparison for .NET
4+
second_title: GroupDocs.Comparison .NET API
5+
description:
6+
type: docs
7+
weight: 12
8+
url: /net/basic-usage/get-document-info-from-result-document/
9+
---
10+
11+
## Complete Source Code
12+
```csharp
13+
using System;
14+
using System.IO;
15+
using System.Linq;
16+
17+
namespace GroupDocs.Comparison.Examples.CSharp.BasicUsage
18+
{
19+
using GroupDocs.Comparison;
20+
using GroupDocs.Comparison.Interfaces;
21+
22+
/// <summary>
23+
/// This example demonstrates result document object info extraction
24+
/// </summary>
25+
class GetDocumentInfoFromResultDocument
26+
{
27+
public static void Run()
28+
{
29+
Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
30+
Console.WriteLine("[Example Basic Usage] # GetDocumentInfoFromResultDocument : result document object info extraction\n");
31+
32+
using (Comparer comparer = new Comparer(File.OpenRead("SOURCE.docx")))
33+
{
34+
comparer.Add(File.OpenRead("TARGET.docx"));
35+
IDocumentInfo info = comparer.Targets.FirstOrDefault().GetDocumentInfo();
36+
Console.WriteLine("\nFile type: {0}\nNumber of pages: {1}\nDocument size: {2} bytes", info.FileType, info.PageCount, info.Size);
37+
}
38+
Console.WriteLine($"\nDocument info extracted successfully.");
39+
}
40+
}
41+
}
42+
43+
44+
45+
```
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: Get Document Info from Stream - GroupDocs.Comparison for .NET
3+
linktitle: Get Document Info from Stream - GroupDocs.Comparison for .NET
4+
second_title: GroupDocs.Comparison .NET API
5+
description:
6+
type: docs
7+
weight: 14
8+
url: /net/basic-usage/get-document-info-from-stream/
9+
---
10+
11+
## Complete Source Code
12+
```csharp
13+
using System;
14+
using System.IO;
15+
16+
namespace GroupDocs.Comparison.Examples.CSharp.BasicUsage
17+
{
18+
using GroupDocs.Comparison.Interfaces;
19+
20+
/// <summary>
21+
/// This example demonstrates document info extraction
22+
/// </summary>
23+
class GetDocumentInfoStream
24+
{
25+
public static void Run()
26+
{
27+
Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
28+
Console.WriteLine("[Example Basic Usage] # GetDocumentInfoStream : document info extraction\n");
29+
30+
using (Comparer comparer = new Comparer(File.OpenRead("SOURCE.docx")))
31+
{
32+
IDocumentInfo info = comparer.Source.GetDocumentInfo();
33+
Console.WriteLine("\nFile type: {0}\nNumber of pages: {1}\nDocument size: {2} bytes", info.FileType, info.PageCount, info.Size);
34+
}
35+
Console.WriteLine($"\nDocument info extracted successfully.");
36+
}
37+
}
38+
}
39+
```
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: Get Supported Formats - GroupDocs.Comparison for .NET
3+
linktitle: Get Supported Formats - GroupDocs.Comparison for .NET
4+
second_title: GroupDocs.Comparison .NET API
5+
description:
6+
type: docs
7+
weight: 15
8+
url: /net/basic-usage/get-supported-formats/
9+
---
10+
11+
## Complete Source Code
12+
```csharp
13+
using System;
14+
using System.Linq;
15+
using System.Collections.Generic;
16+
17+
namespace GroupDocs.Comparison.Examples.CSharp.BasicUsage
18+
{
19+
using GroupDocs.Comparison;
20+
using GroupDocs.Comparison.Result;
21+
22+
/// <summary>
23+
/// This example demonstrates file types support
24+
/// </summary>
25+
internal class GetSupportedFormats
26+
{
27+
public static void Run()
28+
{
29+
Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
30+
Console.WriteLine("[Example Basic Usage] # GetSupportedFormats : list of the file types support\n");
31+
32+
IEnumerable<FileType> fileTypes = FileType
33+
.GetSupportedFileTypes()
34+
.OrderBy(fileType => fileType.Extension);
35+
foreach (FileType fileType in fileTypes)
36+
Console.WriteLine(fileType);
37+
Console.WriteLine("\nSupported file types retrieved successfully.");
38+
}
39+
}
40+
}
41+
```
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: Document Comparison
3+
linktitle: Document Comparison
4+
second_title: GroupDocs.Comparison .NET API
5+
description:
6+
type: docs
7+
weight: 21
8+
url: /net/document-comparison/
9+
---
10+
11+
## Document Comparison Tutorials
12+
### [Generate Page Previews for Resultant Document](./generate-page-previews-resultant-document/)
13+
### [Generate Page Previews for Source Document](./generate-page-previews-source-document/)
14+
### [Generate Page Previews for Target Document](./generate-page-previews-target-document/)
15+
### [Clean Resources After Page Previews](./clean-resources-after-page-previews/)
16+
### [Set Specific Image Sizes for Previews](./set-specific-image-sizes-for-previews/)
17+
### [Compare Documents from Path - GroupDocs.Comparison for .NET](./compare-documents-from-path/)
18+
### [Compare Documents from Stream - GroupDocs.Comparison for .NET](./compare-documents-from-stream/)
19+
### [Compare Protected Documents from Path - GroupDocs.Comparison for .NET](./compare-protected-documents-from-path/)
20+
### [Compare Protected Documents from Stream - GroupDocs.Comparison for .NET](./compare-protected-documents-from-stream/)
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
title: Clean Resources After Page Previews
3+
linktitle: Clean Resources After Page Previews
4+
second_title: GroupDocs.Comparison .NET API
5+
description:
6+
type: docs
7+
weight: 13
8+
url: /net/document-comparison/clean-resources-after-page-previews/
9+
---
10+
11+
## Complete Source Code
12+
```csharp
13+
using System;
14+
using System.IO;
15+
16+
namespace GroupDocs.Comparison.Examples.CSharp.AdvancedUsage
17+
{
18+
using GroupDocs.Comparison;
19+
using GroupDocs.Comparison.Options;
20+
21+
/// <summary>
22+
/// This example demonstrates how to get document previews with user memory clean code
23+
/// </summary>
24+
class GetPagePreviewsResouresCleaning
25+
{
26+
/// <summary>
27+
/// User example code for releasing image stream memory
28+
/// </summary>
29+
/// <param name="pageNumber"></param>
30+
/// <param name="stream"></param>
31+
private static void UserReleaseStreamMethod(int pageNumber, Stream stream)
32+
{
33+
Console.WriteLine($"Releasing memory for page: {pageNumber}");
34+
stream.Close();
35+
}
36+
37+
public static void Run()
38+
{
39+
Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
40+
Console.WriteLine("[Example Advanced Usage] # GetPagePreviewsResouresCleaning : how to get document previews with user memory clean code\n");
41+
42+
string outputDirectory = "Your Document Directory";
43+
string outputFileName = Path.Combine(outputDirectory, "RESULT.pptx");
44+
45+
using (Comparer comparer = new Comparer("SOURCE.pptx"))
46+
{
47+
comparer.Add("TARGET.pptx");
48+
comparer.Compare(File.Create(outputFileName));
49+
Document document = new Document(File.OpenRead(outputFileName));
50+
PreviewOptions previewOptions = new PreviewOptions(pageNumber =>
51+
{
52+
var pagePath = Path.Combine(Constants.SamplesPath, $"result_{pageNumber}.png");
53+
return File.Create(pagePath);
54+
});
55+
previewOptions.PreviewFormat = PreviewFormats.PNG;
56+
previewOptions.PageNumbers = new int[] { 1, 2 };
57+
previewOptions.ReleasePageStream = UserReleaseStreamMethod;
58+
document.GeneratePreview(previewOptions);
59+
}
60+
Console.WriteLine($"\nDocument previews generated successfully.\nCheck output in {outputDirectory}.");
61+
}
62+
}
63+
}
64+
65+
```

0 commit comments

Comments
 (0)