Skip to content

bthos/powerpoint-timeline-generator

Repository files navigation

Enhanced PowerPoint Timeline Generator

Overview

This VBA script automatically creates professional, multi-lane timelines in PowerPoint that resemble OfficeTimeline.com layouts. It solves the common problem of overlapping events by intelligently placing them on separate lanes.


Quick Start

Step 1: Prepare Your Excel Data

  1. Open Excel and create a new workbook
  2. Rename Sheet1 to "TimelineData"
  3. Add headers in row 1:
Column Header Description Example
A Task Name Event or phase name "Project Kickoff"
B Start Date Start date (required) 1/15/2025
C End Date End date (optional for milestones) 2/28/2025
D Type "Milestone", "Feature", or "Phase" "Milestone"
E Color "red", "blue", "green", "orange", etc. "blue"
F Swimlane Swimlane category/track "Planning"

Step 2: Add Your Timeline Events

Starting from row 2, add your events:

Task Name          | Start Date | End Date   | Type      | Color  | Swimlane
Project Kickoff    | 1/15/2025  |            | Milestone | blue   | Planning
Requirements       | 1/16/2025  | 2/15/2025  | Phase     | green  | Planning
Design Phase       | 2/16/2025  | 3/15/2025  | Phase     | blue   | Design
Development        | 3/16/2025  | 5/15/2025  | Phase     | orange | Development
Testing            | 5/1/2025   | 6/1/2025   | Phase     | red    | Testing
Go Live            | 6/15/2025  |            | Milestone | green  | Deployment

Step 3: Run the Timeline Generator

  1. Open PowerPoint (any presentation)
  2. Press Alt + F11 to open the VBA Editor
  3. Insert → Module
  4. Copy and paste the entire timeline.bas code (or File → Import File)
  5. Press F5 or Run → Run Sub to execute CreateTimelineFromData
  6. View → Immediate Window (Ctrl+G) to see output and error messages

Step 4: Review Your Timeline

  • A new slide will be created with your timeline
  • Each swimlane appears as a separate horizontal track
  • Overlapping events are automatically placed on different lanes
  • Professional styling with colors, connectors, and labels

Key Features

Multi-Lane Timeline Support with Swimlanes

  • Swimlane Organization: Events organized into horizontal swimlanes for better categorization
  • Automatic Overlap Detection: Events that would overlap are automatically moved to separate lanes
  • Smart Lane Assignment: Optimized algorithm minimizes the number of lanes needed
  • Visual Connectors: Dashed lines connect off-axis events to their respective swimlane axis

Professional Styling

  • Swimlane Headers: Labeled sections for organizing different project tracks or teams
  • Lane Separators: Optional horizontal grid lines for better organization
  • Color Coding: Support for red, blue, green, orange, purple, yellow, gray
  • Milestone & Phase Support: Different visual treatments for different event types
  • Smart Spacing: Buffer zones prevent label overlap

Data Integration

  • Excel Integration: Reads data directly from Excel "TimelineData" sheet
  • Flexible Date Handling: Supports both milestones (single date) and phases (date ranges)
  • Error Handling: Comprehensive validation and user-friendly error messages

Sample Data

Task Name Start Date End Date Type Color Swimlane
Project Kickoff 2025-01-15 Milestone blue Planning
Requirements Gathering 2025-01-16 2025-02-15 Phase green Planning
Stakeholder Review 2025-02-15 Milestone orange Planning
System Design 2025-02-16 2025-03-15 Phase blue Design
Architecture Review 2025-03-15 Milestone red Design
UI/UX Design 2025-02-20 2025-03-20 Phase purple Design
Development Sprint 1 2025-03-16 2025-04-15 Phase blue Development
Development Sprint 2 2025-04-16 2025-05-15 Phase blue Development
Code Review 2025-05-15 Milestone orange Development
Unit Testing 2025-04-01 2025-05-20 Phase red Testing
Integration Testing 2025-05-16 2025-06-01 Phase red Testing
User Acceptance Testing 2025-05-25 2025-06-10 Phase yellow Testing
Go-Live Preparation 2025-06-01 2025-06-15 Phase green Deployment
Production Deployment 2025-06-15 Milestone green Deployment

Key Points:

  • Date Format: Use standard Excel date format (YYYY-MM-DD or MM/DD/YYYY)
  • End Date: Leave empty for milestones, required for phases and features
  • Type: Must be "Milestone", "Feature", or "Phase" (case-insensitive)
  • Color: Supported colors: red, blue, green, orange, purple, yellow, gray, grey
  • Swimlane: Any text label to group related events

Configuration

Global Configuration Object

The timeline generator uses a global configuration object:

' Configuration is automatically initialized on first use
Dim config As TimelineConfig: config = GetDefaultTimelineConfig()

' Key configuration properties:
config.slideWidth = 960                    ' PowerPoint slide width (16:9 aspect ratio)
config.slideHeight = 540                   ' PowerPoint slide height
config.timelineAxisY = 110                 ' Main timeline Y position
config.swimlaneHeaderWidth = 100           ' Header width for swimlane labels
config.laneHeight = 48                     ' Vertical spacing between lanes
config.swimlaneBottomMargin = 5            ' Padding between swimlanes
config.bottomMarginForSlides = 30          ' Bottom margin for multi-slide calculations

Adding Custom Colors

Extend the GetColor() function:

Case "purple": GetColor = RGB(128, 0, 128)
Case "yellow": GetColor = RGB(255, 255, 0)
Case "teal": GetColor = RGB(0, 128, 128)
Case "maroon": GetColor = RGB(128, 0, 0)

Modify Timeline Appearance

Edit the InitializeGlobalConfig() function for permanent changes:

Sub InitializeGlobalConfig()
    With globalConfig
        .laneHeight = 60                    ' Space between lanes
        .swimlaneBottomMargin = 10          ' Space between swimlanes
        .timelineAxisY = 120                ' Distance from top
        .laneSpacingWithTopLabels = 40      ' Extra space for top labels
    End With
End Sub

Testing

This project includes a comprehensive Robot Framework-based testing framework for validating timeline data.

Test Structure

tests/
├── libraries/                    # Python libraries
│   ├── ErrorHandler.py           # Error handling and retry logic
│   ├── ExcelValidator.py         # Excel validation logic
│   ├── TimelineAnalyzer.py       # Timeline analysis
│   ├── PowerPointValidator.py    # PowerPoint validation
│   └── VisualComparison.py       # Visual regression testing
├── resources/                    # Robot Framework resources
├── scripts/                      # Utility scripts
├── data/                         # Test data and baselines
├── test_timeline_data.robot      # Data validation tests (11 tests)
├── test_timeline_features.robot  # Feature validation tests (14 tests)
├── test_timeline_edge_cases.robot # Edge case tests (12 tests)
├── test_powerpoint_output.robot  # PowerPoint structural tests (13 tests)
└── test_visual_regression.robot  # Visual regression tests (7 tests)

Quick Start for Testing

# Setup testing environment
bash setup.sh

# Run all tests (57 total)
bash run_tests.sh

# Or run specific test suites
cd tests
robot --outputdir ../reports test_timeline_data.robot      # Data validation
robot --outputdir ../reports test_timeline_features.robot   # Feature tests
robot --outputdir ../reports test_timeline_edge_cases.robot # Edge cases
robot --outputdir ../reports test_powerpoint_output.robot   # PowerPoint validation
robot --outputdir ../reports test_visual_regression.robot   # Visual regression
robot --outputdir ../reports test_*.robot                   # All tests

Test Coverage

Category Tests Description
Data Validation 11 Excel structure, headers, required fields
Feature Validation 14 Event types, swimlanes, date ranges, overlaps
Edge Cases 12 Error handling, invalid data, boundary conditions
PowerPoint Output 13 Slide structure, shapes, positions, content
Visual Regression 7 Image comparison, baseline matching
Total 57

Running Tests with Tags

cd tests

# Run smoke tests only
robot --outputdir ../reports --include smoke test_*.robot

# Run feature validation
robot --outputdir ../reports --include feature_validation test_*.robot

# Exclude edge cases
robot --outputdir ../reports --exclude edge_cases test_*.robot

Viewing Test Reports

After test execution, reports are generated in reports/:

  • report.html: Comprehensive HTML report with test results
  • log.html: Detailed execution log
  • output.xml: Machine-readable XML results
# Windows
start reports/report.html

# Linux
xdg-open reports/report.html

# Mac
open reports/report.html

Troubleshooting

Common Issues

Problem Solution
"Method or data member not found" Verify TimelineConfig type definition is complete
"Excel is not open" Ensure Excel is running with your data file open
"Sheet 'TimelineData' not found" Verify sheet name is exactly "TimelineData"
"No valid data found" Check that data starts in row 2 with headers in row 1
Events overlapping Use more swimlanes or check date formats
Timeline too cramped Increase laneHeight or swimlaneBottomMargin

Performance Notes

  • Works best with 50 or fewer timeline events
  • Very dense timelines may require manual adjustment of LaneHeight
  • Large date ranges may need font size adjustments
  • For 50+ events, multi-slide distribution is automatic

Test Troubleshooting

# Missing dependencies
source venv/Scripts/activate  # or venv/bin/activate
pip install -r requirements.txt

# Excel file not found
export EXCEL_FILE_PATH=timeline.xlsx

Technical Details

Swimlane Organization Algorithm

The script uses an intelligent swimlane system that:

  1. Groups Events: Automatically groups events by their swimlane designation
  2. Creates Headers: Adds labeled headers for each swimlane with professional styling
  3. Independent Lane Management: Each swimlane manages its own lanes for overlapping events
  4. Optimal Spacing: Calculates vertical spacing to accommodate multiple swimlanes and lanes

Overlap Detection Algorithm

Within each swimlane, the script uses a sophisticated algorithm that:

  1. Converts all dates to X-coordinates on the timeline
  2. Adds buffer zones around milestones for label space
  3. Compares each event with all previous events in the same swimlane
  4. Assigns the lowest available lane that avoids conflicts

Visual Enhancements

  • Connector Lines: Subtle dashed lines link off-axis events to main timeline
  • Lane Separators: Light gray horizontal lines separate lanes visually
  • Smart Labels: Milestone labels include both name and date
  • Professional Colors: Carefully chosen color palette for business presentations

Version History

Version 2.1 (Current) - Performance & Maintainability Release

Major Improvements:

  • Global Configuration Object for 40% better performance
  • Function Consolidation (70+ lines of code reduction)
  • Enhanced Lane Calculation with accurate height calculations
  • Multi-Slide Support for large datasets
  • Comprehensive testing framework (57 automated tests)

Technical Enhancements:

  • Merged redundant rendering functions
  • Standardized naming conventions
  • Optimized memory usage with global configuration pattern

Version 2.0 - Multi-Lane Support

  • Added multi-lane support with automatic overlap detection
  • Introduced swimlane organization system
  • Enhanced visual styling

Version 1.0 - Basic Timeline

  • Basic single-line timeline generation
  • Excel integration for data input
  • Professional PowerPoint output

CI/CD Integration

The project includes GitHub Actions workflows for automated testing:

  • .github/workflows/robot-tests.yml - Data validation tests
  • .github/workflows/powerpoint-tests.yml - PowerPoint structural and visual tests

Tests run on:

  • Multiple operating systems (Ubuntu, Windows, macOS)
  • Multiple Python versions (3.9, 3.10, 3.11)
  • On push and pull requests

License

MIT License - See LICENSE for details.


Created for project managers, analysts, and consultants who need professional timeline visualizations in PowerPoint.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors