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