Aspose::Words::FileFormatUtil::SaveFormatToLoadFormat method

FileFormatUtil::SaveFormatToLoadFormat method

Converts a SaveFormat value to a LoadFormat value if possible.

static Aspose::Words::LoadFormat Aspose::Words::FileFormatUtil::SaveFormatToLoadFormat(Aspose::Words::SaveFormat saveFormat)

Examples

Shows how to convert a save format to its corresponding load format.

ASSERT_EQ(FileFormatUtil::SaveFormatToLoadFormat(SaveFormat::Html), LoadFormat::Html);

// Some file types can have documents saved to, but not loaded from using Aspose.Words.
// If we attempt to convert a save format of such a type to a load format, an exception will be thrown.
ASSERT_THROW(System::Action<>(static_cast<std::function<void()>>([]() -> void
{
    FileFormatUtil::SaveFormatToLoadFormat(SaveFormat::Jpeg);
}))(), System::ArgumentException);

Exceptions

  • ArgumentException - Throws when cannot convert.

See Also