First
Source Code Files will be updated every Major version
Second (How versions work)
1 - Major Version .0 - Major Bug Fix .0 - Small patch
Third
Download the sample files if you want to test the program
This document describes the enhanced template-based report generation system that can process XML data files and generate Word documents using customizable templates with repeating sections for each project.
The system supports templates with the following structure:
Report Generated: CreationDate
Project: ProjectNumber
Date: DateRange
Hours: ProjectHours
---
Summary:
Total Hours: TotalHours
-
Template Identification:
- The system scans the template document to identify the project section
- It looks for paragraphs containing "Project:" to mark the beginning
- It looks for paragraphs containing "---" to mark the end of the project section
- It looks for paragraphs containing "Summary:" to identify where to place the total hours
-
Data Processing:
- For each project in the XML/Excel file:
- The system clones the project template section
- Replaces placeholders with actual project data:
- "ProjectNumber" → Actual project number
- "DateRange" → Formatted date range (e.g., "15.01.2025-16.01.2025" or "15.01.2025" if single date)
- "ProjectHours" → Total hours for the project
- Inserts the filled template into the document
- For each project in the XML/Excel file:
-
Summary Generation:
- Calculates total hours across all projects
- Places the summary in the designated section
<?xml version="1.0" encoding="UTF-8"?>
<projects>
<project>
<nr_projektu>PROJ001</nr_projektu>
<data>2025-01-15</data>
<godziny>8.5</godziny>
</project>
<project>
<nr_projektu>PROJ001</nr_projektu>
<data>2025-01-16</data>
<godziny>7.0</godziny>
</project>
<project>
<nr_projektu>PROJ002</nr_projektu>
<data>2025-01-20</data>
<godziny>6.0</godziny>
</project>
</projects>Report Generated: CreationDate
Project: ProjectNumber
Date: DateRange
Hours: ProjectHours
---
Summary:
Total Hours: TotalHours
Report Generated: 16.10.2025
Project: PROJ001
Date: 15.01.2025-16.01.2025
Hours: 15.5
Project: PROJ002
Date: 20.01.2025
Hours: 6.0
---
Summary:
Total Hours: 21.5
-
Flexible Template System:
- Users can create any .docx template with the required structure
- Placeholders are clearly defined and easy to use
- Template sections are automatically identified and processed
-
Repeating Sections:
- Each project gets its own section in the output
- Sections maintain the formatting from the template
- Automatic spacing between projects
-
Automatic Data Processing:
- Date range calculation (from-to or single date)
- Hour summation per project
- Total hours calculation across all projects
-
Multiple Data Sources:
- Supports both XML and Excel input files
- Consistent processing regardless of data source
The system uses the DocumentFormat.OpenXml library to:
- Parse the template document
- Identify and extract template sections
- Clone and modify sections for each project
- Insert filled sections into the document
- Update the summary section with total hours
The template processing algorithm:
- Scans the document to find template sections
- Extracts the project template
- Removes the original template from the document
- For each project:
- Clones the template
- Replaces placeholders with project data
- Inserts the filled template into the document
- Adds the summary section with total hours
This approach provides maximum flexibility while maintaining ease of use for end users.