Wordize Reporting cho .NET — một giải pháp sáng tạo để tạo tài liệu HTML 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 HTML chuyên nghiệp.
Lợi ích chính của việc Tạo Báo Cáo HTML bằng C#:
Để hiểu cách tạo các file HTML 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 file HTML theo chương trình. Sau khi chạy bản demo, tải xuống tài liệu HTML đã 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.html", "Output.html", dataSource, "");
using Wordize.Reporting;
var dataSource = new JsonDataSource("data.json");
ReportBuilder.BuildReport("Input.html", "Output.html", dataSource, "");
using Wordize.Reporting;
using Wordize.Saving;
var dataSource = new JsonDataSource("data.json");
var imageStreams = ReportBuilder.BuildReportToImages("Input.html",
new ImageSaveOptions(SaveFormat.Html), 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}.html");
stream.CopyTo(file);
}
using Wordize.Reporting;
var dataSource = new XmlDataSource("data.xml");
ReportBuilder.BuildReport("Input.html", "Output.html", dataSource, "");
using Wordize.Reporting;
var dataSource = new XmlDataSource("data.xml");
ReportBuilder.BuildReport("Input.html", "Output.html", dataSource, "");
using Wordize.Reporting;
using Wordize.Saving;
var dataSource = new XmlDataSource("data.xml");
var imageStreams = ReportBuilder.BuildReportToImages("Input.html",
new ImageSaveOptions(SaveFormat.Html), 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}.html");
stream.CopyTo(file);
}
using Wordize.Reporting;
var dataSource = new CsvDataSource("data.csv", new CsvDataLoadOptions() { HasHeaders = true });
ReportBuilder.BuildReport("Input.html", "Output.html", dataSource, "");
using Wordize.Reporting;
var dataSource = new CsvDataSource("data.csv", new CsvDataLoadOptions() { HasHeaders = true });
ReportBuilder.BuildReport("Input.html", "Output.html", dataSource, "");
using Wordize.Reporting;
using Wordize.Saving;
var dataSource = new CsvDataSource("data.csv", new CsvDataLoadOptions() { HasHeaders = true });
var imageStreams = ReportBuilder.BuildReportToImages("Input.html",
new ImageSaveOptions(SaveFormat.Html), 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}.html");
stream.CopyTo(file);
}