public void DetectFileFormat_SaveFormatToLoadFormat() { //ExStart //ExFor:FileFormatUtil.SaveFormatToLoadFormat(SaveFormat) //ExSummary:Shows how to convert a save format to its corresponding load format. Assert.AreEqual(LoadFormat.Html, FileFormatUtil.SaveFormatToLoadFormat(SaveFormat.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.Throws <ArgumentException>(() => FileFormatUtil.SaveFormatToLoadFormat(SaveFormat.Jpeg)); //ExEnd }
public void DetectFileFormat_SaveFormatToLoadFormat() { //ExStart //ExFor:FileFormatUtil.SaveFormatToLoadFormat(SaveFormat) //ExSummary:Shows how to use the FileFormatUtil class and to convert a SaveFormat enumeration into the corresponding LoadFormat enumeration. // Define the SaveFormat enumeration to convert. SaveFormat saveFormat = SaveFormat.Html; // Convert the SaveFormat enumeration to LoadFormat enumeration. LoadFormat loadFormat = FileFormatUtil.SaveFormatToLoadFormat(saveFormat); Console.WriteLine("The converted LoadFormat is: " + FileFormatUtil.LoadFormatToExtension(loadFormat)); //ExEnd Assert.AreEqual(".html", FileFormatUtil.SaveFormatToExtension(saveFormat)); Assert.AreEqual(".html", FileFormatUtil.LoadFormatToExtension(loadFormat)); }