IronPPT 시작하기

This article was translated from English: Does it need improvement?
Translated
View the article in English

IronPowerPoint: .NET 용 PowerPoint 라이브러리

IronPPT 는 Iron Software 에서 개발한 PowerPoint 라이브러리입니다. 이 소프트웨어는 .NET 애플리케이션에서 PowerPoint 프레젠테이션 작업을 위한 강력한 기능을 제공하는 데 탁월합니다.

  • 파워포인트 프레젠테이션을 불러오고, 편집하고, 저장합니다. .pptx 및 .ppt 파일을 간편하게 작업할 수 있습니다.
  • 슬라이드 설정: 슬라이드 크기, 방향, 배경색 및 레이아웃을 구성합니다.
  • 텍스트: 텍스트 내용, 스타일, 분할, 텍스트 추가 및 텍스트 상자 추가를 처리합니다.
  • 텍스트 스타일: 글꼴 종류, 크기, 색상, 굵게, 기울임, 밑줄 및 정렬을 관리합니다.
  • 도형: 크기, 위치, 유형 및 회전을 설정하는 것을 포함하여 도형을 추가하고 조작할 수 있습니다.
  • 이미지: 크기 조정, 정렬 및 위치 지정 옵션을 사용하여 슬라이드에 이미지를 삽입합니다.

설치

IronPPT 라이브러리

IronPPT 설치는 빠르고 간단합니다. 다음 방법을 사용하여 패키지를 추가하세요.

Install-Package IronPPT

또는 IronPPT 공식 NuGet 웹사이트 에서 직접 다운로드할 수도 있습니다.

설치 후, C# 코드 상단에 using IronPPT;를 포함하여 시작할 수 있습니다.

라이선스 키 적용

IronPPT를 사용하려면 LicenseKey 속성을 설정하여 유효한 라이선스 또는 평가판 키를 적용하십시오. 다음 코드를 import 문 바로 뒤, 그리고 IronPPT 메서드를 호출하기 전에 추가하십시오.

:path=/static-assets/ppt/content-code-examples/get-started/get-started-license.cs
/// <summary>
/// This code sets the license key for the IronPPT library.
/// Ensure you have the correct namespace access by installing the IronPPT NuGet package
/// and adjust the license key appropriately for your use case.
/// </summary>

using System; // Required for Console output
using IronPPT; // Ensure the IronPPT library is referenced in your project.

namespace IronPPTApplication
{
    class Program
    {
        public static void Main(string[] args)
        {
            // Calling the method to set the IronPPT license key.
            SetIronPPTLicense();
        }

        /// <summary>
        /// Sets the license key for the IronPPT library to unlock its full features.
        /// </summary>
        private static void SetIronPPTLicense()
        {
            // Correctly setting the license for the IronPPT library.
            // Replace "IRONPPT.MYLICENSE.KEY.1EF01" with your actual key.
            IronPPT.License.LicenseKey = "IRONPPT.MYLICENSE.KEY.1EF01";

            // Inform the user that the license key has been set.
            Console.WriteLine("IronPPT license key has been set.");
        }
    }
}
$vbLabelText   $csharpLabel

코드 예제

이제 몇 가지 코드 예제와 사용 가능한 기능들을 살펴보겠습니다.

파워포인트 파일 생성

하나의 생성자를 사용하여 PresentationDocument 클래스를 인스턴스화하여 PowerPoint 프레젠테이션을 만드세요. AddSlideAddText 메소드를 각각 사용하여 슬라이드 및 텍스트를 추가하세요. 그 후, Save 메소드를 사용하여 PowerPoint 프레젠테이션을 내보내세요.

:path=/static-assets/ppt/content-code-examples/get-started/get-started-1.cs
using IronPPT;

// This code demonstrates the creation of a PowerPoint presentation and saving it as a file.

// Create a new PowerPoint presentation document
var document = new PresentationDocument();

// Create a new slide object
var slide = new Slide();

// Add text content to the slide
slide.AddText("Hello!");

// Add the newly created slide with text to the document
document.AddSlide(slide);

// Export the PowerPoint presentation to a file named "output.pptx"
document.Save("output.pptx");
$vbLabelText   $csharpLabel

도형 추가

슬라이드 객체에서 AddShape 메소드를 사용하여 도형을 추가할 수 있습니다. 다양한 도형 속성을 구성할 수 있으며, 예를 들어 채우기 색, 윤곽선 색, 위치, 각도, 유형 등이 포함됩니다.

:path=/static-assets/ppt/content-code-examples/get-started/get-started-2.cs
using IronPPT;
using IronPPT.Drawing; // Assuming this namespace contains `Shape` and `Color` classes
using IronPPT.Enums; // Assuming this namespace contains the `ShapeType` enum

// Load a PowerPoint presentation from the specified file
var document = new PresentationDocument("output.pptx");

// Create and configure a new shape, in this case, a triangle
Shape shape = new Shape
{
    Name = "triangle",             // Assign a name to the shape
    Type = ShapeType.Triangle,     // Set the shape type to Triangle
    Width = 100,                   // Set the width of the shape
    Height = 100,                  // Assumed height for the shape, should be set for visibility
    FillColor = new Color("#444444"), // Set the fill color of the shape
    OutlineColor = Color.Black,    // Set the outline color to black
    Position = new System.Drawing.Point(200, 200) // Set the position of the shape
};

// Ensure that the slides array has at least one slide to add the shape to
if (document.Slides.Count > 0)
{
    // Add the shape to the first slide
    document.Slides[0].AddShape(shape);
}
else
{
    // If there are no slides, handle the error or add a slide
    document.Slides.Add(new Slide()); // Assuming there's a way to add new slides
    document.Slides[0].AddShape(shape); // Add the shape to the newly added slide
}

// Export the PowerPoint presentation to a new file
document.Save("addShape.pptx");
$vbLabelText   $csharpLabel

이미지 추가

슬라이드에 이미지를 추가하는 것 또한 간단한 작업입니다. 아래 코드 예제는 첫 번째 슬라이드에 이미지를 추가하고, 위치, 각도, 이름, 너비, 높이와 같은 이미지 속성을 수정한 다음, 업데이트된 프레젠테이션을 .pptx 파일로 저장합니다.

:path=/static-assets/ppt/content-code-examples/get-started/get-started-3.cs
using IronPPT;
using System.Drawing;

// This code demonstrates creating a new PowerPoint presentation, adding an image to it,
// modifying the image's properties, and exporting the presentation.

// Create a new PowerPoint presentation
var document = new PresentationDocument();

// Ensure there's at least one slide in the presentation
// Create the first slide if it doesn't exist yet
if (document.Slides.Count == 0)
{
    document.Slides.Add();
}

// Initialize an Image object
// Load an image from a file specified by the file path
// Ensure that "sample.png" exists at the specified path
Image image = new Image(); 
image.LoadFromFile("sample.png");

// Add the image to the first slide of the presentation
var newImage = document.Slides[0].AddImage(image);

// Edit the image's properties
// Set the position of the image using X and Y coordinates
newImage.Position = new Point(200, 200);

// Set the rotation angle of the image in degrees
newImage.Angle = 45;

// Set a name for the image, which can be useful for identification
newImage.Name = "new image";

// Set the dimensions of the image
newImage.Width = 150;
newImage.Height = 150;

// Export the PowerPoint presentation with the new image
document.Save("addImage.pptx");
$vbLabelText   $csharpLabel

라이선스 및 지원 가능

IronPPT 는 상용 라이브러리이지만 무료 평가판 라이선스를 이용할 수 있습니다.

Iron Software 에 대한 자세한 내용은 당사 웹사이트를 방문하십시오.https://ironsoftware.com/ . 도움이 필요하시거나 문의사항이 있으시면 저희 팀으로 연락 주세요.

Iron Software 지원

일반적인 문의 사항이나 기술적인 질문이 있으시면 언제든지 다음 이메일 주소로 연락주세요:support@ironsoftware.com .

커티스 차우
기술 문서 작성자

커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다.

커티스는 개발 분야 외에도 사물 인터넷(IoT)에 깊은 관심을 가지고 있으며, 하드웨어와 소프트웨어를 통합하는 혁신적인 방법을 연구합니다. 여가 시간에는 게임을 즐기거나 디스코드 봇을 만들면서 기술에 대한 애정과 창의성을 결합합니다.

시작할 준비 되셨나요?
Nuget 다운로드 4,319 | 버전: 2026.3 방금 출시되었습니다
Still Scrolling Icon

아직도 스크롤하고 계신가요?

빠른 증거를 원하시나요? PM > Install-Package IronPPT
샘플을 실행하세요 PDF 파일이 편집 가능한 텍스트로 바뀌는 것을 확인하세요.