Mike Askew 131 Veteran Poster Featured Poster

Howdy

So I have a set of data coming back from a process with five different pieces of data per entry in the set.

Are there any fancy ways you can generate some kind of look-a-like report on the fly in WCF, else what would be the best way to go with presenting the information?

Cheers

Mike

Dani AI

Generated

For a quick reality check: WCF should be the data layer only. The question is whether you need an interactive in-app "report" or a paginated/printable export (PDF/XPS). That choice drives the best approach. asked about generating a look-alike report on the fly — common, practical patterns are listed below with tradeoffs and a small example for an on-screen/printable FlowDocument.

Client-side (WPF) options

  • Interactive, scrollable: use ItemsControl/ListView/DataGrid with a DataTemplate or GridView for each five-field record (fast to build, supports selection, virtualization).
  • Printable, paginated: build a FlowDocument or FixedDocument and show it in a DocumentViewer. FlowDocument is easier to generate programmatically and prints nicely; FixedDocument gives pixel-perfect layout.
  • Export/print pipeline: create the document in WPF and either print directly or write to XPS/PDF (via an XPS writer + a PDF converter library).

Tiny FlowDocument pattern (skeleton)

var doc = new FlowDocument();
var table = new Table();
for (int i = 0; i < 5; i++) table.Columns.Add(new TableColumn());
var header = new TableRowGroup();
header.Rows.Add(new TableRow { Cells = { new TableCell(new Paragraph(new Run("Col1"))) /* ... */ } });
table.RowGroups.Add(header);
var body = new TableRowGroup();
foreach(var item in items) {
  var row = new TableRow();
  row.Cells.Add(new TableCell(new Paragraph(new Run(item.Field1))));
  /* add other 4 cells */
  body.Rows.Add(row);
}
table.RowGroups.Add(body);
doc.Blocks.Add(table);
documentViewer.Document = doc;

Server-side/reporting engines

  • Use RDLC/ReportViewer or SSRS (or third-party engines) when you need server-side PDF generation, scheduled reports, or complex grouping/aggregates. Server reports simplify export and audit trails but add infrastructure.

Practical workflow & tips

  1. Have WCF return simple DTOs (no EF proxies). 2) Map to view models on the client and populate an ObservableCollection asynchronously (Task/await) to avoid UI freezes. 3) Virtualize or page results when rows get large (>200). 4) Test printing margins, fonts, and page breaks on real printers — layout can differ. 5) Choose server-side rendering only if you must deliver pre-made PDFs or run heavy report logic on the server.

This gives the practical tradeoffs: for fast in-app reports, build a WPF FlowDocument or templated ItemsControl; for reliable exports and scheduling, use a reporting engine.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.