SharePoint Connector Documentation
Index

Word Templates and Custom Layouts

The SharePoint Connector supports Word templates and custom report layouts for document generation. This page explains how to work with Word-based templates.

Word Templates Overview

What Are Word Templates?

Word templates in Business Central:

  • Define document appearance
  • Use Word's formatting capabilities
  • Include placeholders for BC data
  • Can include images, tables, headers

How They Work with the Connector

  1. Create Word template layout in BC
  2. Reference layout in Document Template
  3. Generate document → uses Word layout
  4. Output as Word (.docx) or PDF

Which Layout System Applies

The Report Layout Selection field on the SharePoint Setup page governs which of BC's two layout systems the connector uses:

Report Layout Selection Layout System Template List Layout Field Contains
Report Layout (default) Modern Report Layouts (Report Layout List) SharePoint Document Templates (Report Layout) The layout name from the Report Layout List
Custom Report Layout Legacy Custom Report Layouts SharePoint Document Templates (Custom Report Layouts) The layout code (e.g., MY-CUSTOM-LAYOUT)

The shipped default is Report Layout. With that default, the Layout field on the template holds the layout name, and the connector applies it via design-time report layout selection for the generation run only. Layout codes such as MY-CUSTOM-LAYOUT apply only when Report Layout Selection is set to Custom Report Layout.

The Word template design process (content controls, XML mapping) is the same for both flavors.

Creating Word Layouts

Step 1: Design the Template

In Microsoft Word:

  1. Create a new document
  2. Design your layout (headers, formatting, logo)
  3. Leave space for BC data
  4. Save as .docx

Step 2: Add Content Controls

Use Word's XML Mapping Pane:

  1. In Word, go to Developer tab
  2. Click XML Mapping Pane
  3. Add content controls where data should appear
  4. Map controls to BC data fields

Step 3: Import to Business Central

For the default Report Layout flavor:

  1. Go to Report Layouts (the Report Layout List) in BC
  2. Create a new layout for your report and choose Word format
  3. Import the Word template
  4. Note the layout Name -- you reference it in the document template

If Report Layout Selection is Custom Report Layout:

  1. Go to Custom Report Layouts in BC
  2. Create new layout for your report
  3. Import the Word template
  4. Note the layout Code -- you reference it in the document template

XML Mapping Process

Accessing XML Mapping

In Word 2016 or later:

  1. File > Options > Customize Ribbon
  2. Enable Developer tab
  3. Go to Developer > XML Mapping Pane

Mapping BC Data

The XML mapping pane shows available data:

  1. Select the data source (BC report dataset)
  2. Find the field you want
  3. Insert a content control
  4. Map the control to the field

Common Mappings

Content Control BC Field
Company Name COMPANYNAME
Customer Name Cust_Name
Document No. Doc_No
Total Amount TotalAmount

Using Word Layouts with Templates

In Document Template Configuration

With the default Report Layout flavor, the Layout field holds the layout name:

Field Value
Table No. 18 (Customer)
Report Number 116 (Statement)
Custom Layout Statement - Word Layout
Output Type Word or PDF

With Report Layout Selection = Custom Report Layout, the Layout field holds the layout code instead (e.g., MY-CUSTOM-LAYOUT).

Layout Lookup

For the default Report Layout flavor, the Layout field accepts:

  • A layout name from the Report Layout List
  • Applied via design-time report layout selection, for the generation run only

For the Custom Report Layout flavor, the Layout field accepts:

  • A custom layout code
  • Must exist in Custom Report Layouts
  • Must be for the specified report

Output Format Options

Word Output

When Output = Word:

  • File saved as .docx
  • Fully editable in Word
  • Good for documents needing modification

PDF Output (from Word Layout)

When Output = PDF (with Word layout):

  • Word layout is used for formatting
  • Output is converted to PDF
  • Professional, non-editable result

Template Design Best Practices

Layout Tips

Element Recommendation
Logo Include company logo
Header Company info, document title
Footer Page numbers, dates
Fonts Use standard fonts
Tables For line items

Data Placement

Area Typical Content
Top Company logo, return address
Address block Customer/vendor address
Body Document-specific content
Summary Totals, signatures

Testing

Before production use:

  1. Generate test document
  2. Review all fields populate
  3. Check formatting
  4. Test in target application (Word, PDF reader)

Example: Customer Letter Template

Word Template Design

[Company Logo]

[Company Name]
[Company Address]

[Date]

[Customer Name]
[Customer Address]

Dear [Contact Name],

[Letter Body - Content Control for variable text]

Thank you for your business.

Sincerely,
[Salesperson Name]

BC Configuration

Field Value
Table No. 18
Report Number (Custom letter report)
Layout Customer Letter V1 (layout name; use a layout code like CUST-LETTER-V1 only with the Custom Report Layout flavor)
Description Customer Letter %1
Output Word

Troubleshooting Word Templates

Layout Not Found

Check Resolution
Layout exists? Create in Report Layouts (or in Custom Report Layouts for the legacy flavor)
Correct name/code? Report Layout flavor uses the layout name; Custom Report Layout flavor uses the layout code
For correct report? Layout must match Report No.
Right flavor? Check Report Layout Selection on the SharePoint Setup page

Data Not Appearing

Issue Check
Empty fields Verify XML mapping
Wrong data Check mapping to correct fields
Missing fields Field may not be in dataset

Formatting Issues

Issue Resolution
Fonts wrong Use standard fonts
Layout shifted Check table/paragraph settings
Images missing Embed images, don't link

Advanced Word Features

Conditional Content

Word layouts can include:

  • Conditional sections (show/hide based on data)
  • Repeating sections (for line items)
  • Dynamic tables

Repeating Sections

For tables with multiple rows:

  1. Create a table in Word
  2. Add repeating section content control
  3. Map to repeating data in BC dataset

Images

Include images:

  • Company logo (static)
  • Product images (dynamic, if in BC)
  • Signatures