Wordize cung cấp cho các nhà phát triển C# những công cụ mạnh mẽ cấp cao để sửa đổi theo chương trình các tài liệu Word. Bằng cách tích hợp khả năng tìm kiếm và thay thế vào các dự án .NET, các nhà phát triển có thể tạo ra giải pháp mạnh mẽ để cập nhật toàn diện tài liệu Word.
Bản demo trực tuyến tương tác của chúng tôi với các ví dụ mã C# giúp bạn khám phá khả năng tìm kiếm và thay thế văn bản theo chương trình trong tài liệu Word. Để thử nghiệm, hãy tải lên bất kỳ tệp Word nào, chỉ định chuỗi tìm kiếm/thay thế cần thiết, nhấp vào nút xử lý, sau đó tải về tệp Word đã sửa đổi để xác minh.
using Wordize.Replacing;
Replacer.Replace("Input.docx", "Output.docx", "Văn bản hoặc RegEx", "Văn bản hoặc RegEx");
using Wordize.Replacing;
Replacer.Replace("Input.docx", "Output.docx", "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.docx",
new ImageSaveOptions(SaveFormat.Docx), "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}.docx");
stream.CopyTo(file);
}
using Wordize.Replacing;
FindReplaceOptions options = new FindReplaceOptions() { UseSubstitutions = true };
Replacer.Replace("Input.docx", "Output.docx", 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.docx", "Output.docx", 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.docx",
new ImageSaveOptions(SaveFormat.Docx), 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}.docx");
stream.CopyTo(file);
}