図形またはテキストボックスの文字効果の shadow を設定するC++
Contents
[
Hide
]
任意の図形やテキストボックスのテキスト効果のShadowを設定できます。Shape.GetTextBody()プロパティを使用してください。このプロパティは図形のテキスト設定を示し、FontSettingオブジェクトを返します。アクセス後、FontSetting.GetPresetType()プロパティを介してShadowを設定してください。このプロパティはPresetShadowType型で、いくつかの値を持ちます。例として:
- DiagonalBottomRightのOffset
- ボトムのオフセット
- DiagonalTopRightのOffset
- 左内部
- 中央内部
- PerspectiveDiagonalUpperLeft
- PerspectiveDiagonalLowerRight
以下のコードスニペットは、FontSetting.GetPresetType() プロパティを使用してShapeまたはTextBoxのテキスト効果のシャドウを設定する例です。
#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
using namespace Aspose::Cells::Drawing;
int main()
{
Aspose::Cells::Startup();
// Output directory
U16String outDir(u"..\\Data\\02_OutputDirectory\\");
// Create workbook object
Workbook wb;
// Access first worksheet
Worksheet ws = wb.GetWorksheets().Get(0);
// Add text box with these dimensions
TextBox tb = ws.GetShapes().AddTextBox(2, 0, 2, 0, 100, 400);
// Set the text of the textbox
tb.SetText(u"This text has the following settings.\n\nText Effects > Shadow > Offset Bottom");
// Set all the text runs shadow to preset offset bottom
for (int i = 0; i < tb.GetTextBody().GetCount(); i++)
{
tb.GetTextBody().Get(i).GetTextOptions().GetShadow().SetPresetType(PresetShadowType::OffsetBottom);
}
// Set the font color and size of the textbox
tb.GetFont().SetColor(Color::Red());
tb.GetFont().SetSize(16);
// Save the output file
wb.Save(outDir + u"outputSettingTextEffectsShadowOfShapeOrTextbox.xlsx", SaveFormat::Xlsx);
std::cout << "Text effects shadow of shape or textbox set successfully!" << std::endl;
Aspose::Cells::Cleanup();
}