Wordize for .NET là giải pháp hiệu quả cho việc thay thế văn bản trong tài liệu DOC. Lớp Replacer cho phép các nhà phát triển C# thay thế các đoạn văn bản trong DOC theo chương trình bằng cách sử dụng cả chuỗi đơn giản và biểu thức chính quy.
Tính Năng Chính:Kiểm tra khả năng thay thế văn bản trong DOC theo chương trình với bản demo tương tác trực tuyến được trình bày trên trang này. Để làm điều này, hãy tải lên tài liệu DOC của bạn, chỉ định văn bản tìm kiếm và văn bản thay thế, chạy thao tác và tải xuống tệp đã cập nhật để kiểm tra. Đoạn mã C# được cung cấp đã sẵn sàng để sử dụng trong dự án .NET của bạn.
using Wordize.Replacing;
Replacer.Replace("Input.doc", "Output.doc", "Văn bản hoặc Regex", "Văn bản hoặc Regex");
using Wordize.Replacing;
Replacer.Replace("Input.doc", "Output.doc", "Văn bản hoặc Regex", "Văn bản hoặc Regex");
using Wordize.Replacing;
using Wordize.Saving;
var imageStreams = Replacer.ReplaceToImages("Input.doc",
new ImageSaveOptions(SaveFormat.Doc), "Văn bản hoặc Regex", "Văn bản hoặc Regex");
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}.doc");
stream.CopyTo(file);
}
using Wordize.Replacing;
FindReplaceOptions options = new FindReplaceOptions() { UseSubstitutions = true };
Replacer.Replace("Input.doc", "Output.doc", new Regex(@"Văn bản hoặc Regex"), "Văn bản hoặc Regex", options);
using Wordize.Replacing;
FindReplaceOptions options = new FindReplaceOptions() { UseSubstitutions = true };
Replacer.Replace("Input.doc", "Output.doc", new Regex(@"Văn bản hoặc Regex"), "Văn bản hoặc Regex", options);
using Wordize.Replacing;
using Wordize.Saving;
FindReplaceOptions options = new FindReplaceOptions() { UseSubstitutions = true };
var imageStreams = Replacer.ReplaceToImages("Input.doc",
new ImageSaveOptions(SaveFormat.Doc), new Regex(@"Văn bản hoặc Regex"), "Văn bản hoặc 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}.doc");
stream.CopyTo(file);
}