FileContextDocumentService.CreateReportAsync generates a FileContextReportResult containing scoped file references. The caller supplies a title, base file name, ordered blocks, output kinds (pdf, html, png), Letter/A4 page size, portrait/landscape orientation, and server-resolved visual theme. The library never fetches URLs or loads external fonts. A host must resolve and validate remote images before passing base64 PNG/JPEG bytes in an image block.
flowchart LR
A[Host validates input and resolves images] --> B[FileContextReport]
B --> C[PDF pages]
B --> D[Self-contained HTML]
B --> E[PNG chart images]
C --> F[Scoped IStorage]
D --> F
E --> F
Block content is JSON:
heading:title, optionalsubtitle.text:textwith bold spans (**bold**), dash bullets, and HTTPS Markdown links.kpi-row:itemswith 2-6 entries containinglabel,value, optionalchange, and optionalindicator(upordown).chart:title,chartType(line,bar,stacked-bar,pie,donut),labels,seriesentries withnameand numericvalues, optionalxAxisandyAxis.table:columnswithkey,label, optional .NET numericformat;rowsas objects; optionaltotalsobject andhighlightCellsentries with zero-basedrowand columnkey.image: base64 PNG/JPEG bytes inbase64, optionalcaption.callout:text.page-break: empty content.
All requested outputs render in memory before FileContext stores any file. Validation caps the expanded report at 10 MB, PDF at 60 pages, and render time at 60 seconds. Image blocks are capped at 5 MB. PDF chart and table rows are kept intact across pages, table headers repeat after a page break, and each page has a title, NYWD mark or theme logo, UTC date, and page number. Failures name the block index and type where possible.
Named template and theme persistence, network allowlists, operator authorization, and authenticated download links belong to the host. AIAgents.App implements that boundary in its AgentFiles/Reports module.