public static void Run() { string outputFolder = Constants.GetOutputDirectoryPath(); string outputFile = Path.Combine(outputFolder, "converted.ppt"); #if NETCOREAPP Func <LoadOptions> getLoadOptions = () => new WordProcessingLoadOptions { Password = "******" }; #else Contracts.Func <LoadOptions> getLoadOptions = () => new WordProcessingLoadOptions { Password = "******" }; #endif using (Converter converter = new Converter(Constants.SAMPLE_DOCX_WITH_PASSWORD, getLoadOptions)) { PresentationConvertOptions options = new PresentationConvertOptions { PageNumber = 2, PagesCount = 1, Format = PresentationFileType.Ppt }; converter.Convert(outputFile, options); } Console.WriteLine("\nPassword protected document converted successfully. \nCheck output in {0}", outputFolder); }
public static void Run() { string outputFolder = Constants.GetOutputDirectoryPath(); string outputFile = Path.Combine(outputFolder, "converted.pptx"); using (Converter converter = new Converter(Constants.SAMPLE_DOCX)) { PresentationConvertOptions options = new PresentationConvertOptions(); converter.Convert(outputFile, options); } Console.WriteLine("\nConversion to presentation completed successfully. \nCheck output in {0}", outputFolder); }
public static void Run() { string outputFolder = Constants.GetOutputDirectoryPath(); string outputFile = Path.Combine(outputFolder, "rtf-converted-to.pptx"); // Load the source RTF file using (var converter = new GroupDocs.Conversion.Converter(Constants.SAMPLE_RTF)) { var options = new PresentationConvertOptions(); // Save converted PPTX file converter.Convert(outputFile, options); } Console.WriteLine("\nConversion to pptx completed successfully. \nCheck output in {0}", outputFolder); }
public static void Run() { string outputFolder = Constants.GetOutputDirectoryPath(); string outputFile = Path.Combine(outputFolder, "otg-converted-to.ppt"); // Load the source OTG file using (var converter = new GroupDocs.Conversion.Converter(Constants.SAMPLE_OTG)) { PresentationConvertOptions options = new PresentationConvertOptions { Format = GroupDocs.Conversion.FileTypes.PresentationFileType.Ppt }; // Save converted PPT file converter.Convert(outputFile, options); } Console.WriteLine("\nConversion to ppt completed successfully. \nCheck output in {0}", outputFolder); }
public static void Run() { string outputFolder = Constants.GetOutputDirectoryPath(); string outputFile = Path.Combine(outputFolder, "mbox-converted-{0}-to.pptx"); // Load the source MBOX file using (var converter = new GroupDocs.Conversion.Converter(Constants.SAMPLE_MBOX, fileType => fileType == EmailFileType.Mbox ? new MboxLoadOptions() : null)) { var options = new PresentationConvertOptions(); var counter = 1; // Save converted PPTX file converter.Convert( (FileType fileType) => new FileStream(string.Format(outputFile, counter++), FileMode.Create), options ); } Console.WriteLine("\nConversion to pptx completed successfully. \nCheck output in {0}", outputFolder); }
private static ConvertOptions GetConvertOptions(string destDocumentType, string destinationType) { ConvertOptions convertOptions; switch (destDocumentType) { case "Portable Document Format": convertOptions = new PdfConvertOptions(); break; case "Microsoft Word": convertOptions = new WordProcessingConvertOptions(); break; case "Microsoft PowerPoint": convertOptions = new PresentationConvertOptions(); break; case "image": convertOptions = new ImageConvertOptions(); break; case "Comma-Separated Values": convertOptions = new SpreadsheetConvertOptions(); break; case "Microsoft Excel": convertOptions = new SpreadsheetConvertOptions(); break; default: convertOptions = new WordProcessingConvertOptions(); break; } convertOptions.Format = FileType.FromExtension(destinationType); return(convertOptions); }
public static void Run() { string outputFolder = Constants.GetOutputDirectoryPath(); string outputFile = Path.Combine(outputFolder, "ost-converted-{0}-to.ppt"); // Load the source OST file using (var converter = new GroupDocs.Conversion.Converter(Constants.SAMPLE_OST, fileType => fileType == PersonalStorageFileType.Ost ? new PersonalStorageLoadOptions() : null)) { PresentationConvertOptions options = new PresentationConvertOptions { Format = GroupDocs.Conversion.FileTypes.PresentationFileType.Ppt }; var counter = 1; // Save converted PPT file converter.Convert( (FileType fileType) => new FileStream(string.Format(outputFile, counter++), FileMode.Create), options ); } Console.WriteLine("\nConversion to ppt completed successfully. \nCheck output in {0}", outputFolder); }