قالببندی متن ارائه در C++
بررسی کلی
این مقاله نشان میدهد چگونه متن را در ارائههای PowerPoint و OpenDocument با استفاده از Aspose.Slides برای C++ قالببندی کنید. این مقاله شامل رنگهای پسزمینه، شفافیت، فاصله بین حروف، ویژگیهای قلم، چرخش، فاصله بین پاراگرافها، رفتار autofit، قرارگیری متن، توقفگاههای تب و تنظیمات زبان میباشد.
مگر خلاف آن ذکر شود، مثالها از sample.pptx استفاده میکنند. اولین شکل در اسلاید اول آن یک جعبه متن است و اولین پاراگراف آن متنی که در زیر نشان داده شده را دارد. شاخصهای اسلاید و شکل به صورت صفر-پایه هستند. مثالهایی که بخشهای بولد شده را انتخاب میکنند از قالببندی مؤثر استفاده میکنند، از جمله قالببندی بولد به ارثبرده:

برای یافتن و برجستهسازی متن دقیق یا تطابقهای عبارات منظم، به جستجو و جایگزینی متن مراجعه کنید.
تنظیم رنگ پسزمینه متن
از IParagraphFormat::get_DefaultPortionFormat برای تنظیم رنگ پیشزمینه پیشفرض یک پاراگراف استفاده کنید، یا از IBasePortionFormat::get_HighlightColor برای بخشهای متنی جداگانه استفاده کنید.
مثال زیر برجستهسازی خاکستری روشن را بهعنوان پیشفرض برای اولین پاراگراف تنظیم میکند. رنگهای برجسته صریح بر بخشهای جداگانه بر این پیشفرض اولویت دارند:
#include <DOM/IAutoShape.h>
#include <DOM/IColorFormat.h>
#include <DOM/IParagraph.h>
#include <DOM/IParagraphFormat.h>
#include <DOM/IPortionFormat.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
#include <drawing/color.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
auto presentation = System::MakeObject<Presentation>(u"sample.pptx");
auto firstShape = presentation->get_Slide(0)->get_Shape(0);
auto autoShape = System::ExplicitCast<IAutoShape>(firstShape);
auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0);
auto defaultPortionFormat = paragraph->get_ParagraphFormat()->get_DefaultPortionFormat();
auto highlightColor = System::Drawing::Color::get_LightGray();
// تنظیم رنگ برجسته برای کل پاراگراف.
defaultPortionFormat->get_HighlightColor()->set_Color(highlightColor);
presentation->Save(u"gray_paragraph.pptx", SaveFormat::Pptx);
presentation->Dispose();
نتیجه:

کد مثال زیر نشان میدهد چگونه رنگ پسزمینه را برای بخشهای متنی با قلم بولد تنظیم کنید:
#include <DOM/IAutoShape.h>
#include <DOM/IColorFormat.h>
#include <DOM/IParagraph.h>
#include <DOM/IPortion.h>
#include <DOM/IPortionCollection.h>
#include <DOM/IPortionFormat.h>
#include <DOM/IPortionFormatEffectiveData.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
#include <drawing/color.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
auto presentation = System::MakeObject<Presentation>(u"sample.pptx");
auto firstShape = presentation->get_Slide(0)->get_Shape(0);
auto autoShape = System::ExplicitCast<IAutoShape>(firstShape);
auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0);
auto portions = paragraph->get_Portions();
int portionCount = portions->get_Count();
auto highlightColor = System::Drawing::Color::get_LightGray();
for (int portionIndex = 0; portionIndex < portionCount; portionIndex++)
{
auto portion = paragraph->get_Portion(portionIndex);
auto portionFormat = portion->get_PortionFormat();
if (portionFormat->GetEffective()->get_FontBold())
{
// تنظیم رنگ برجسته برای بخش متن.
portionFormat->get_HighlightColor()->set_Color(highlightColor);
}
}
presentation->Save(u"gray_text_portions.pptx", SaveFormat::Pptx);
presentation->Dispose();
نتیجه:

تراز پاراگرافهای متن
از IParagraphFormat::set_Alignment برای تنظیم تراز پاراگراف درون یک فریم متن استفاده کنید. مقدار میتواند centered، left-aligned، right-aligned، justified و غیره باشد.
مثال زیر نشان میدهد چگونه پاراگراف را به مرکز تراز کنید:
#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IParagraphFormat.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/Presentation.h>
#include <DOM/TextAlignment.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
auto presentation = System::MakeObject<Presentation>(u"sample.pptx");
auto firstShape = presentation->get_Slide(0)->get_Shape(0);
auto autoShape = System::ExplicitCast<IAutoShape>(firstShape);
auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0);
// تنظیم تراز پاراگراف به مرکز.
paragraph->get_ParagraphFormat()->set_Alignment(TextAlignment::Center);
presentation->Save(u"aligned_paragraph.pptx", SaveFormat::Pptx);
presentation->Dispose();
نتیجه:

تراز فونتها درون یک خط
از IParagraphFormat::set_FontAlignment برای تراز عمودی بخشهای متنی با اندازههای قلم متفاوت درون یک خط استفاده کنید. این تنظیمات برای تمام پاراگراف اعمال میشود و تراز در هر یک از خطوط آن را کنترل میکند.
مثال زیر بهصورت خودکفا چهار جعبه متن برچسبدار را در یک اسلاید ایجاد میکند. هر پاراگراف متن یکسانی با اندازههای 18، 36 و 54 پوینت دارد، با تراز فونت متفاوت. از Arial استفاده میکند، autofit و wrapping را غیرفعال میکند و فریمهای متن را به اندازهای بزرگ میگذارد که یک خط کافی باشد.
#include <DOM/FontAlignment.h>
#include <DOM/Fonts/FontData.h>
#include <DOM/IAutoShape.h>
#include <DOM/IColorFormat.h>
#include <DOM/IFillFormat.h>
#include <DOM/ILineFormat.h>
#include <DOM/IParagraph.h>
#include <DOM/IParagraphCollection.h>
#include <DOM/IParagraphFormat.h>
#include <DOM/IPortionCollection.h>
#include <DOM/IPortionFormat.h>
#include <DOM/IShapeCollection.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/ITextFrameFormat.h>
#include <DOM/FillType.h>
#include <DOM/NullableBool.h>
#include <DOM/Paragraph.h>
#include <DOM/Portion.h>
#include <DOM/Presentation.h>
#include <DOM/ShapeType.h>
#include <DOM/TextAlignment.h>
#include <DOM/TextAnchorType.h>
#include <DOM/TextAutofitType.h>
#include <Export/SaveFormat.h>
#include <drawing/color.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
using namespace System;
using namespace System::Drawing;
auto presentation = MakeObject<Presentation>();
auto slide = presentation->get_Slide(0);
FontAlignment alignments[] = { FontAlignment::Baseline, FontAlignment::Top, FontAlignment::Center, FontAlignment::Bottom };
String labels[] = { u"Baseline", u"Top", u"Center", u"Bottom" };
float fontSizes[] = { 18.0f, 36.0f, 54.0f };
auto font = MakeObject<FontData>(u"Arial");
for (auto i = 0; i < 4; i++)
{
auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 30, 20 + i * 130, 660, 120);
shape->get_FillFormat()->set_FillType(FillType::NoFill);
shape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::NoFill);
auto textFrame = shape->get_TextFrame();
textFrame->get_TextFrameFormat()->set_AnchoringType(TextAnchorType::Top);
textFrame->get_TextFrameFormat()->set_AutofitType(TextAutofitType::None);
textFrame->get_TextFrameFormat()->set_WrapText(NullableBool::False);
auto label = textFrame->get_Paragraph(0);
label->set_Text(labels[i]);
label->get_ParagraphFormat()->set_Alignment(TextAlignment::Left);
auto labelFormat = label->get_ParagraphFormat()->get_DefaultPortionFormat();
labelFormat->set_FontHeight(14);
labelFormat->set_LatinFont(font);
labelFormat->get_FillFormat()->set_FillType(FillType::Solid);
labelFormat->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Gray());
auto paragraph = MakeObject<Paragraph>();
paragraph->get_ParagraphFormat()->set_FontAlignment(alignments[i]);
paragraph->get_ParagraphFormat()->set_Alignment(TextAlignment::Left);
auto portionFormat = paragraph->get_ParagraphFormat()->get_DefaultPortionFormat();
portionFormat->set_LatinFont(font);
portionFormat->get_FillFormat()->set_FillType(FillType::Solid);
portionFormat->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black());
for (auto fontSize : fontSizes)
{
auto portion = MakeObject<Portion>(u"Ag ");
portion->get_PortionFormat()->set_FontHeight(fontSize);
paragraph->get_Portions()->Add(portion);
}
textFrame->get_Paragraphs()->Add(paragraph);
}
presentation->Save(u"font_alignment.pptx", SaveFormat::Pptx);
presentation->Dispose();
نتیجه:

تراز فونت از متریکهای قلم استفاده میکند، بنابراین لبههای قابل مشاهده حروف لزوماً دقیقاً همسطح نیستند. مثال شامل یک حرف بزرگ و یک descender است تا تفاوت بین تراز baseline و bottom نشان داده شود. در دسترس بودن و جایگزینی قلم، کاراکترهای استفادهشده و تفاوت در اندازههای قلم بر نتایج تأثیر میگذارد. ابعاد فریم، حاشیهها، فاصله خطوط، wrapping و autofit نیز بر چیدمان تأثیر دارند؛ برای مقایسه حالتها از همان قلمها و تنظیمات چیدمان استفاده کنید.
این تنظیم متفاوت از IParagraphFormat::set_Alignment است که تراز افقی پاراگراف را کنترل میکند و همچنین متفاوت از ITextFrameFormat::set_AnchoringType است که بلوک متن را بهصورت عمودی درون شکل موقعیت میدهد. قالببندی superscript و subscript از طریق IBasePortionFormat::set_Escapement بخشهای جداگانه را نسبت به baseline جابهجا میکند به جای تنظیم تراز قلم برای خطوط پاراگراف.
تنظیم شفافیت برای متن
شفافیت متن از طریق مؤلفه آلفای رنگی که از طریق IBasePortionFormat::get_FillFormat اختصاص داده میشود، کنترل میشود. در مثالهای زیر، alpha = 50 یک مقدار کانال آلفای ARGB در مقیاس 0 تا 255 است، نه درصد شفافیت.
کد مثال زیر نشان میدهد چگونه شفافیت را بر تمام پاراگراف اعمال کنید:
#include <DOM/FillType.h>
#include <DOM/IAutoShape.h>
#include <DOM/IColorFormat.h>
#include <DOM/IFillFormat.h>
#include <DOM/IParagraph.h>
#include <DOM/IParagraphFormat.h>
#include <DOM/IPortionFormat.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
#include <drawing/color.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
int alpha = 50;
auto presentation = System::MakeObject<Presentation>(u"sample.pptx");
auto firstShape = presentation->get_Slide(0)->get_Shape(0);
auto autoShape = System::ExplicitCast<IAutoShape>(firstShape);
auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0);
auto defaultPortionFormat = paragraph->get_ParagraphFormat()->get_DefaultPortionFormat();
// تنظیم رنگ پر کردن متن به رنگ شفاف.
defaultPortionFormat->get_FillFormat()->set_FillType(FillType::Solid);
auto baseColor = System::Drawing::Color::get_Black();
auto transparentColor = System::Drawing::Color::FromArgb(alpha, baseColor);
defaultPortionFormat->get_FillFormat()->get_SolidFillColor()->set_Color(transparentColor);
presentation->Save(u"transparent_paragraph.pptx", SaveFormat::Pptx);
presentation->Dispose();
نتیجه:

مثال زیر نشان میدهد چگونه شفافیت را بر بخشهای متنی با قلم بولد اعمال کنید:
#include <DOM/FillType.h>
#include <DOM/IAutoShape.h>
#include <DOM/IColorFormat.h>
#include <DOM/IFillFormat.h>
#include <DOM/IParagraph.h>
#include <DOM/IPortion.h>
#include <DOM/IPortionCollection.h>
#include <DOM/IPortionFormat.h>
#include <DOM/IPortionFormatEffectiveData.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
#include <drawing/color.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
int alpha = 50;
auto presentation = System::MakeObject<Presentation>(u"sample.pptx");
auto firstShape = presentation->get_Slide(0)->get_Shape(0);
auto autoShape = System::ExplicitCast<IAutoShape>(firstShape);
auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0);
auto portions = paragraph->get_Portions();
int portionCount = portions->get_Count();
for (int portionIndex = 0; portionIndex < portionCount; portionIndex++)
{
auto portion = paragraph->get_Portion(portionIndex);
auto portionFormat = portion->get_PortionFormat();
if (portionFormat->GetEffective()->get_FontBold())
{
// تنظیم شفافیت بخش متن.
portionFormat->get_FillFormat()->set_FillType(FillType::Solid);
auto baseColor = System::Drawing::Color::get_Black();
auto transparentColor = System::Drawing::Color::FromArgb(alpha, baseColor);
portionFormat->get_FillFormat()->get_SolidFillColor()->set_Color(transparentColor);
}
}
presentation->Save(u"transparent_text_portions.pptx", SaveFormat::Pptx);
presentation->Dispose();
نتیجه:

تنظیم فاصله حروف برای متن
از IBasePortionFormat::set_Spacing برای گسترش یا فشردن فاصله بین حروف در یک جعبه متن استفاده کنید. مثالها 3 پوینت فاصله اضافه میکنند؛ مقادیر منفی متن را فشرده میکنند.
کد C++ زیر نشان میدهد چگونه فاصله حروف در تمام پاراگراف گسترش یابد:
#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IParagraphFormat.h>
#include <DOM/IPortionFormat.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
auto presentation = System::MakeObject<Presentation>(u"sample.pptx");
auto firstShape = presentation->get_Slide(0)->get_Shape(0);
auto autoShape = System::ExplicitCast<IAutoShape>(firstShape);
auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0);
// نکته: برای فشردهسازی فاصله بین حروف از مقادیر منفی استفاده کنید.
paragraph->get_ParagraphFormat()->get_DefaultPortionFormat()->set_Spacing(3.0f); // گسترش فاصله بین حروف.
presentation->Save(u"character_spacing_in_paragraph.pptx", SaveFormat::Pptx);
presentation->Dispose();
نتیجه:

کد مثال زیر نشان میدهد چگونه فاصله حروف در بخشهای متنی با قلم بولد گسترش یابد:
#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IPortion.h>
#include <DOM/IPortionCollection.h>
#include <DOM/IPortionFormat.h>
#include <DOM/IPortionFormatEffectiveData.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
auto presentation = System::MakeObject<Presentation>(u"sample.pptx");
auto firstShape = presentation->get_Slide(0)->get_Shape(0);
auto autoShape = System::ExplicitCast<IAutoShape>(firstShape);
auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0);
auto portions = paragraph->get_Portions();
int portionCount = portions->get_Count();
for (int portionIndex = 0; portionIndex < portionCount; portionIndex++)
{
auto portion = paragraph->get_Portion(portionIndex);
auto portionFormat = portion->get_PortionFormat();
if (portionFormat->GetEffective()->get_FontBold())
{
// نکته: برای فشردهسازی فاصله بین حروف از مقادیر منفی استفاده کنید.
portionFormat->set_Spacing(3.0f); // گسترش فاصله بین حروف.
}
}
presentation->Save(u"character_spacing_in_text_portions.pptx", SaveFormat::Pptx);
presentation->Dispose();
نتیجه:

غیرفعال کردن کرنینگ برای قلمهای خاص
در برخی موارد، متنی که توسط Aspose.Slides رندر میشود ممکن است کمی فشردهتر از همان متن در PowerPoint به نظر برسد. این میتواند به این دلیل باشد که PowerPoint دادههای کرنینگ را برای برخی قلمها نادیده میگیرد، حتی هنگامی که قلم حاوی اطلاعات کرنینگ معتبر باشد و کرنینگ در تنظیمات PowerPoint فعال باشد.
برای نزدیکتر شدن خروجی رندر شده به PowerPoint در این موارد، میتوانید کرنینگ را برای بخشهای متنی که از قلم تحت تأثیر استفاده میکنند غیرفعال کنید. از IBasePortionFormat::set_KerningMinimalSize برای تنظیم مقدار بزرگتر از اندازه واقعی قلم استفاده کنید. این مثال به «presentation.pptx» با یک جعبه متن بهعنوان اولین شکل در اسلاید اول نیاز دارد. نامهای قلم مؤثر، از جمله قلمهای ارثبری شده، را بررسی میکند و برای بخشهایی که از Roboto استفاده میکنند آستانه 100 پوینت تنظیم میکند؛ این باعث غیرفعال شدن کرنینگ برای بخشهای مطابقی میشود که اندازه قلم آنها زیر 100 پوینت است:
#include <DOM/IAutoShape.h>
#include <DOM/IFontData.h>
#include <DOM/IPortionFormatEffectiveData.h>
#include <DOM/IParagraph.h>
#include <DOM/IParagraphCollection.h>
#include <DOM/IPortion.h>
#include <DOM/IPortionCollection.h>
#include <DOM/IPortionFormat.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
auto presentation = System::MakeObject<Presentation>(u"presentation.pptx");
auto firstShape = presentation->get_Slide(0)->get_Shape(0);
auto autoShape = System::ExplicitCast<IAutoShape>(firstShape);
System::String targetFont = u"Roboto";
auto textFrame = autoShape->get_TextFrame();
auto paragraphs = textFrame->get_Paragraphs();
int paragraphCount = paragraphs->get_Count();
for (int paragraphIndex = 0; paragraphIndex < paragraphCount; paragraphIndex++)
{
auto paragraph = textFrame->get_Paragraph(paragraphIndex);
auto portions = paragraph->get_Portions();
int portionCount = portions->get_Count();
for (int portionIndex = 0; portionIndex < portionCount; portionIndex++)
{
auto portion = paragraph->get_Portion(portionIndex);
auto portionFormat = portion->get_PortionFormat();
auto textFormat = portionFormat->GetEffective();
auto latinFont = textFormat->get_LatinFont();
auto eastAsianFont = textFormat->get_EastAsianFont();
auto complexScriptFont = textFormat->get_ComplexScriptFont();
bool isLatinFont = latinFont != nullptr && latinFont->get_FontName() == targetFont;
bool isEastAsianFont = eastAsianFont != nullptr && eastAsianFont->get_FontName() == targetFont;
bool isComplexScriptFont = complexScriptFont != nullptr && complexScriptFont->get_FontName() == targetFont;
if (isLatinFont || isEastAsianFont || isComplexScriptFont)
{
portionFormat->set_KerningMinimalSize(100.0f);
}
}
}
presentation->Save(u"output.pptx", SaveFormat::Pptx);
presentation->Dispose();
برای متنی که زیر آستانه باشد، این تنظیم کرنینگ را جلوگیری میکند و میتواند به همراستای کردن رندر Aspose.Slides با خروجی بصری PowerPoint برای قلمهای تحت تأثیر این رفتار خاص PowerPoint کمک کند.
مدیریت ویژگیهای قلم متن
ویژگیهای قلم میتوانند در سطح پاراگراف از طریق IParagraphFormat::get_DefaultPortionFormat یا بر روی بخشهای جداگانه از طریق IPortionFormat تنظیم شوند.
مثال زیر قلم پیشفرض اولین پاراگراف را به 12 پوینت Times New Roman با قالب بولد، ایتالیک و زیرخط نقطهدار تنظیم میکند. قالببندی صریح بر بخشهای جداگانه بر این پیشفرضها اولویت دارد:
#include <DOM/Fonts/FontData.h>
#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IParagraphFormat.h>
#include <DOM/IPortionFormat.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/NullableBool.h>
#include <DOM/Presentation.h>
#include <DOM/TextUnderlineType.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
auto presentation = System::MakeObject<Presentation>(u"sample.pptx");
auto firstShape = presentation->get_Slide(0)->get_Shape(0);
auto autoShape = System::ExplicitCast<IAutoShape>(firstShape);
auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0);
auto defaultPortionFormat = paragraph->get_ParagraphFormat()->get_DefaultPortionFormat();
// تنظیم ویژگیهای قلم برای پاراگراف.
defaultPortionFormat->set_FontHeight(12.0f);
defaultPortionFormat->set_FontBold(NullableBool::True);
defaultPortionFormat->set_FontItalic(NullableBool::True);
defaultPortionFormat->set_FontUnderline(TextUnderlineType::Dotted);
auto font = System::MakeObject<FontData>(u"Times New Roman");
defaultPortionFormat->set_LatinFont(font);
presentation->Save(u"font_properties_for_paragraph.pptx", SaveFormat::Pptx);
presentation->Dispose();
نتیجه:

مثال زیر 13 پوینت Times New Roman، قالب ایتالیک و زیرخط نقطهدار را بر بخشهایی که قالب مؤثر آنها بولد است اعمال میکند:
#include <DOM/Fonts/FontData.h>
#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IPortion.h>
#include <DOM/IPortionCollection.h>
#include <DOM/IPortionFormat.h>
#include <DOM/IPortionFormatEffectiveData.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/NullableBool.h>
#include <DOM/Presentation.h>
#include <DOM/TextUnderlineType.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
auto presentation = System::MakeObject<Presentation>(u"sample.pptx");
auto firstShape = presentation->get_Slide(0)->get_Shape(0);
auto autoShape = System::ExplicitCast<IAutoShape>(firstShape);
auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0);
auto portions = paragraph->get_Portions();
int portionCount = portions->get_Count();
auto font = System::MakeObject<FontData>(u"Times New Roman");
for (int portionIndex = 0; portionIndex < portionCount; portionIndex++)
{
auto portion = paragraph->get_Portion(portionIndex);
auto portionFormat = portion->get_PortionFormat();
if (portionFormat->GetEffective()->get_FontBold())
{
// تنظیم ویژگیهای قلم برای بخش متن.
portionFormat->set_FontHeight(13.0f);
portionFormat->set_FontItalic(NullableBool::True);
portionFormat->set_FontUnderline(TextUnderlineType::Dotted);
portionFormat->set_LatinFont(font);
}
}
presentation->Save(u"font_properties_for_text_portions.pptx", SaveFormat::Pptx);
presentation->Dispose();
نتیجه:

تنظیم چرخش متن
از ITextFrameFormat::set_TextVerticalType برای تعیین جهتگیری پیشتعریفشده متن درون یک شکل استفاده کنید.
کد مثال زیر جهتگیری متن در شکل را به TextVerticalType::Vertical270 تنظیم میکند که متن را 90 درجه خلاف جهت عقربههای ساعت میچرخاند:
#include <DOM/IAutoShape.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/ITextFrameFormat.h>
#include <DOM/Presentation.h>
#include <DOM/TextVerticalType.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
auto presentation = System::MakeObject<Presentation>(u"sample.pptx");
auto firstShape = presentation->get_Slide(0)->get_Shape(0);
auto autoShape = System::ExplicitCast<IAutoShape>(firstShape);
autoShape->get_TextFrame()->get_TextFrameFormat()->set_TextVerticalType(TextVerticalType::Vertical270);
presentation->Save(u"text_rotation.pptx", SaveFormat::Pptx);
presentation->Dispose();
نتیجه:

تنظیم چرخش سفارشی برای فریمهای متن
از ITextFrameFormat::set_RotationAngle برای تنظیم زاویه چرخش سفارشی برای یک ITextFrame استفاده کنید.
کد مثال زیر فریم متن را بهصورت ساعتگرد 3 درجه درون شکل میچرخاند:
#include <DOM/IAutoShape.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/ITextFrameFormat.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
auto presentation = System::MakeObject<Presentation>(u"sample.pptx");
auto firstShape = presentation->get_Slide(0)->get_Shape(0);
auto autoShape = System::ExplicitCast<IAutoShape>(firstShape);
autoShape->get_TextFrame()->get_TextFrameFormat()->set_RotationAngle(3.0f);
presentation->Save(u"custom_text_rotation.pptx", SaveFormat::Pptx);
presentation->Dispose();
نتیجه:

تنظیم فاصله خطوط پاراگرافها
Aspose.Slides متدهای IParagraphFormat::set_SpaceAfter، IParagraphFormat::set_SpaceBefore و IParagraphFormat::set_SpaceWithin را برای کنترل فاصله پاراگراف ارائه میدهد. این متدها بهصورت زیر استفاده میشوند:
- برای مشخص کردن فاصله خط بهعنوان درصدی از ارتفاع خط، مقدار مثبت استفاده کنید.
- برای مشخص کردن فاصله خط بهصورت پوینت، مقدار منفی استفاده کنید.
مثال زیر فاصله داخلی اولین پاراگراف را به 200٪ از ارتفاع خط (فاصله دو برابر) تنظیم میکند:
#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IParagraphFormat.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
auto presentation = System::MakeObject<Presentation>(u"sample.pptx");
auto firstShape = presentation->get_Slide(0)->get_Shape(0);
auto autoShape = System::ExplicitCast<IAutoShape>(firstShape);
auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0);
paragraph->get_ParagraphFormat()->set_SpaceWithin(200.0f);
presentation->Save(u"line_spacing.pptx", SaveFormat::Pptx);
presentation->Dispose();
نتیجه:

کنترل شکست خط
قوانین شکست خط پاراگراف در بلوکهای متنی باریک و ارائههایی که متن لاتین و شرق آسیایی را ترکیب میکنند، مفید هستند. متدهای زیر متعلق به IParagraphFormat هستند، بنابراین بر تمام پاراگراف اعمال میشوند:
- IParagraphFormat::set_LatinLineBreak قوانین شکست خط لاتین را کنترل میکند. در متن ترکیبی، تغییر آن میتواند محل شکست متن و نشانهگذاری شرق آسیایی همسایه را نیز تغییر دهد.
- IParagraphFormat::set_EastAsianLineBreak قوانین شکست خط شرق آسیایی را کنترل میکند، از جمله محدودیتهای کاراکترها در ابتدا و انتهای خط.
این قوانین جایگزین ITextFrameFormat::set_WrapText نمیشوند، که wrapping خودکار را درون یک فریم متن فعال میکند. آنها هنگام wrapping بر چیدمان تأثیر میگذارند؛ کاراکترهای شکست خط را وارد نمیکنند. یک شکست خط صریح یک خط جدید را درون پاراگراف ایجاد میکند، صرفنظر از عرض موجود.
مثال زیر بهصورت خودکفا یک بلوک متن باریک شامل متنهای چینایی و لاتین ایجاد میکند. هر دو قانون شکست خط بهصورت صریح تنظیم میشوند و «line_breaking.pptx» ذخیره میشود. برای آزمایش هر قانون، مقدار پاسشده به setter آن را تغییر دهید و تنظیمات دیگر را ثابت نگه دارید. مثال از Arial 24 پوینت و SimSun با عرض فریم 160 پوینت و حاشیههای افقی فریم متن صفر استفاده میکند. ITextFrameFormat::set_AutofitType با TextAutofitType::None فراخوانی میشود تا اندازه متن و ابعاد فریم ثابت بمانند.
#include <DOM/Fonts/FontData.h>
#include <DOM/IAutoShape.h>
#include <DOM/IColorFormat.h>
#include <DOM/IFillFormat.h>
#include <DOM/IParagraph.h>
#include <DOM/IParagraphFormat.h>
#include <DOM/IPortionFormat.h>
#include <DOM/IShapeCollection.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/ITextFrameFormat.h>
#include <DOM/FillType.h>
#include <DOM/NullableBool.h>
#include <DOM/Presentation.h>
#include <DOM/ShapeType.h>
#include <DOM/TextAlignment.h>
#include <DOM/TextAutofitType.h>
#include <Export/SaveFormat.h>
#include <drawing/color.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
auto presentation = System::MakeObject<Presentation>();
auto slide = presentation->get_Slide(0);
auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50.0f, 50.0f, 160.0f, 300.0f);
shape->get_FillFormat()->set_FillType(FillType::NoFill);
auto textFrame = shape->get_TextFrame();
textFrame->get_TextFrameFormat()->set_WrapText(NullableBool::True);
textFrame->get_TextFrameFormat()->set_AutofitType(TextAutofitType::None);
textFrame->get_TextFrameFormat()->set_MarginLeft(0);
textFrame->get_TextFrameFormat()->set_MarginRight(0);
auto paragraph = textFrame->get_Paragraph(0);
paragraph->set_Text(u"中文排版测试,PowerPoint 中文演示。");
auto format = paragraph->get_ParagraphFormat();
format->set_Alignment(TextAlignment::Left);
auto portionFormat = format->get_DefaultPortionFormat();
portionFormat->set_FontHeight(24.0f);
auto latinFont = System::MakeObject<FontData>(u"Arial");
portionFormat->set_LatinFont(latinFont);
auto eastAsianFont = System::MakeObject<FontData>(u"SimSun");
portionFormat->set_EastAsianFont(eastAsianFont);
portionFormat->get_FillFormat()->set_FillType(FillType::Solid);
portionFormat->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Black());
format->set_LatinLineBreak(NullableBool::False);
format->set_EastAsianLineBreak(NullableBool::True);
presentation->Save(u"line_breaking.pptx", SaveFormat::Pptx);
presentation->Dispose();
کنترل نقطهگذاری معلق
IParagraphFormat::set_HangingPunctuation اجازه میدهد نقطهگذاری واجد شرایط از حاشیه راست خط متنی فراتر رود بهجای اینکه در خط بعدی قرار گیرد. این تنظیم برای تمام پاراگراف اعمال میشود و متفاوت از تورفتگی معلق است.
مثال زیر بهصورت خودکفا نقطهگذاری معلق را در فریم متنی 100 پوینت عرضی فعال میکند و «hanging_punctuation.pptx» را ذخیره میکند. با Arial 24 پوینت و حاشیههای افقی فریم متن صفر، نقطه نهایی پس از «جمله» میماند و از حاشیه راست متن خارج میشود. برای مقایسه، مقدار NullableBool::False به setter پاس داده میشود: با این تنظیمات، نقطه در خط جداگانهای قرار میگیرد. wrapping فعال است و autofit غیرفعال برای ثابت نگه داشتن عرض موجود.
#include <DOM/Fonts/FontData.h>
#include <DOM/IAutoShape.h>
#include <DOM/IColorFormat.h>
#include <DOM/IFillFormat.h>
#include <DOM/IParagraph.h>
#include <DOM/IParagraphFormat.h>
#include <DOM/IPortionFormat.h>
#include <DOM/IShapeCollection.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/ITextFrameFormat.h>
#include <DOM/FillType.h>
#include <DOM/NullableBool.h>
#include <DOM/Presentation.h>
#include <DOM/ShapeType.h>
#include <DOM/TextAlignment.h>
#include <DOM/TextAutofitType.h>
#include <Export/SaveFormat.h>
#include <drawing/color.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
auto presentation = System::MakeObject<Presentation>();
auto slide = presentation->get_Slide(0);
auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50.0f, 50.0f, 100.0f, 200.0f);
shape->get_FillFormat()->set_FillType(FillType::NoFill);
auto textFrame = shape->get_TextFrame();
textFrame->get_TextFrameFormat()->set_WrapText(NullableBool::True);
textFrame->get_TextFrameFormat()->set_AutofitType(TextAutofitType::None);
textFrame->get_TextFrameFormat()->set_MarginLeft(0);
textFrame->get_TextFrameFormat()->set_MarginRight(0);
auto paragraph = textFrame->get_Paragraph(0);
paragraph->set_Text(u"Simple text, next sentence.");
auto format = paragraph->get_ParagraphFormat();
format->set_Alignment(TextAlignment::Left);
auto portionFormat = format->get_DefaultPortionFormat();
portionFormat->set_FontHeight(24.0f);
auto latinFont = System::MakeObject<FontData>(u"Arial");
portionFormat->set_LatinFont(latinFont);
portionFormat->get_FillFormat()->set_FillType(FillType::Solid);
portionFormat->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Black());
format->set_HangingPunctuation(NullableBool::True);
presentation->Save(u"hanging_punctuation.pptx", SaveFormat::Pptx);
presentation->Dispose();
هر نقطهگذاریای نمیتواند معلق شود. شرایط قلم و چیدمان شرح دادهشده در بخش کنترل شکست خط نیز برای این مقایسه اعمال میشود: تغییر قلم، عرض موجود، حاشیهها یا تنظیمات autofit میتواند تفاوت قابل مشاهده را از بین ببرد.
تنظیم نوع Autofit برای فریمهای متن
ITextFrameFormat::set_AutofitType تعیین میکند متن زمانی که از مرزهای کانتینر خود فراتر رود چگونه رفتار کند. از آن برای کنترل اینکه متن کوچک شود، سرریز شود یا بهصورت خودکار شکل را تغییر اندازه دهد استفاده کنید. مثال زیر شکل را برای تطبیق با متن تغییر اندازه میدهد و نتیجه را در «autofit_type.pptx» ذخیره میکند.
#include <DOM/IAutoShape.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/ITextFrameFormat.h>
#include <DOM/Presentation.h>
#include <DOM/TextAutofitType.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
auto presentation = System::MakeObject<Presentation>(u"sample.pptx");
auto firstShape = presentation->get_Slide(0)->get_Shape(0);
auto autoShape = System::ExplicitCast<IAutoShape>(firstShape);
autoShape->get_TextFrame()->get_TextFrameFormat()->set_AutofitType(TextAutofitType::Shape);
presentation->Save(u"autofit_type.pptx", SaveFormat::Pptx);
presentation->Dispose();
برای شمارش خطوط پس از wrapping خودکار و مشاهده چگونگی تغییر عرض متن یا شکل، به Count Rendered Lines مراجعه کنید. تنها شمارش خطوط نشاندهنده سرریز متن از کانتینر نیست.
تنظیم نقطهٔ لنگر فریمهای متن
ITextFrameFormat::set_AnchoringType تعیین میکند متن بهصورت عمودی داخل شکل در کجا قرار گیرد، برای مثال در بالا، وسط یا پایین. مثال زیر متن را به پایین اولین شکل لنگر میدهد و نتیجه را در «text_anchor.pptx» ذخیره میکند.
#include <DOM/IAutoShape.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/ITextFrameFormat.h>
#include <DOM/Presentation.h>
#include <DOM/TextAnchorType.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
auto presentation = System::MakeObject<Presentation>(u"sample.pptx");
auto firstShape = presentation->get_Slide(0)->get_Shape(0);
auto autoShape = System::ExplicitCast<IAutoShape>(firstShape);
autoShape->get_TextFrame()->get_TextFrameFormat()->set_AnchoringType(TextAnchorType::Bottom);
presentation->Save(u"text_anchor.pptx", SaveFormat::Pptx);
presentation->Dispose();
تنظیم تب متن
از IParagraphFormat::set_DefaultTabSize و IParagraphFormat::get_Tabs برای پیکربندی توقفگاههای تب در یک پاراگراف استفاده کنید. مثال زیر فاصله تب پیشفرض را به 100 پوینت تنظیم میکند و یک توقفگاه تب چپتراز در 30 پوینت اضافه میکند. این تنظیمات بر متنی که حاوی کاراکتر تب است تأثیر میگذارد.
#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IParagraphFormat.h>
#include <DOM/ISlide.h>
#include <DOM/ITabCollection.h>
#include <DOM/ITextFrame.h>
#include <DOM/Presentation.h>
#include <DOM/TabAlignment.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
auto presentation = System::MakeObject<Presentation>(u"sample.pptx");
auto firstShape = presentation->get_Slide(0)->get_Shape(0);
auto autoShape = System::ExplicitCast<IAutoShape>(firstShape);
auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0);
paragraph->get_ParagraphFormat()->set_DefaultTabSize(100.0f);
paragraph->get_ParagraphFormat()->get_Tabs()->Add(30.0f, TabAlignment::Left);
presentation->Save(u"paragraph_tabs.pptx", SaveFormat::Pptx);
presentation->Dispose();
نتیجه:

تنظیم زبان تصحیح
Aspose.Slides متد IBasePortionFormat::set_LanguageId را فراهم میکند که به شما امکان میدهد زبان تصحیح یک بخش متنی را تنظیم کنید. زبان تصحیح تعیین میکند کدام زبان برای بررسی املائی و گرامری در PowerPoint استفاده شود.
مثال زیر به «presentation.pptx» (جعبه متن بهعنوان اولین شکل در اسلاید اول) نیاز دارد و حداقل یک پاراگراف دارد. محتویات اولین پاراگراف را با «1۔» جایگزین میکند، SimSun را بهعنوان قلم آن تنظیم میکند و زبان تصحیح چینی ساده (zh-CN) را اختصاص میدهد. نتیجه در «proofing_language.pptx» ذخیره میشود:
#include <DOM/Fonts/FontData.h>
#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IPortionCollection.h>
#include <DOM/IPortionFormat.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/Portion.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
auto presentation = System::MakeObject<Presentation>(u"presentation.pptx");
auto firstShape = presentation->get_Slide(0)->get_Shape(0);
auto autoShape = System::ExplicitCast<IAutoShape>(firstShape);
auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0);
paragraph->get_Portions()->Clear();
auto font = System::MakeObject<FontData>(u"SimSun");
auto textPortion = System::MakeObject<Portion>();
auto portionFormat = textPortion->get_PortionFormat();
portionFormat->set_ComplexScriptFont(font);
portionFormat->set_EastAsianFont(font);
portionFormat->set_LatinFont(font);
// تنظیم زبان تصحیح به چینی ساده.
portionFormat->set_LanguageId(u"zh-CN");
textPortion->set_Text(u"1。");
paragraph->get_Portions()->Add(textPortion);
presentation->Save(u"proofing_language.pptx", SaveFormat::Pptx);
presentation->Dispose();
تنظیم زبان پیشفرض
از LoadOptions::set_DefaultTextLanguage برای تعریف زبان پیشفرض متنی که در حین بارگذاری یا ایجاد یک ارائه ایجاد میشود استفاده کنید. مثال زیر یک ارائه با زبان پیشفرض متن انگلیسی آمریکایی ایجاد میکند، یک جعبه متن اضافه میکند و برای اولین بخش متن آن en-US را چاپ میکند.
#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IPortion.h>
#include <DOM/IPortionFormat.h>
#include <DOM/IShapeCollection.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/LoadOptions.h>
#include <DOM/Presentation.h>
#include <DOM/ShapeType.h>
#include <system/console.h>
using namespace Aspose::Slides;
auto loadOptions = System::MakeObject<LoadOptions>();
loadOptions->set_DefaultTextLanguage(u"en-US");
auto presentation = System::MakeObject<Presentation>(loadOptions);
auto slide = presentation->get_Slide(0);
// افزودن یک شکل مستطیل جدید با متن.
auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20.0f, 20.0f, 150.0f, 50.0f);
shape->get_TextFrame()->set_Text(u"Sample text");
// بررسی زبان اولین بخش متن.
auto portion = shape->get_TextFrame()->get_Paragraph(0)->get_Portion(0);
auto languageId = portion->get_PortionFormat()->get_LanguageId();
System::Console::WriteLine(languageId);
presentation->Dispose();
تنظیم سبک پیشفرض متن
برای اعمال قالببندی پیشفرض متن در سطح ارائه، از IPresentation::get_DefaultTextStyle استفاده کنید.
مثال زیر قلم بولد 14 پوینت را بهعنوان پیشفرض برای پاراگرافهای سطح بالایی در یک ارائه جدید تنظیم میکند و آن را در «default_text_style.pptx» ذخیره میکند. متن میتواند این پیشفرضها را بهارث ببرد مگر اینکه قالببندی خاصتری آنها را لغو کند.
#include <DOM/IParagraphFormat.h>
#include <DOM/IPortionFormat.h>
#include <DOM/ITextStyle.h>
#include <DOM/NullableBool.h>
#include <DOM/Presentation.h>
#include <Export/SaveFormat.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
auto presentation = System::MakeObject<Presentation>();
// دریافت قالب پاراگراف سطح بالایی.
auto paragraphFormat = presentation->get_DefaultTextStyle()->GetLevel(0);
if (paragraphFormat != nullptr)
{
auto defaultPortionFormat = paragraphFormat->get_DefaultPortionFormat();
defaultPortionFormat->set_FontHeight(14.0f);
defaultPortionFormat->set_FontBold(NullableBool::True);
}
presentation->Save(u"default_text_style.pptx", SaveFormat::Pptx);
presentation->Dispose();
استخراج متن با اثر تمام حروف بزرگ
در PowerPoint، اعمال اثر All Caps به قلم باعث میشود متن روی اسلاید بهصورت حروف بزرگ نشان داده شود حتی اگر ابتدا با حروف کوچک وارد شده باشد. وقتی چنین بخش متنی را با Aspose.Slides بازیابی میکنید، کتابخانه متن را دقیقاً همانطور که وارد شده است برمیگرداند. برای مطابقت با متن نمایش دادهشده، TextCapType را بررسی کنید و رشتهٔ برگرداندهشده را به حروف بزرگ تبدیل کنید وقتی مقدار آن TextCapType::All باشد.
این مثال به «sample2.pptx» (جعبه متن بهعنوان اولین شکل در اسلایд اول) نیاز دارد. اولین پاراگراف آن اولین بخش «Hello, Aspose!» را با اثر All Caps دارد، همانطور که در زیر نشان داده شده است.

کد مثال زیر نشان میدهد چگونه متن را با اثر تمام حروف بزرگ استخراج کنید:
#include <DOM/IAutoShape.h>
#include <DOM/IParagraph.h>
#include <DOM/IPortion.h>
#include <DOM/IPortionFormat.h>
#include <DOM/IPortionFormatEffectiveData.h>
#include <DOM/ISlide.h>
#include <DOM/ITextFrame.h>
#include <DOM/Presentation.h>
#include <DOM/TextCapType.h>
#include <system/console.h>
using namespace Aspose::Slides;
auto presentation = System::MakeObject<Presentation>(u"sample2.pptx");
auto firstShape = presentation->get_Slide(0)->get_Shape(0);
auto autoShape = System::ExplicitCast<IAutoShape>(firstShape);
auto textPortion = autoShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0);
auto originalText = textPortion->get_Text();
System::Console::WriteLine(u"Original text: " + originalText);
auto textFormat = textPortion->get_PortionFormat()->GetEffective();
if (textFormat->get_TextCapType() == TextCapType::All)
{
auto uppercaseText = originalText.ToUpper();
System::Console::WriteLine(u"All-Caps effect: " + uppercaseText);
}
presentation->Dispose();
خروجی:
Original text: Hello, Aspose!
All-Caps effect: HELLO, ASPOSE!
سوالات متداول
چگونه متن را در یک جدول روی اسلاید اصلاح کنم؟
برای اصلاح متن در جدول روی اسلاید، از ITable استفاده کنید. سلولها را پیمایش کنید و هر سلول را از طریق ICell::get_TextFrame و قالببندی پاراگراف از طریق IParagraph::get_ParagraphFormat بهروزرسانی کنید.
چگونه رنگ گرادیان به متن در اسلاید PowerPoint اعمال کنم؟
برای اعمال رنگ گرادیان به متن، از IBasePortionFormat::get_FillFormat استفاده کنید. IFillFormat::set_FillType را بر روی FillType::Gradient تنظیم کنید و توقفگاههای گرادیان، جهت و شفافیت را پیکربندی کنید.