C#/VB.NET: convertir PDF a HTML
Tabla de contenido
Instalado a través de NuGet
PM> Install-Package Spire.PDF
enlaces relacionados
Por varias razones, es posible que desee convertir PDF a HTML. Por ejemplo, necesita compartir documentos PDF en las redes sociales o publicar contenido PDF en la web. En este artículo, aprenderá cómo convertir PDF a HTML en C# y VB.NET usando Spire.PDF for .NET.
Instalar Spire.PDF for .NET
Para empezar, debe agregar los archivos DLL incluidos en el paquete Spire.PDF for .NET como referencias en su proyecto .NET. Los archivos DLL se pueden descargar desde este enlace o instalar a través de NuGet.
PM> Install-Package Spire.PDF
Convierta PDF a HTML en C# y VB.NET
Los siguientes son los pasos para convertir un documento PDF a HTML:
- Inicialice una instancia de la clase PdfDocument.
- Cargue un documento PDF utilizando el método PdfDocument.LoadFromFile(filePath).
- Guarde el documento PDF como HTML utilizando el método PdfDocument.SaveToFile(filePath, FileFormat.HTML).
- C#
- VB.NET
using Spire.Pdf;
namespace ConvertPdfToHtml
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument instance
PdfDocument pdf = new PdfDocument();
//Load a PDF document
pdf.LoadFromFile(@"C:\Users\Administrator\Desktop\Sample.pdf");
//Save the PDF document as HTML
pdf.SaveToFile(@"C:\Users\Administrator\Desktop\ToHtml.html", FileFormat.HTML);
}
}
}

Solicitar una Licencia Temporal
Si desea eliminar el mensaje de evaluación de los documentos generados o deshacerse de las limitaciones de la función, por favor solicitar una licencia de prueba de 30 días para ti.
C#/VB.NET: PDF를 HTML로 변환
NuGet을 통해 설치됨
PM> Install-Package Spire.PDF
관련된 링크들
다양한 이유로 PDF를 HTML로 변환할 수 있습니다. 예를 들어 소셜 미디어에서 PDF 문서를 공유하거나 웹에서 PDF 콘텐츠를 게시해야 합니다. 이 기사에서는 다음을 수행하는 방법을 배웁니다 C# 및 VB.NET에서 PDF를 HTML로 변환 using Spire.PDF for .NET사용.
Spire.PDF for .NET 설치
먼저 Spire.PDF for .NET 패키지에 포함된 DLL 파일을 .NET 프로젝트의 참조로 추가해야 합니다. DLL 파일은 이 링크에서 다운로드하거나 NuGet을 통해 설치할 수 있습니다.
PM> Install-Package Spire.PDF
C# 및 VB.NET에서 PDF를 HTML로 변환
다음은 PDF 문서를 HTML로 변환하는 단계입니다.
- PdfDocument 클래스의 인스턴스를 초기화합니다.
- PdfDocument.LoadFromFile(filePath) 메서드를 사용하여 PDF 문서를 로드합니다.
- PdfDocument.SaveToFile(filePath, FileFormat.HTML) 메서드를 사용하여 PDF 문서를 HTML로 저장합니다.
- C#
- VB.NET
using Spire.Pdf;
namespace ConvertPdfToHtml
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument instance
PdfDocument pdf = new PdfDocument();
//Load a PDF document
pdf.LoadFromFile(@"C:\Users\Administrator\Desktop\Sample.pdf");
//Save the PDF document as HTML
pdf.SaveToFile(@"C:\Users\Administrator\Desktop\ToHtml.html", FileFormat.HTML);
}
}
}

임시 면허 신청
생성된 문서에서 평가 메시지를 제거하거나 기능 제한을 제거하려면 다음을 수행하십시오 30일 평가판 라이선스 요청 자신을 위해.
C#/VB.NET: Converti PDF in HTML
Installato tramite NuGet
PM> Install-Package Spire.PDF
Link correlati
Per vari motivi, potresti voler convertire PDF in HTML. Ad esempio, è necessario condividere documenti PDF sui social media o pubblicare contenuti PDF sul Web. In questo articolo imparerai come convertire PDF in HTML in C# e VB.NET utilizzando Spire.PDF for .NET.
Installa Spire.PDF for .NET
Per cominciare, è necessario aggiungere i file DLL inclusi nel pacchetto Spire.PDF for.NET come riferimenti nel progetto .NET. I file DLL possono essere scaricati da questo link o installato tramite NuGet.
PM> Install-Package Spire.PDF
Converti PDF in HTML in C# e VB.NET
Di seguito sono riportati i passaggi per convertire un documento PDF in HTML:
- Inizializza un'istanza della classe PdfDocument.
- Carica un documento PDF utilizzando il metodo PdfDocument.LoadFromFile(filePath).
- Salvare il documento PDF come HTML utilizzando il metodo PdfDocument.SaveToFile(filePath, FileFormat.HTML).
- C#
- VB.NET
using Spire.Pdf;
namespace ConvertPdfToHtml
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument instance
PdfDocument pdf = new PdfDocument();
//Load a PDF document
pdf.LoadFromFile(@"C:\Users\Administrator\Desktop\Sample.pdf");
//Save the PDF document as HTML
pdf.SaveToFile(@"C:\Users\Administrator\Desktop\ToHtml.html", FileFormat.HTML);
}
}
}

Richiedi una licenza temporanea
Se desideri rimuovere il messaggio di valutazione dai documenti generati o eliminare le limitazioni delle funzioni, per favore richiedere una licenza di prova di 30 giorni per te.
C#/VB.NET : convertir un PDF en HTML
Table des matières
Installé via NuGet
PM> Install-Package Spire.PDF
Liens connexes
Pour diverses raisons, vous souhaiterez peut-être convertir un PDF en HTML. Par exemple, vous devez partager des documents PDF sur les réseaux sociaux ou publier du contenu PDF sur le Web. Dans cet article, vous apprendrez à convertir PDF en HTML en C# et VB.NET en utilisant Spire.PDF for .NET.
Installer Spire.PDF for .NET
Pour commencer, vous devez ajouter les fichiers DLL inclus dans le package Spire.PDF for .NET en tant que références dans votre projet .NET. Les fichiers DLL peuvent être téléchargés à partir de ce lien ou installés via NuGet.
PM> Install-Package Spire.PDF
Convertir PDF en HTML en C# et VB.NET
Voici les étapes pour convertir un document PDF en HTML :
- Initialiser une instance de la classe PdfDocument.
- Chargez un document PDF à l'aide de la méthode PdfDocument.LoadFromFile(filePath).
- Enregistrez le document PDF au format HTML à l'aide de la méthode PdfDocument.SaveToFile(filePath, FileFormat.HTML).
- C#
- VB.NET
using Spire.Pdf;
namespace ConvertPdfToHtml
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument instance
PdfDocument pdf = new PdfDocument();
//Load a PDF document
pdf.LoadFromFile(@"C:\Users\Administrator\Desktop\Sample.pdf");
//Save the PDF document as HTML
pdf.SaveToFile(@"C:\Users\Administrator\Desktop\ToHtml.html", FileFormat.HTML);
}
}
}

Demander une licence temporaire
Si vous souhaitez supprimer le message d'évaluation des documents générés ou vous débarrasser des limitations de la fonction, veuillez demander une licence d'essai de 30 jours pour toi.
C#/VB.NET: comparar dois documentos do Word
Índice
Instalado via NuGet
PM> Install-Package Spire.Doc
Links Relacionados
Não é incomum no trabalho recebermos duas versões de um documento do Word e nos depararmos com a necessidade de encontrar as diferenças entre elas. A comparação de documentos é particularmente importante e popular nas áreas de leis, regulamentos e educação. Neste artigo, você aprenderá como comparar dois documentos do Word em C# e VB.NET usando o Spire.Doc for .NET.
- Compare dois documentos e salve o resultado em um terceiro documento do Word
- Comparar dois documentos e retornar inserções e exclusões em listas
Abaixo está uma captura de tela dos dois documentos do Word que serão comparados.

Instalar o Spire.Doc for .NET
Para começar, você precisa adicionar os arquivos DLL incluídos no pacote Spire.Doc for .NET como referências em seu projeto .NET. Os arquivos DLL podem ser baixados deste link ou instalados via NuGet.
PM> Install-Package Spire.Doc
Compare dois documentos e salve o resultado em um terceiro documento do Word
Salvar o resultado da comparação em um documento separado do Word nos permite ver todas as alterações feitas no documento original, incluindo inserções, exclusões e modificações na formatação. A seguir estão as etapas para comparar dois documentos e salvar o resultado em um terceiro documento do Word usando o Spire.Doc for .NET.
- Carregue dois documentos do Word separadamente enquanto inicializa os objetos Documento.
- Compare esses dois documentos usando o método Document.Compare().
- Salve o resultado em um terceiro documento do Word usando o método ;Document.SaveToFile().
- C#
- VB.NET
using Spire.Doc;
namespace CompareDocuments
{
class Program
{
static void Main(string[] args)
{
//Load one Word document
Document doc1 = new Document("C:\\Users\\Administrator\\Desktop\\original.docx");
//Load the other Word document
Document doc2 = new Document("C:\\Users\\Administrator\\Desktop\\revised.docx");
//Compare two documents
doc1.Compare(doc2, "John");
//Save the differences in a third document
doc1.SaveToFile("Differences.docx", FileFormat.Docx2013);
doc1.Dispose();
}
}
}

Comparar dois documentos e retornar inserções e exclusões em listas
Os desenvolvedores podem querer apenas obter as inserções e exclusões em vez de todas as diferenças. A seguir estão as etapas para obter inserções e exclusões em duas listas separadas.
- Carregue dois documentos do Word separadamente enquanto inicializa os objetos Documento.
- Compare dois documentos usando o método Document.Compare().
- Obtenha as revisões usando a função construtora da classe DifferRevisions ;
- Obtenha uma lista de inserções por meio da propriedade DifferRevisions.InsertRevisions.
- Obtenha uma lista de exclusões por meio da propriedade DifferRevisions.DeleteRevisions.
- Percorra os elementos nas duas listas para obter a inserção e exclusão específicas.
- C#
- VB.NET
using Spire.Doc;
using Spire.Doc.Fields;
using System;
namespace GetDifferencesInList
{
class Program
{
static void Main(string[] args)
{
//Load one Word document
Document doc1 = new Document("C:\\Users\\Administrator\\Desktop\\original.docx");
//Load the other Word document
Document doc2 = new Document("C:\\Users\\Administrator\\Desktop\\revised.docx");
//Compare the two Word documents
doc1.Compare(doc2, "Author");
//Get the revisions
DifferRevisions differRevisions = new DifferRevisions(doc1);
//Return the insertion revisions in a list
var insetRevisionsList = differRevisions.InsertRevisions;
//Return the deletion revisions in a list
var deletRevisionsList = differRevisions.DeleteRevisions;
//Create two int variables
int m = 0;
int n = 0;
//Loop through the insertion revision list
for (int i = 0; i < insetRevisionsList.Count; i++)
{
if (insetRevisionsList[i] is TextRange)
{
m += 1;
//Get the specific revision and get its content
TextRange textRange = insetRevisionsList[i] as TextRange;
Console.WriteLine("Insertion #" + m + ":" + textRange.Text);
}
}
Console.WriteLine("=====================");
//Loop through the deletion revision list
for (int i = 0; i < deletRevisionsList.Count; i++)
{
if (deletRevisionsList[i] is TextRange)
{
n += 1;
//Get the specific revision and get its content
TextRange textRange = deletRevisionsList[i] as TextRange;
Console.WriteLine("Deletion #" + n + ":" + textRange.Text);
}
}
Console.ReadKey();
}
}
}

Solicitar uma licença temporária
Se você deseja remover a mensagem de avaliação dos documentos gerados ou se livrar das limitações de função, por favor solicite uma licença de teste de 30 dias para você mesmo.
C#/VB.NET: сравнение двух документов Word
Оглавление
Установлено через NuGet
PM> Install-Package Spire.Doc
Ссылки по теме
Нередко на работе мы можем получить две версии документа Word и столкнуться с необходимостью найти различия между ними. Сравнение документов особенно важно и популярно в области законов, правил и образования. В этой статье вы узнаете, как сравнить два документа Word на C# и VB.NET. с помощью Spire.Doc for .NET.
- Сравните два документа и сохраните результат в третьем документе Word
- Сравните два документа и верните вставки и удаления в списках
Ниже приведен скриншот двух документов Word, которые будут сравниваться.

Установите Spire.Doc for .NET
Для начала вам необходимо добавить файлы DLL, включенные в пакет Spire.Doc for .NET, в качестве ссылок в ваш проект .NET. Файлы DLL можно загрузить по этой ссылке или установить через NuGet.
PM> Install-Package Spire.Doc
Сравните два документа и сохраните результат в третьем документе Word
Сохранение результата сравнения в отдельном документе Word позволяет увидеть все изменения, внесенные в исходный документ, включая вставки, удаления, а также модификации форматирования. Ниже приведены шаги для сравнения двух документов и сохранения результата в третьем документе Word с помощью Spire.Doc for .NET.
- Загрузите два документа Word по отдельности при инициализации объектов Document.
- Сравните эти два документа, используя метод Document.Compare().
- Сохраните результат в третьем документе Word, используя метод ;Document.SaveToFile().
- C#
- VB.NET
using Spire.Doc;
namespace CompareDocuments
{
class Program
{
static void Main(string[] args)
{
//Load one Word document
Document doc1 = new Document("C:\\Users\\Administrator\\Desktop\\original.docx");
//Load the other Word document
Document doc2 = new Document("C:\\Users\\Administrator\\Desktop\\revised.docx");
//Compare two documents
doc1.Compare(doc2, "John");
//Save the differences in a third document
doc1.SaveToFile("Differences.docx", FileFormat.Docx2013);
doc1.Dispose();
}
}
}

Сравните два документа и верните вставки и удаления в списках
Разработчики могут захотеть получить только вставки и удаления, а не все различия. Ниже приведены шаги для получения вставок и удалений в двух отдельных списках.
- Загрузите два документа Word по отдельности при инициализации объектов Document.
- Сравните два документа с помощью метода Document.Compare().
- Получите ревизии с помощью функции-конструктора класса DifferRevisions.
- Получить список вставок через свойство DifferRevisions.InsertRevisions.
- Получить список удалений через свойство DifferRevisions.DeleteRevisions.
- Переберите элементы в двух списках, чтобы получить конкретную вставку и удаление.
- C#
- VB.NET
using Spire.Doc;
using Spire.Doc.Fields;
using System;
namespace GetDifferencesInList
{
class Program
{
static void Main(string[] args)
{
//Load one Word document
Document doc1 = new Document("C:\\Users\\Administrator\\Desktop\\original.docx");
//Load the other Word document
Document doc2 = new Document("C:\\Users\\Administrator\\Desktop\\revised.docx");
//Compare the two Word documents
doc1.Compare(doc2, "Author");
//Get the revisions
DifferRevisions differRevisions = new DifferRevisions(doc1);
//Return the insertion revisions in a list
var insetRevisionsList = differRevisions.InsertRevisions;
//Return the deletion revisions in a list
var deletRevisionsList = differRevisions.DeleteRevisions;
//Create two int variables
int m = 0;
int n = 0;
//Loop through the insertion revision list
for (int i = 0; i < insetRevisionsList.Count; i++)
{
if (insetRevisionsList[i] is TextRange)
{
m += 1;
//Get the specific revision and get its content
TextRange textRange = insetRevisionsList[i] as TextRange;
Console.WriteLine("Insertion #" + m + ":" + textRange.Text);
}
}
Console.WriteLine("=====================");
//Loop through the deletion revision list
for (int i = 0; i < deletRevisionsList.Count; i++)
{
if (deletRevisionsList[i] is TextRange)
{
n += 1;
//Get the specific revision and get its content
TextRange textRange = deletRevisionsList[i] as TextRange;
Console.WriteLine("Deletion #" + n + ":" + textRange.Text);
}
}
Console.ReadKey();
}
}
}

Подать заявку на временную лицензию
Если вы хотите удалить оценочное сообщение из сгенерированных документов или избавиться от функциональных ограничений, пожалуйста запросить 30-дневную пробную лицензию для себя.
C#/VB.NET: Vergleichen Sie zwei Word-Dokumente
Inhaltsverzeichnis
Über NuGet installiert
PM> Install-Package Spire.Doc
verwandte Links
Es ist nicht ungewöhnlich, dass wir bei der Arbeit zwei Versionen eines Word-Dokuments erhalten und die Unterschiede zwischen ihnen herausfinden müssen. Besonders wichtig und beliebt ist der Dokumentenvergleich in den Bereichen Gesetze, Vorschriften und Bildung. In diesem Artikel erfahren Sie, wie Sie zwei Word-Dokumente in C# und VB.NET vergleichen durch Verwendung von Spire.Doc for .NET.
- Vergleichen Sie zwei Dokumente und speichern Sie das Ergebnis in einem dritten Word-Dokument
- Vergleichen Sie zwei Dokumente und geben Sie Einfügungen und Löschungen in Listen zurück
Unten sehen Sie einen Screenshot der beiden Word-Dokumente, die verglichen werden.

Installieren Sie Spire.Doc for .NET
Zunächst müssen Sie die im Spire.Doc for .NET-Paket enthaltenen DLL-Dateien als Referenzen in Ihrem .NET-Projekt hinzufügen. Die DLL-Dateien können entweder über diesen Link heruntergeladen oder über NuGet installiert werden.
PM> Install-Package Spire.Doc
Vergleichen Sie zwei Dokumente und speichern Sie das Ergebnis in einem dritten Word-Dokument
Durch das Speichern des Vergleichsergebnisses in einem separaten Word-Dokument können wir alle am Originaldokument vorgenommenen Änderungen sehen, einschließlich Einfügungen, Löschungen sowie Änderungen an der Formatierung. Im Folgenden finden Sie die Schritte zum Vergleichen zweier Dokumente und zum Speichern des Ergebnisses in einem dritten Word-Dokument mit Spire.Doc for .NET.
- Laden Sie zwei Word-Dokumente separat, während Sie die Dokumentobjekte initialisieren.
- Vergleichen Sie diese beiden Dokumente mit der Methode Document.Compare().
- Speichern Sie das Ergebnis in einem dritten Word-Dokument mit der Methode ;Document.SaveToFile().
- C#
- VB.NET
using Spire.Doc;
namespace CompareDocuments
{
class Program
{
static void Main(string[] args)
{
//Load one Word document
Document doc1 = new Document("C:\\Users\\Administrator\\Desktop\\original.docx");
//Load the other Word document
Document doc2 = new Document("C:\\Users\\Administrator\\Desktop\\revised.docx");
//Compare two documents
doc1.Compare(doc2, "John");
//Save the differences in a third document
doc1.SaveToFile("Differences.docx", FileFormat.Docx2013);
doc1.Dispose();
}
}
}

Vergleichen Sie zwei Dokumente und geben Sie Einfügungen und Löschungen in Listen zurück
Entwickler möchten möglicherweise nur die Einfügungen und Löschungen und nicht die gesamten Unterschiede erhalten. Im Folgenden finden Sie die Schritte zum Abrufen von Einfügungen und Löschungen in zwei separaten Listen.
- Laden Sie zwei Word-Dokumente separat, während Sie die Dokumentobjekte initialisieren.
- Vergleichen Sie zwei Dokumente mit der Methode Document.Compare().
- Rufen Sie die Revisionen mithilfe der Konstruktorfunktion der DifferRevisions-Klasse ab.
- Rufen Sie eine Liste der Einfügungen über die Eigenschaft „DifferRevisions.InsertRevisions“ ab.
- Rufen Sie eine Liste der Löschungen über die Eigenschaft „DifferRevisions.DeleteRevisions“ ab.
- Durchlaufen Sie die Elemente in den beiden Listen, um das spezifische Einfügen und Löschen zu erhalten.
- C#
- VB.NET
using Spire.Doc;
using Spire.Doc.Fields;
using System;
namespace GetDifferencesInList
{
class Program
{
static void Main(string[] args)
{
//Load one Word document
Document doc1 = new Document("C:\\Users\\Administrator\\Desktop\\original.docx");
//Load the other Word document
Document doc2 = new Document("C:\\Users\\Administrator\\Desktop\\revised.docx");
//Compare the two Word documents
doc1.Compare(doc2, "Author");
//Get the revisions
DifferRevisions differRevisions = new DifferRevisions(doc1);
//Return the insertion revisions in a list
var insetRevisionsList = differRevisions.InsertRevisions;
//Return the deletion revisions in a list
var deletRevisionsList = differRevisions.DeleteRevisions;
//Create two int variables
int m = 0;
int n = 0;
//Loop through the insertion revision list
for (int i = 0; i < insetRevisionsList.Count; i++)
{
if (insetRevisionsList[i] is TextRange)
{
m += 1;
//Get the specific revision and get its content
TextRange textRange = insetRevisionsList[i] as TextRange;
Console.WriteLine("Insertion #" + m + ":" + textRange.Text);
}
}
Console.WriteLine("=====================");
//Loop through the deletion revision list
for (int i = 0; i < deletRevisionsList.Count; i++)
{
if (deletRevisionsList[i] is TextRange)
{
n += 1;
//Get the specific revision and get its content
TextRange textRange = deletRevisionsList[i] as TextRange;
Console.WriteLine("Deletion #" + n + ":" + textRange.Text);
}
}
Console.ReadKey();
}
}
}

Beantragen Sie eine temporäre Lizenz
Wenn Sie die Bewertungsmeldung aus den generierten Dokumenten entfernen oder die Funktionseinschränkungen beseitigen möchten, wenden Sie sich bitte an uns Fordern Sie eine 30-Tage-Testlizenz an für sich selbst.
C#/VB.NET: comparar dos documentos de Word
Tabla de contenido
Instalado a través de NuGet
PM> Install-Package Spire.Doc
enlaces relacionados
No es raro en el trabajo que podamos recibir dos versiones de un documento de Word y enfrentarnos a la necesidad de encontrar las diferencias entre ellas. La comparación de documentos es particularmente importante y popular en los campos de las leyes, los reglamentos y la educación. En este artículo, aprenderá a comparar dos documentos de Word en C# y VB.NET utilizando Spire.Doc for .NET.
- Compare dos documentos y guarde el resultado en un tercer documento de Word
- Comparar dos documentos y devolver inserciones y eliminaciones en listas
A continuación se muestra una captura de pantalla de los dos documentos de Word que se compararán.

Instalar Spire.Doc for .NET
Para empezar, debe agregar los archivos DLL incluidos en el paquete Spire.Doc for .NET como referencias en su proyecto .NET. Los archivos DLL se pueden descargar desde este enlace o instalar a través de NuGet.
PM> Install-Package Spire.Doc
Compare dos documentos y guarde el resultado en un tercer documento de Word
Guardar el resultado de la comparación en un documento de Word separado nos permite ver todos los cambios realizados en el documento original, incluidas las inserciones, eliminaciones y modificaciones en el formato. Los siguientes son los pasos para comparar dos documentos y guardar el resultado en un tercer documento de Word usando Spire.Doc for .NET.
- Cargue dos documentos de Word por separado mientras inicializa los objetos Documento.
- Compare estos dos documentos usando el método Document.Compare().
- Guarde el resultado en un tercer documento de Word usando el método ;Document.SaveToFile().
- C#
- VB.NET
using Spire.Doc;
namespace CompareDocuments
{
class Program
{
static void Main(string[] args)
{
//Load one Word document
Document doc1 = new Document("C:\\Users\\Administrator\\Desktop\\original.docx");
//Load the other Word document
Document doc2 = new Document("C:\\Users\\Administrator\\Desktop\\revised.docx");
//Compare two documents
doc1.Compare(doc2, "John");
//Save the differences in a third document
doc1.SaveToFile("Differences.docx", FileFormat.Docx2013);
doc1.Dispose();
}
}
}

Comparar dos documentos y devolver inserciones y eliminaciones en listas
Es posible que los desarrolladores solo deseen obtener las inserciones y eliminaciones en lugar de las diferencias completas. Los siguientes son los pasos para obtener inserciones y eliminaciones en dos listas separadas.
- Cargue dos documentos de Word por separado mientras inicializa los objetos Documento.
- Compara dos documentos usando el método Document.Compare().
- Obtenga las revisiones utilizando la función constructora de la clase DifferRevisions ;.
- Obtenga una lista de inserciones a través de la propiedad DifferRevisions.InsertRevisions.
- Obtenga una lista de eliminaciones a través de la propiedad DifferRevisions.DeleteRevisions.
- Recorra los elementos de las dos listas para obtener la inserción y eliminación específicas.
- C#
- VB.NET
using Spire.Doc;
using Spire.Doc.Fields;
using System;
namespace GetDifferencesInList
{
class Program
{
static void Main(string[] args)
{
//Load one Word document
Document doc1 = new Document("C:\\Users\\Administrator\\Desktop\\original.docx");
//Load the other Word document
Document doc2 = new Document("C:\\Users\\Administrator\\Desktop\\revised.docx");
//Compare the two Word documents
doc1.Compare(doc2, "Author");
//Get the revisions
DifferRevisions differRevisions = new DifferRevisions(doc1);
//Return the insertion revisions in a list
var insetRevisionsList = differRevisions.InsertRevisions;
//Return the deletion revisions in a list
var deletRevisionsList = differRevisions.DeleteRevisions;
//Create two int variables
int m = 0;
int n = 0;
//Loop through the insertion revision list
for (int i = 0; i < insetRevisionsList.Count; i++)
{
if (insetRevisionsList[i] is TextRange)
{
m += 1;
//Get the specific revision and get its content
TextRange textRange = insetRevisionsList[i] as TextRange;
Console.WriteLine("Insertion #" + m + ":" + textRange.Text);
}
}
Console.WriteLine("=====================");
//Loop through the deletion revision list
for (int i = 0; i < deletRevisionsList.Count; i++)
{
if (deletRevisionsList[i] is TextRange)
{
n += 1;
//Get the specific revision and get its content
TextRange textRange = deletRevisionsList[i] as TextRange;
Console.WriteLine("Deletion #" + n + ":" + textRange.Text);
}
}
Console.ReadKey();
}
}
}

Solicitar una Licencia Temporal
Si desea eliminar el mensaje de evaluación de los documentos generados o deshacerse de las limitaciones de la función, por favor solicitar una licencia de prueba de 30 días para ti.
C#/VB.NET: 두 개의 Word 문서 비교
NuGet을 통해 설치됨
PM> Install-Package Spire.Doc
관련된 링크들
직장에서 두 가지 버전의 Word 문서를 받고 그 사이의 차이점을 찾아야 하는 필요성에 직면하는 것은 드문 일이 아닙니다. 문서 비교는 법률, 규정 및 교육 분야에서 특히 중요하고 널리 사용됩니다. 이 기사에서는 다음을 수행하는 방법을 배웁니다 C# 및 VB.NET에서 두 개의 Word 문서 비교 사용하여 Spire.Doc for .NET.
아래는 비교할 두 Word 문서의 스크린샷입니다.

Spire.Doc for .NET 설치
먼저 Spire.Doc for .NET 패키지에 포함된 DLL 파일을 .NET 프로젝트의 참조로 추가해야 합니다. DLL 파일은 이 링크에서 다운로드하거나 NuGet을 통해 설치할 수 있습니다.
PM> Install-Package Spire.Doc
두 문서를 비교하고 결과를 세 번째 Word 문서에 저장
비교 결과를 별도의 Word 문서에 저장하면 삽입, 삭제 및 서식 수정을 포함하여 원본 문서의 모든 변경 사항을 볼 수 있습니다. 다음은 두 문서를 비교하고 Spire.Doc for .NET 사용하여 세 번째 Word 문서에 결과를 저장하는 단계입니다.
- 문서 개체를 초기화하는 동안 두 개의 Word 문서를 개별적으로 로드합니다.
- Document.Compare() 메서드를 사용하여 이 두 문서를 비교합니다.
- ;Document.SaveToFile() 메서드를 사용하여 결과를 세 번째 Word 문서에 저장합니다.
- C#
- VB.NET
using Spire.Doc;
namespace CompareDocuments
{
class Program
{
static void Main(string[] args)
{
//Load one Word document
Document doc1 = new Document("C:\\Users\\Administrator\\Desktop\\original.docx");
//Load the other Word document
Document doc2 = new Document("C:\\Users\\Administrator\\Desktop\\revised.docx");
//Compare two documents
doc1.Compare(doc2, "John");
//Save the differences in a third document
doc1.SaveToFile("Differences.docx", FileFormat.Docx2013);
doc1.Dispose();
}
}
}

두 문서를 비교하고 목록에서 삽입 및 삭제 반환
개발자는 전체 차이점 대신 삽입 및 삭제만 얻기를 원할 수 있습니다. 다음은 두 개의 개별 목록에서 삽입 및 삭제를 가져오는 단계입니다.
- 문서 개체를 초기화하는 동안 두 개의 Word 문서를 개별적으로 로드합니다.
- Document.Compare() 메서드를 사용하여 두 문서를 비교합니다.
- DifferRevisions 클래스의 생성자 함수를 사용하여 수정본을 가져옵니다.
- DifferRevisions.InsertRevisions 속성을 통해 삽입 목록을 가져옵니다.
- DifferRevisions.DeleteRevisions 속성을 통해 삭제 목록을 가져옵니다.
- 두 목록의 요소를 반복하여 특정 삽입 및 삭제를 얻습니다.
- C#
- VB.NET
using Spire.Doc;
using Spire.Doc.Fields;
using System;
namespace GetDifferencesInList
{
class Program
{
static void Main(string[] args)
{
//Load one Word document
Document doc1 = new Document("C:\\Users\\Administrator\\Desktop\\original.docx");
//Load the other Word document
Document doc2 = new Document("C:\\Users\\Administrator\\Desktop\\revised.docx");
//Compare the two Word documents
doc1.Compare(doc2, "Author");
//Get the revisions
DifferRevisions differRevisions = new DifferRevisions(doc1);
//Return the insertion revisions in a list
var insetRevisionsList = differRevisions.InsertRevisions;
//Return the deletion revisions in a list
var deletRevisionsList = differRevisions.DeleteRevisions;
//Create two int variables
int m = 0;
int n = 0;
//Loop through the insertion revision list
for (int i = 0; i < insetRevisionsList.Count; i++)
{
if (insetRevisionsList[i] is TextRange)
{
m += 1;
//Get the specific revision and get its content
TextRange textRange = insetRevisionsList[i] as TextRange;
Console.WriteLine("Insertion #" + m + ":" + textRange.Text);
}
}
Console.WriteLine("=====================");
//Loop through the deletion revision list
for (int i = 0; i < deletRevisionsList.Count; i++)
{
if (deletRevisionsList[i] is TextRange)
{
n += 1;
//Get the specific revision and get its content
TextRange textRange = deletRevisionsList[i] as TextRange;
Console.WriteLine("Deletion #" + n + ":" + textRange.Text);
}
}
Console.ReadKey();
}
}
}

임시 면허 신청
생성된 문서에서 평가 메시지를 제거하거나 기능 제한을 제거하려면 다음을 수행하십시오 30일 평가판 라이선스 요청 자신을 위해.
C#/VB.NET: confronta due documenti di Word
Sommario
Installato tramite NuGet
PM> Install-Package Spire.Doc
Link correlati
Non è raro che al lavoro riceviamo due versioni di un documento Word e affrontiamo la necessità di trovare le differenze tra di loro. Il confronto dei documenti è particolarmente importante e popolare nei settori delle leggi, dei regolamenti e dell'istruzione. In questo articolo imparerai a confrontare due documenti Word in C# e VB.NET utilizzando Spire.Doc for .NET.
- Confronta due documenti e salva il risultato in un documento di terza parola
- Confronta due documenti e restituisci inserimenti ed eliminazioni negli elenchi
Di seguito è riportato uno screenshot dei due documenti di Word che verranno confrontati.

Installa Spire.Doc for .NET
Per cominciare, è necessario aggiungere i file DLL inclusi nel pacchetto Spire.Doc for .NET come riferimenti nel progetto .NET. I file DLL possono essere scaricati da questo link o installato tramite NuGet.
PM> Install-Package Spire.Doc
Confronta due documenti e salva il risultato in un documento di terza parola
Il salvataggio del risultato del confronto in un documento Word separato ci consente di vedere tutte le modifiche apportate al documento originale, inclusi inserimenti, eliminazioni e modifiche alla formattazione. Di seguito sono riportati i passaggi per confrontare due documenti e salvare il risultato in un terzo documento di Word utilizzando Spire.Doc for .NET.
- Carica due documenti Word separatamente durante l'inizializzazione degli oggetti Document.
- Confronta questi due documenti usando il metodo Document.Compare().
- Salva il risultato in un terzo documento Word usando il metodo ;Document.SaveToFile().
- C#
- VB.NET
using Spire.Doc;
namespace CompareDocuments
{
class Program
{
static void Main(string[] args)
{
//Load one Word document
Document doc1 = new Document("C:\\Users\\Administrator\\Desktop\\original.docx");
//Load the other Word document
Document doc2 = new Document("C:\\Users\\Administrator\\Desktop\\revised.docx");
//Compare two documents
doc1.Compare(doc2, "John");
//Save the differences in a third document
doc1.SaveToFile("Differences.docx", FileFormat.Docx2013);
doc1.Dispose();
}
}
}

Confronta due documenti e restituisci inserimenti ed eliminazioni negli elenchi
Gli sviluppatori potrebbero voler ottenere solo gli inserimenti e le eliminazioni anziché tutte le differenze. Di seguito sono riportati i passaggi per ottenere inserimenti ed eliminazioni in due elenchi separati.
- Carica due documenti Word separatamente durante l'inizializzazione degli oggetti Document.
- Confronta due documenti utilizzando il metodo Document.Compare().
- Ottenere le revisioni utilizzando la funzione di costruzione della classe DifferRevisions ;.
- Ottenere un elenco di inserimenti tramite la proprietà DifferRevisions.InsertRevisions.
- Ottenere un elenco di eliminazioni tramite la proprietà ifferRevisions.DeleteRevisionsD.
- Scorri gli elementi nei due elenchi per ottenere l'inserimento e l'eliminazione specifici.
- C#
- VB.NET
using Spire.Doc;
using Spire.Doc.Fields;
using System;
namespace GetDifferencesInList
{
class Program
{
static void Main(string[] args)
{
//Load one Word document
Document doc1 = new Document("C:\\Users\\Administrator\\Desktop\\original.docx");
//Load the other Word document
Document doc2 = new Document("C:\\Users\\Administrator\\Desktop\\revised.docx");
//Compare the two Word documents
doc1.Compare(doc2, "Author");
//Get the revisions
DifferRevisions differRevisions = new DifferRevisions(doc1);
//Return the insertion revisions in a list
var insetRevisionsList = differRevisions.InsertRevisions;
//Return the deletion revisions in a list
var deletRevisionsList = differRevisions.DeleteRevisions;
//Create two int variables
int m = 0;
int n = 0;
//Loop through the insertion revision list
for (int i = 0; i < insetRevisionsList.Count; i++)
{
if (insetRevisionsList[i] is TextRange)
{
m += 1;
//Get the specific revision and get its content
TextRange textRange = insetRevisionsList[i] as TextRange;
Console.WriteLine("Insertion #" + m + ":" + textRange.Text);
}
}
Console.WriteLine("=====================");
//Loop through the deletion revision list
for (int i = 0; i < deletRevisionsList.Count; i++)
{
if (deletRevisionsList[i] is TextRange)
{
n += 1;
//Get the specific revision and get its content
TextRange textRange = deletRevisionsList[i] as TextRange;
Console.WriteLine("Deletion #" + n + ":" + textRange.Text);
}
}
Console.ReadKey();
}
}
}

Richiedi una licenza temporanea
Se desideri rimuovere il messaggio di valutazione dai documenti generati o eliminare le limitazioni delle funzioni, per favore richiedere una licenza di prova di 30 giorni per te.