Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hihigash committed Dec 17, 2017
1 parent 60127a5 commit 90f0eb0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pptx2img/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using CommandLine.Text;
using Microsoft.Office.Core;
using Microsoft.Office.Interop.PowerPoint;
using Shape = Microsoft.Office.Interop.PowerPoint.Shape;

namespace pptx2img
{
Expand Down Expand Up @@ -49,7 +50,9 @@ static void Main(string[] args)
int i = 1;
foreach (Slide slide in presentation.Slides)
{
var shape = slide.Shapes.Range(slide.Shapes.GetIndices()).Group();
if (slide.Shapes.Count == 0) continue;

var shape = (slide.Shapes.Count > 1) ? slide.Shapes.Range(slide.Shapes.GetIndices()).Group() : slide.Shapes[1];
shape.Export(Path.Combine(Path.GetFullPath(options.OutDir), $"{fileNameWithoutExtension}_{i}.png"), PpShapeFormat.ppShapeFormatPNG);
i++;
}
Expand Down

0 comments on commit 90f0eb0

Please sign in to comment.