Aspose::Words::Drawing::OleFormat::get_SuggestedFileName method
Contents
[
Hide
]OleFormat::get_SuggestedFileName method
Gets the file name suggested for the current embedded object if you want to save it into a file.
System::String Aspose::Words::Drawing::OleFormat::get_SuggestedFileName()
Examples
Shows how to get an OLE object’s suggested file name.
auto doc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"OLE shape.rtf");
auto oleShape = System::ExplicitCast<Aspose::Words::Drawing::Shape>(doc->get_FirstSection()->get_Body()->GetChild(Aspose::Words::NodeType::Shape, 0, true));
// OLE objects can provide a suggested filename and extension,
// which we can use when saving the object's contents into a file in the local file system.
System::String suggestedFileName = oleShape->get_OleFormat()->get_SuggestedFileName();
ASSERT_EQ(u"CSV.csv", suggestedFileName);
{
auto fileStream = System::MakeObject<System::IO::FileStream>(get_ArtifactsDir() + suggestedFileName, System::IO::FileMode::Create);
oleShape->get_OleFormat()->Save(fileStream);
}
See Also
- Class OleFormat
- Namespace Aspose::Words::Drawing
- Library Aspose.Words for C++