เมื่อทำงานกับหลายเวอร์ชันของสัญญา เอกสารวิจัย หรือเอกสารทางเทคนิค การเปรียบเทียบเอกสาร Word จึงเป็นสิ่งจำเป็น ด้วยเครื่องมืออัตโนมัติ คุณสามารถเปรียบเทียบ 2 Word docs ทำการเน้นความแตกต่าง และสร้างรายงานที่ครอบคลุมซึ่งแสดงการเพิ่ม ลบ หรือการแก้ไข สิ่งนี้ช่วยให้มั่นใจในความถูกต้อง ประหยัดเวลา และหลีกเลี่ยงข้อผิดพลาดในการตรวจสอบด้วยมือ
API สำหรับการเปรียบเทียบเอกสาร Word
ช่วยให้นักพัฒนาสามารถเปรียบเทียบไฟล์ Word ได้อย่างง่ายดายในแอปพลิเคชัน C# ของพวกเขา API ที่ทรงพลังนี้ระบุความแตกต่างของข้อความ การจัดรูปแบบ และโครงสร้างระหว่างเอกสาร Word ติดตั้ง SDK จาก NuGet:
- ไม่เพียงแค่เอกสาร Word เท่านั้น API ยังสามารถเปรียบเทียบ many other formats ได้อีกด้วย。
NuGet\Install-Package GroupDocs.Comparison-Cloud -Version 23.10.0
ตอนนี้ให้คุณรับ Client ID และ Secret ของคุณจาก GroupDocs cloud Dashboard.
เปรียบเทียบเอกสาร Word โดยใช้ C#
นี่คือวิธีที่คุณสามารถเปรียบเทียบไฟล์ DOCX ทางโปรแกรมได้โดยใช้ GroupDocs.Comparison:
- กำหนดข้อมูลรับรอง API:
var config = new Configuration(clientId, clientSecret);
- เริ่มต้น CompareApi:
var compareApi = new CompareApi(config);
- กำหนดไฟล์ Word แหล่งที่มาและเป้าหมาย:
var sourceFile = new FileInfo("source.docx");
var targetFile = new FileInfo("target.docx");
- สร้างคำขอเปรียบเทียบ:
var request = new ComparisonRequest(sourceFile, targetFile, outputPath);
- เรียก API เพื่อเปรียบเทียบเอกสารออนไลน์:
var response = compareApi.Compare(request);
// สำหรับตัวอย่างเพิ่มเติม, https://github.com/groupdocs-comparison-cloud/groupdocs-comparison-cloud-dotnet
var config = new Configuration(clientId, clientSecret);
var compareApi = new CompareApi(config);
var sourceFile = new FileInfo("source.docx");
var targetFile = new FileInfo("target.docx");
var request = new ComparisonRequest(sourceFile, targetFile, outputPath);
var response = compareApi.Compare(request);
เปรียบเทียบไฟล์ DOCX ผ่าน cURL
Alternatively, you can compare DOCX files online using and cURL commands. This is useful for automated scripts and CI/CD workflows.
- สร้างโทเค็น JWT:
curl -v "https://api.groupdocs.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=CLIENT_ID&client_secret=CLIENT_SECRET" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"
- ทำการเปรียบเทียบเอกสาร:
curl -v -X POST "https://api.groupdocs.cloud/v2.0/comparison/comparisons" \
-H "accept: application/json" \
-H "authorization: Bearer {ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-d "{ \"SourceFile\": { \"FilePath\": \"firstDoc.docx\" }, \"TargetFiles\": [ { \"FilePath\": \"secondDoc.docx\" } ], \"Settings\": { \"GenerateSummaryPage\": true, \"ShowDeletedContent\": true, \"ShowInsertedContent\": true, \"StyleChangeDetection\": true, \"InsertedItemsStyle\": { \"Bold\": true, \"Italic\": true, \"StrikeThrough\": true, \"Underline\": true }, \"DeletedItemsStyle\": { \"Bold\": true, \"Italic\": true, \"StrikeThrough\": true, \"Underline\": true }, \"ChangedItemsStyle\": { \"Bold\": true, \"Italic\": true, \"StrikeThrough\": true, \"Underline\": true }, \"WordsSeparatorChars\": [ \"string\" ], \"UseFramesForDelInsElements\": true, \"CalculateComponentCoordinates\": true, \"MarkChangedContent\": true, \"MarkNestedContent\": true, \"MetaData\": { \"Author\": \"Nayyer Shahbaz\", \"LastSaveBy\": \"Nayyer\", \"Company\": \"GroupDocs Cloud\" }, \"DiagramMasterSetting\": { \"UseSourceMaster\": true }, \"OriginalSize\": { \"Width\": 0, \"Height\": 0 }, \"HeaderFootersComparison\": true, \"SensitivityOfComparison\": 0 }, \"OutputPath\": \"comparisonOutput.docx\"}"
ลองใช้งานเครื่องมือเปรียบเทียบคำออนไลน์แบบฟรี
สำรวจแอป Document Comparison ฟรีของเราเพื่อตรวจสอบความแตกต่างระหว่างไฟล์ DOCX สองไฟล์ออนไลน์โดยไม่ต้องติดตั้งซอฟต์แวร์ใด ๆ

ความคิดเห็นสุดท้าย
ใช้ GroupDocs.Comparison Cloud SDK สำหรับ .NET หรือ cURL คุณสามารถเปรียบเทียบเอกสาร 2 ชิ้นใน Word และเน้นความแตกต่างได้อย่างง่ายดาย ไม่ว่าคุณจะต้องการเปรียบเทียบเอกสาร Word สำหรับกรณีการใช้งานทางกฎหมาย ธุรกิจ หรือการศึกษา โซลูชันนี้ทำให้มั่นใจได้ถึงความถูกต้องและประสิทธิภาพ แทนที่จะพึ่งพาการตรวจสอบด้วยตนเองหรือฟีเจอร์เปรียบเทียบเอกสารใน Word ที่จำกัด คุณสามารถรวมการเปรียบเทียบเอกสารที่มีประสิทธิภาพเข้าในแอปพลิเคชันของคุณ ซึ่งทำให้การเปรียบเทียบไฟล์ Word ติดตามการปรับปรุง และรับรองความสมบูรณ์ของเอกสารเป็นเรื่องง่าย