Wordize Reporting cho .NET — một giải pháp sáng tạo để tạo tài liệu theo chương trình giúp các lập trình viên C# tự động hóa việc tạo báo cáo với mọi độ phức tạp. Tích hợp việc tạo báo cáo vào dự án C# của bạn và chuyển đổi các file JSON, XML thành tài liệu Word và văn bản PDF chuyên nghiệp.
Lợi ích chính của việc Tạo Báo Cáo bằng C#:
Để hiểu cách tạo báo cáo bằng C# sử dụng API Tạo Báo Cáo, hãy tải lên tài liệu mẫu và file dữ liệu (XML, JSON, CSV) thông qua biểu mẫu. Xác định tên đối tượng nguồn dữ liệu được sử dụng trong mẫu và bắt đầu tạo tài liệu theo chương trình. Sau khi chạy bản demo, tải xuống báo cáo đã tạo và xác minh việc thay thế dữ liệu chính xác từ file nguồn được chỉ định.
using Wordize.Reporting;
var dataSource = new JsonDataSource("data.json");
ReportBuilder.BuildReport("Input.docx", "Output.pdf", dataSource, "");
using Wordize.Reporting;
var dataSource = new JsonDataSource("data.json");
ReportBuilder.BuildReport("Input.docx", "Output.pdf", dataSource, "");
using Wordize.Reporting;
using Wordize.Saving;
var dataSource = new JsonDataSource("data.json");
var imageStreams = ReportBuilder.BuildReportToImages("Input.docx",
new ImageSaveOptions(SaveFormat.Pdf), 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}.pdf");
stream.CopyTo(file);
}
using Wordize.Reporting;
var dataSource = new XmlDataSource("data.xml");
ReportBuilder.BuildReport("Input.docx", "Output.pdf", dataSource, "");
using Wordize.Reporting;
var dataSource = new XmlDataSource("data.xml");
ReportBuilder.BuildReport("Input.docx", "Output.pdf", dataSource, "");
using Wordize.Reporting;
using Wordize.Saving;
var dataSource = new XmlDataSource("data.xml");
var imageStreams = ReportBuilder.BuildReportToImages("Input.docx",
new ImageSaveOptions(SaveFormat.Pdf), 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}.pdf");
stream.CopyTo(file);
}
using Wordize.Reporting;
var dataSource = new CsvDataSource("data.csv", new CsvDataLoadOptions() { HasHeaders = true });
ReportBuilder.BuildReport("Input.docx", "Output.pdf", dataSource, "");
using Wordize.Reporting;
var dataSource = new CsvDataSource("data.csv", new CsvDataLoadOptions() { HasHeaders = true });
ReportBuilder.BuildReport("Input.docx", "Output.pdf", 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.Pdf), 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}.pdf");
stream.CopyTo(file);
}