Skip to content

mustaddon/PowerPointService

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PowerPointTool NuGet version

PowerPoint presentation from template and model

Example #1 - Create from template

var ppTool = new PPTool();
var template = File.ReadAllBytes(@".\template.pptx");
var result = ppTool.CreateFromTemplate(template, ctx => new {
  Title = "Example",
  Created = DateTimeOffset.Now,
  User = new { 
    Name = "TestName", 
    IsActive = true,
    Evaluation = 1000000,
  },
  Items = Enumerable.Range(1, 5).Select(x => $"item#{x}"),
});

Example #2 - Iterator for slides/rows

var result = ppTool.CreateFromTemplate(template, ctx => 
  Enumerable.Range(1, 3).Select(x => new {
    CompanyName = $"Company #{x}",
    Employees = Enumerable.Range(1, _rnd.Next(4, 12)).Select(xx => new {
        Name = $"Employee #{xx}",
        Email = $"emp{xx}@company{x}.test",
        Birthday = new DateTime(_rnd.Next(1980, 2000), _rnd.Next(1, 12), 1).AddDays(_rnd.Next(0, 30)),
    }),
  })
);

Presentations: template.pptx , result.pptx

Program.cs

Releases

No releases published

Packages

No packages published