Wordize for .NET là giải pháp chuyên nghiệp để tự động hóa báo cáo và tạo tài liệu Word theo chương trình. Lớp ReportBuilder cung cấp cho các nhà phát triển C# khả năng tạo báo cáo Word sử dụng mẫu và cú pháp LINQ, giúp tăng tốc các quy trình phân tích doanh nghiệp, triển khai nội dung động trong quy trình tài liệu tự động.
Tính năng chức năng:LINQ Reporting đảm bảo tạo tài liệu Word chuyên nghiệp với hỗ trợ định dạng phức tạp, bảng và biểu đồ. Các tệp Word giữ khả năng chỉnh sửa sau này, làm cho chúng lý tưởng cho tài liệu doanh nghiệp, hợp đồng và thông số kỹ thuật.
Kiểm tra khả năng tạo báo cáo Word theo chương trình trong demo trực tuyến tương tác được trình bày trên trang này. Để làm điều này, hãy tải lên mẫu tài liệu, tệp dữ liệu (JSON, XML hoặc CSV), chạy thao tác và tải xuống tài liệu Word được tạo để xác minh. Đ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.Reporting;
var dataSource = new JsonDataSource("data.json");
ReportBuilder.BuildReport("Input.docx", "Output.docx", dataSource, "");
using Wordize.Reporting;
var dataSource = new JsonDataSource("data.json");
ReportBuilder.BuildReport("Input.docx", "Output.docx", dataSource, "");
using Wordize.Reporting;
using Wordize.Saving;
var dataSource = new JsonDataSource("data.json");
var imageStreams = ReportBuilder.BuildReportToImages("Input.docx",
new ImageSaveOptions(SaveFormat.Docx), new[] { dataSource }, new[] { "" });
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.Reporting;
var dataSource = new XmlDataSource("data.xml");
ReportBuilder.BuildReport("Input.docx", "Output.docx", dataSource, "");
using Wordize.Reporting;
var dataSource = new XmlDataSource("data.xml");
ReportBuilder.BuildReport("Input.docx", "Output.docx", dataSource, "");
using Wordize.Reporting;
using Wordize.Saving;
var dataSource = new XmlDataSource("data.xml");
var imageStreams = ReportBuilder.BuildReportToImages("Input.docx",
new ImageSaveOptions(SaveFormat.Docx), new[] { dataSource }, new[] { "" });
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.Reporting;
var dataSource = new CsvDataSource("data.csv", new CsvDataLoadOptions() { HasHeaders = true });
ReportBuilder.BuildReport("Input.docx", "Output.docx", dataSource, "");
using Wordize.Reporting;
var dataSource = new CsvDataSource("data.csv", new CsvDataLoadOptions() { HasHeaders = true });
ReportBuilder.BuildReport("Input.docx", "Output.docx", dataSource, "");
using Wordize.Reporting;
using Wordize.Saving;
var dataSource = new CsvDataSource("data.csv", new CsvDataLoadOptions() { HasHeaders = true });
var imageStreams = ReportBuilder.BuildReportToImages("Input.docx",
new ImageSaveOptions(SaveFormat.Docx), new[] { dataSource }, new[] { "" });
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);
}