Wordize มอบเครื่องมือระดับสูงที่ทรงพลังสำหรับการปรับแต่งเอกสาร Word ด้วยโปรแกรมแก่นักพัฒนา C# ด้วยการผสานความสามารถในการค้นหาและแทนที่เข้ากับโปรเจกต์ .NET ของตน นักพัฒนาสามารถสร้างโซลูชันที่แข็งแกร่งสำหรับการอัปเดตเอกสาร Word อย่างครอบคลุม
การสาธิตออนไลน์แบบโต้ตอบของเราพร้อมตัวอย่างโค้ด C# ช่วยให้คุณสำรวจความเป็นไปได้ของการค้นหาและแทนที่ข้อความแบบโปรแกรมในเอกสาร Word ในการทดลองใช้ อัปโหลดไฟล์ Word ใดๆ ระบุสตริงการค้นหา/แทนที่ที่ต้องการ คลิกปุ่มประมวลผล จากนั้นดาวน์โหลดไฟล์ Word ที่แก้ไขแล้วสำหรับการตรวจสอบ
using Wordize.Replacing;
Replacer.Replace("Input.docx", "Output.docx", "ข้อความหรือเรกเอ็กซ์", "ข้อความหรือเรกเอ็กซ์");
using Wordize.Replacing;
Replacer.Replace("Input.docx", "Output.docx", "ข้อความหรือเรกเอ็กซ์", "ข้อความหรือเรกเอ็กซ์");
using Wordize.Replacing;
using Wordize.Saving;
var imageStreams = Replacer.ReplaceToImages("Input.docx",
new ImageSaveOptions(SaveFormat.Docx), "ข้อความหรือเรกเอ็กซ์", "ข้อความหรือเรกเอ็กซ์");
foreach (var (stream, page) in imageStreams.Select((s, i) => (s, i)))
{
using var _ = stream;
stream.Position = 0;
using var file = File.Create($"Output_{page + 1}.docx");
stream.CopyTo(file);
}
using Wordize.Replacing;
FindReplaceOptions options = new FindReplaceOptions() { UseSubstitutions = true };
Replacer.Replace("Input.docx", "Output.docx", new Regex(@"ข้อความหรือเรกเอ็กซ์"), "ข้อความหรือเรกเอ็กซ์", options);
using Wordize.Replacing;
FindReplaceOptions options = new FindReplaceOptions() { UseSubstitutions = true };
Replacer.Replace("Input.docx", "Output.docx", new Regex(@"ข้อความหรือเรกเอ็กซ์"), "ข้อความหรือเรกเอ็กซ์", options);
using Wordize.Replacing;
using Wordize.Saving;
FindReplaceOptions options = new FindReplaceOptions() { UseSubstitutions = true };
var imageStreams = Replacer.ReplaceToImages("Input.docx",
new ImageSaveOptions(SaveFormat.Docx), new Regex(@"ข้อความหรือเรกเอ็กซ์"), "ข้อความหรือเรกเอ็กซ์", options);
foreach (var (stream, page) in imageStreams.Select((s, i) => (s, i)))
{
using var _ = stream;
stream.Position = 0;
using var file = File.Create($"Output_{page + 1}.docx");
stream.CopyTo(file);
}