DEV Community

Cover image for On-Brand PowerPoint and Word with Microsoft Agent Framework
Ilia Sokolov
Ilia Sokolov

Posted on

On-Brand PowerPoint and Word with Microsoft Agent Framework

If an agent creates a document that will be sent to a customer, used in a
meeting, or shared across the company, it usually needs to look like it came from your organization.

That means more than adding a logo. The document needs the approved colors, fonts, spacing, page treatments, and layout conventions. A presentation with the right content but inconsistent formatting still needs manual work before it can be used.

A branded template is the obvious starting point. It works well when every document has the same structure and the content always fits the available placeholders.

When a template is not enough

Many document workflows are less predictable.

  • A quarterly review may need a statistic slide for one customer and a table for another.
  • A proposal may gain or lose sections depending on the engagement.
  • A generated heading or paragraph may not fit the placeholder designed for a shorter example.
  • The same brand may need to work across PowerPoint, Word, invoices, and operating manuals.

Adding more templates can postpone the problem, but it also creates more files to maintain and more selection logic for the agent. Asking the model to choose fonts, coordinates, and colors in a prompt is not a reliable replacement.

A more flexible approach is to give the agent a small set of approved document structures, then let application code apply the brand. The content can vary without allowing the visual rules to drift.

From brief to document

The model plans the content. Application code controls validation, design, and composition

The brief contains the document's purpose, audience, trusted facts, and any constraints. Microsoft Agent Framework turns that brief into a structured content plan. Application code validates the plan, selects approved layouts, and applies the design system. OfficeAgent.NET then creates the editable PowerPoint or Word file.

This boundary matters. The model decides what the document should say and which approved structure fits the content. It does not place shapes, choose a new color palette, or generate Open XML.

Define the document structure

Start with a small vocabulary of document parts. A presentation might support cover, section, statement, bullets, statistic, table, and closing slides. Word might support headings, paragraphs, lists, quotes, and tables.

A slide contract can be simple:

public sealed record SlidePlan
{
    public required string Kind { get; init; }
    public required string Title { get; init; }
    public string? Subtitle { get; init; }
    public string[] Bullets { get; init; } = [];
    public string[][] TableRows { get; init; } = [];
}
Enter fullscreen mode Exit fullscreen mode

The contract contains content, not design. It has no coordinates, fonts,
colors, or sizes. The value of Kind selects an approved layout implemented by the composer.

Generate the content plan

Microsoft Agent Framework provides ChatClientAgent. It uses the provider-neutral IChatClient abstraction from Microsoft.Extensions.AI, so the planning code does not need to depend on one model provider.

The agent receives the brief and returns JSON that matches the document
contract:

var agent = new ChatClientAgent(
    chat,
    instructions: DeckInstructions,
    name: "deck-strategist");

var response = await agent.RunAsync(prompt, cancellationToken: ct);
var plan = JsonSerializer.Deserialize<DeckPlan>(
    ExtractJson(response.Text))
    ?? throw new InvalidOperationException("No usable deck plan.");

return PlanValidator.NormalizeAndValidate(plan);
Enter fullscreen mode Exit fullscreen mode

Apply the brand

The design system contains the approved palette, fonts, type scale, spacing, cover treatment, and logo. The composer maps each content role to a layout and uses those rules to place and style the content.

Because the brand is configuration and code (not a prompt), the same
rules can be reused across document runs. A brand update happens in one place
instead of in every prompt and template variant.

Example output from a separate runs of OfficeAgent.Studio

OfficeAgent.Studio implements the flow

I created OfficeAgent.Studio, an open-source .NET implementation of this pattern. It uses Microsoft Agent Framework to plan the content and OfficeAgent.NET to create native PowerPoint and Word files. The sample supports decks, reports, invoices, and operating manuals.

Its documentation explains the approach and how to get started. Try it and let me know which document types you use it for.

Top comments (0)