Hızlı Başlangıç

Hızlı Başlangıç

Bu rehber, CMake ayarından bir kurtarılan yolun en hızlı yolu gösterir. .pptx Dosya Kullanımı aspose_slides_foss Kütüphane MIT lisanslıdır, Microsoft Office gerektirmez, ve herhangi bir platformda C++20 kompozitörü ve CMake 3.20 veya sonraki ile oluşturulur.


Prerequisites

RequirementDetail
C++ standartlarıC++20 veya daha sonraki
CMAKİ3.20 or later
OSWindows, MacOS ve Linux
Packageaspose_slides_foss CMake FetchContent ile ilgili bilgiler

Install

CMAK kullanın FetchContent Kütüphaneyi zamanında ayarlayın.Aşağıdaki eklemeye devam edin: Senin için CMakeLists.txt Sonra link ile karşı aspose_slides_foss:

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)
target_link_libraries(your_target PRIVATE aspose_slides_foss)

Bir sunum oluşturun

Construct Presentation Beyaz bir çatı oluşturmak için hiçbir argüman ile, sonra arama save() Bir yol ve SaveFormat::PPTX.Kütüphane otomatik olarak boş bir slayt ekler:

#include <Aspose/Slides/Foss/presentation.h>
#include <Aspose/Slides/Foss/export/save_format.h>

using namespace Aspose::Slides::Foss;

int main() {
    Presentation prs;
    prs.save("empty.pptx", SaveFormat::PPTX);
    return 0;
}

Bir yazı ile bir şekil ekleyin

İlk slayt üzerinden ulaşın prs.slides()[0],Bir düzlemle bir düzleme yapın. shapes().add_auto_shape(),ve onun yazısını, text_frame()->set_text():

#include <Aspose/Slides/Foss/auto_shape.h>
#include <Aspose/Slides/Foss/presentation.h>
#include <Aspose/Slides/Foss/shape_type.h>
#include <Aspose/Slides/Foss/text_frame.h>
#include <Aspose/Slides/Foss/export/save_format.h>

int main() {
    Presentation prs;
    auto& slide = prs.slides()[0];
    auto& shape = slide.shapes().add_auto_shape(
        ShapeType::RECTANGLE, 50, 50, 400, 150
    );
    shape.text_frame()->set_text("Hello from Aspose.Slides FOSS!");
    prs.save("with_shape.pptx", SaveFormat::PPTX);
    return 0;
}

Solid Fill uygulayın

Call fill_format().set_fill_type(FillType::SOLID) Şekil ve tedarik için bir ARGB renkler solid_fill_color().set_color() Çağrıdan Önce save():

#include <Aspose/Slides/Foss/auto_shape.h>
#include <Aspose/Slides/Foss/fill_format.h>
#include <Aspose/Slides/Foss/fill_type.h>
#include <Aspose/Slides/Foss/presentation.h>
#include <Aspose/Slides/Foss/shape_type.h>
#include <Aspose/Slides/Foss/export/save_format.h>

int main() {
    Presentation prs;
    auto& shape = prs.slides()[0].shapes().add_auto_shape(
        ShapeType::RECTANGLE, 100, 100, 400, 200
    );
    shape.fill_format().set_fill_type(FillType::SOLID);
    shape.fill_format().solid_fill_color().set_color(0xFF, 0x46, 0x82, 0xB4);
    shape.text_frame()->set_text("Styled shape");
    prs.save("styled.pptx", SaveFormat::PPTX);
    return 0;
}

Mevcut bir dosyayı yükleme

Bir dosya yolu çubuğunu iletmek için Presentation Mevcut bir ürünü yüklemek için .pptx Dosya. gerekirse çatı değiştirin ve sonra arama yapın save() çıkışını yazmak için:

#include <Aspose/Slides/Foss/presentation.h>
#include <Aspose/Slides/Foss/export/save_format.h>

int main() {
    Presentation prs("existing.pptx");
    prs.save("copy.pptx", SaveFormat::PPTX);
    return 0;
}

Sonraki adımlar

See Also

 Türkçe