We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

如何获取项目边框的宽度

项目编号的宽度.zip (73.6 KB)
操作系统:windows 10
使用版本:aspose-slides-cpp-windows-22.8

void PrintText(System::String pptFilePath)
{
	System::SharedPtr<System::IO::FileStream> stream = System::MakeObject<System::IO::FileStream>(pptFilePath, System::IO::FileMode::Open, System::IO::FileAccess::Read, System::IO::FileShare::ReadWrite);
	System::SharedPtr<Aspose::Slides::Presentation> presentation = System::MakeObject<Aspose::Slides::Presentation>(stream);

	System::SharedPtr<IShapeCollection> shapes = presentation->get_Slides()->idx_get(0)->get_Shapes();
	for (int i = 0, n = shapes->get_Count(); i < n; i++)
	{
		System::SharedPtr<IShape> shape = shapes->idx_get(i);
		if (!System::ObjectExt::Is<IAutoShape>(shape))
		{
			continue;
		}
		auto autoShape = System::DynamicCast_noexcept<IAutoShape>(shape);

		System::SharedPtr<Aspose::Slides::ITextFrame> textFrame = autoShape->get_TextFrame();
		System::SharedPtr<Aspose::Slides::IParagraphCollection> paragraphCollection = textFrame->get_Paragraphs();
		for (int paragraphIndex = 0, paragraphCount = paragraphCollection->get_Count(); paragraphIndex < paragraphCount; paragraphIndex++)
		{
			System::SharedPtr<Aspose::Slides::IParagraph> paragraph = paragraphCollection->idx_get(paragraphIndex);
			System::SharedPtr<IParagraphFormat> paragraphFormat = paragraph->get_ParagraphFormat();
			System::SharedPtr<IBulletFormat> bullet = paragraphFormat->get_Bullet();
			// TODO:
		}
	}
}

这里的IBulletFormat对象,如何获取项目编号对应的符号占用的宽度值?IBulletFormat对象的相关接口找了一遍,似乎是没有发现有这个能力。PowerPoint上似乎也没发现可设置项目符号与编号的宽度值。

@101ppt,
谢谢你的问题。

您应该使用 IParagraphFormat::get_MarginLeftIParagraphFormat::get_Indent 方法来找出列表项(段落)的缩进值。

System::Console::WriteLine(paragraphFormat->get_MarginLeft());
System::Console::WriteLine(paragraphFormat->get_Indent());

有用的文件:Manage Paragraph