VSTO 및 Aspose.Slides for .NET을 사용하여 새 프레젠테이션 만들기

프레젠테이션 만들기

아래는 VSTO와 Aspose.Slides for .NET를 사용하여 동일한 목표를 달성하는 방법을 보여주는 두 가지 코드 예제입니다. 첫 번째 예제는 VSTO; 두 번째 예제는 Aspose.Slides를 사용합니다.

VSTO 예제

VSTO 출력

todo:image_alt_text

//참고: PowerPoint는 위에서 다음과 같이 정의된 네임스페이스입니다
//using PowerPoint = Microsoft.Office.Interop.PowerPoint;

//프레젠테이션 만들기
PowerPoint.Presentation pres = Globals.ThisAddIn.Application
	.Presentations.Add(Microsoft.Office.Core.MsoTriState.msoFalse);

//Get the title slide layout
PowerPoint.CustomLayout layout = pres.SlideMaster.
	CustomLayouts[PowerPoint.PpSlideLayout.ppLayoutTitle];

//Add a title slide.
PowerPoint.Slide slide = pres.Slides.AddSlide(1, layout);

//Set the title text
slide.Shapes.Title.TextFrame.TextRange.Text = "Slide Title Heading";

//Set the sub title text
slide.Shapes[2].TextFrame.TextRange.Text = "Slide Title Sub-Heading";

//Write the output to disk
pres.SaveAs("c:\\outVSTO.ppt",
	PowerPoint.PpSaveAsFileType.ppSaveAsPresentation,
	Microsoft.Office.Core.MsoTriState.msoFalse);

Aspose.Slides for .NET 예제

Aspose.Slides 출력

todo:image_alt_text

//프레젠테이션 만들기
Presentation pres = new Presentation();

//제목 슬라이드 추가
ISlide slide = pres.Slides.AddEmptySlide(pres.LayoutSlides[0]);


//제목 텍스트 설정
((IAutoShape)slide.Shapes[0]).TextFrame.Text = "Slide Title Heading";

//부제목 텍스트 설정
((IAutoShape)slide.Shapes[1]).TextFrame.Text = "Slide Title Sub-Heading";

//출력을 디스크에 기록
pres.Save("c:\\data\\outAsposeSlides.pptx", SaveFormat.Ppt);