Aspose.Slides FOSS for C++는 PowerPoint .pptx 파일을 작업하기 위한 MIT-licensed 라이브러리입니다. CMake FetchContent를 통해 통합하고 Microsoft Office나 어떤 독점 런타임도 설치하지 않고 바로 프레젠테이션을 만들고, 읽고, 편집할 수 있습니다.
이 라이브러리는 Presentation, Slide, ShapeCollection, TextFrame, Paragraph, 및 Portion을 중심으로 구축된 Presentation API를 노출합니다. 이는 PowerPoint 자체에서 사용하는 개념 모델입니다. 슬라이드를 추가 및 제거하고, AutoShapes, Tables, Connectors를 삽입하며, 굵게, 기울임꼴, 글꼴 크기 및 색상으로 문자 수준에서 텍스트를 서식 지정하고, 단색 또는 그라디언트 채우기를 적용하며, 시각 효과(그림자, 글로우, 블러, 반사)를 추가합니다.
RAII 의미론은 신뢰할 수 있는 리소스 정리를 보장합니다: Presentation destructor는 모든 내부 상태를 자동으로 해제합니다. 로드 중에 발견된 알 수 없는 XML 부분은 저장 시 그대로 보존되므로, 라운드 트리핑 시 라이브러리가 아직 이해하지 못하는 콘텐츠가 파괴되지 않습니다. 이 라이브러리는 C++20 호환 컴파일러가 필요합니다. 추가 기능은 Aspose.Slides for C++ enterprise edition을(를) 참조하십시오.
Presentation() 또는 Presentation(path)를 통해 기존 .pptx 파일을 열 수 있습니다.SlideCollection을 add_empty_slide(), remove(), 및 remove_at()와 함께 관리합니다.ShapeType 기하학을 add_auto_shape()을 통해 삽입합니다.add_connector().NotesSlideManager을 통해 읽고 쓸 수 있습니다.pres.comment_authors()을(를) 반복하여 해당 댓글 스레드와 연관된 댓글에 접근합니다.Portion 객체에 굵게, 기울임, 글꼴 크기 및 색상을 적용하려면 PortionFormat을(를) 사용하십시오.FillFormat와 FillType을 사용하여 도형 채우기를 단색 또는 다중 정지 선형 그라디언트로 설정합니다.EffectFormat를 통해 모든 모양에 적용합니다.ParagraphFormat와 set_alignment()을 사용하여 설정합니다.Aspose.Slides FOSS는 CMake FetchContent를 통해 통합되므로 수동 다운로드나 시스템 전체 설치가 필요하지 않습니다. 라이브러리는 프로젝트와 함께 소스에서 빌드됩니다.
API는 PowerPoint 자체 객체 모델(Presentation, Slide, ShapeCollection, TextFrame, Paragraph, Portion)을 그대로 반영하므로, PowerPoint 객체 모델에 익숙한 사람은 즉시 라이브러리를 사용할 수 있습니다. 이 라이브러리는 MIT-licensed이며, GitHub에서 오픈 소스로 제공되고, C++20‑compatible 컴파일러가 필요합니다.
RAII는 Presentation 소멸자가 객체가 범위를 벗어날 때 모든 리소스를 자동으로 해제하도록 보장합니다. add_auto_shape()은 ShapeType 열거형을 받고, 그 다음에 포인트 단위의 x/y 위치와 너비/높이를 받습니다 — shape의 text_frame는 텍스트 내용을 설정할 수 있는 접근을 제공합니다.
include(FetchContent)
FetchContent_Declare(
aspose_slides_foss
GIT_REPOSITORY https://github.com/aspose-slides-foss/Aspose.Slides-FOSS-for-Cpp.git
GIT_TAG main
)
FetchContent_MakeAvailable(aspose_slides_foss)
#include <Aspose/Slides/Foss/auto_shape.h>
#include <Aspose/Slides/Foss/export/save_format.h>
#include <Aspose/Slides/Foss/presentation.h>
#include <Aspose/Slides/Foss/shape_collection.h>
#include <Aspose/Slides/Foss/shape_type.h>
#include <Aspose/Slides/Foss/slide.h>
#include <Aspose/Slides/Foss/slide_collection.h>
#include <Aspose/Slides/Foss/text_frame.h>
int main() {
Aspose::Slides::Foss::Presentation prs;
auto& slide = prs.slides()[0];
// Add a rectangle AutoShape
auto& shape = slide.shapes().add_auto_shape(
Aspose::Slides::Foss::ShapeType::RECTANGLE,
50, 50, 400, 150
);
shape.text_frame()->set_text("Hello, Aspose.Slides!");
prs.save("output.pptx", Aspose::Slides::Foss::SaveFormat::PPTX);
return 0;
}
```cmake
include(FetchContent)
FetchContent_Declare(
aspose_slides_foss
GIT_REPOSITORY https://github.com/aspose-slides-foss/Aspose.Slides-FOSS-for-Cpp.git
GIT_TAG main
)
FetchContent_MakeAvailable(aspose_slides_foss)
텍스트 서식은 Portion 수준에서 작동합니다 — 문자 연속의 가장 작은 단위입니다. 저장된 파일을 열고, 첫 번째 단락의 첫 번째 부분으로 이동한 다음 글꼴 속성을 직접 설정합니다. Shape fill은 독립적입니다: fill type을 solid로 설정하고 색상을 지정합니다.
#include <Aspose/Slides/Foss/presentation.h>
namespace asf = Aspose::Slides::Foss;
int main() {
asf::Presentation prs("output.pptx");
auto& shape = prs.slides()[0].shapes()[0];
auto& portion = shape.text_frame()
->paragraphs()[0].portions()[0];
// Bold, 18pt text
portion.portion_format().set_font_bold(asf::NullableBool::TRUE);
portion.portion_format().set_font_height(18);
// Solid background fill on the shape
shape.fill_format().set_fill_type(asf::FillType::SOLID);
prs.save("formatted.pptx", asf::SaveFormat::PPTX);
return 0;
}
```cpp
#include <Aspose/Slides/Foss/presentation.h>
namespace asf = Aspose::Slides::Foss;
int main() {
asf::Presentation prs("output.pptx");
auto& shape = prs.slides()[0].shapes()[0];
auto& portion = shape.text_frame()
->paragraphs()[0].portions()[0];
// Bold, 18pt text
portion.portion_format().set_font_bold(asf::NullableBool::TRUE);
portion.portion_format().set_font_height(18);
// Solid background fill on the shape
shape.fill_format().set_fill_type(asf::FillType::SOLID);
prs.save("formatted.pptx", asf::SaveFormat::PPTX);
return 0;
}
이 라이브러리는 Microsoft Office 없이 PowerPoint .pptx 프레젠테이션을 생성, 읽기 및 편집할 수 있는 무료 MIT 라이선스 C++ 라이브러리입니다.
.pptx은(는) 지원되는 읽기/쓰기 형식입니다. PDF, HTML, SVG 또는 이미지로 내보내기는 이 버전에서 제공되지 않습니다.
아니오. Aspose.Slides FOSS는 Microsoft Office, COM 자동화 또는 어떤 독점 런타임에도 의존하지 않는 독립형 C++ 라이브러리입니다.
CMake FetchContent를 사용하여 라이브러리를 GitHub에서 직접 통합하십시오. 이 라이브러리는 C++20 호환 컴파일러가 필요합니다.
예. 라이브러리는 EffectFormat API를 통해 모든 도형 객체에 외부 그림자, 글로우, 블러 및 반사 효과를 지원합니다.
예. Presentation 소멸자는 모든 내부 상태를 자동으로 해제하므로 명시적인 정리가 필요하지 않습니다.
아니오. 로드 중에 발견된 알 수 없는 XML 파트는 저장 시 그대로 보존되므로 라이브러리가 아직 이해하지 못하는 콘텐츠가 손실되지 않습니다.
이 라이브러리는 MIT 라이선스를 가지고 있으며 GitHub에 호스팅됩니다. 버그 보고 및 풀 리퀘스트를 환영합니다.