public static void Run() { string outputFolder = Constants.GetOutputDirectoryPath(); string outputFile = Path.Combine(outputFolder, "pptx-converted-to.docx"); // Load the source PPTX file using (var converter = new GroupDocs.Conversion.Converter(Constants.SAMPLE_PPTX)) { var options = new WordProcessingConvertOptions(); // Save converted DOCX file converter.Convert(outputFile, options); } Console.WriteLine("\nConversion to docx completed successfully. \nCheck output in {0}", outputFolder); }
public static void Run() { string outputFolder = Constants.GetOutputDirectoryPath(); string outputFile = Path.Combine(outputFolder, "plt-converted-to.txt"); // Load the source PLT file using (var converter = new GroupDocs.Conversion.Converter(Constants.SAMPLE_PLT)) { WordProcessingConvertOptions options = new WordProcessingConvertOptions { Format = GroupDocs.Conversion.FileTypes.WordProcessingFileType.Txt }; // Save converted TXT file converter.Convert(outputFile, options); } Console.WriteLine("\nConversion to txt completed successfully. \nCheck output in {0}", outputFolder); }
public static void Run() { string outputFolder = Constants.GetOutputDirectoryPath(); string outputFile = Path.Combine(outputFolder, "converted.docx"); Func <LoadOptions> getLoadOptions = () => new PdfLoadOptions { FlattenAllFields = true }; using (Converter converter = new Converter(Constants.SAMPLE_PDF, getLoadOptions)) { WordProcessingConvertOptions options = new WordProcessingConvertOptions(); converter.Convert(outputFile, options); } Console.WriteLine("\nPdf document converted successfully. \nCheck output in {0}", outputFolder); }
public static void Run() { string outputFolder = Constants.GetOutputDirectoryPath(); string outputFile = Path.Combine(outputFolder, "converted.docx"); Func <LoadOptions> getLoadOptions = () => new MarkupLoadOptions { PageNumbering = true }; using (Converter converter = new Converter(Constants.SAMPLE_MARKUP, getLoadOptions)) { WordProcessingConvertOptions options = new WordProcessingConvertOptions(); converter.Convert(outputFile, options); } Console.WriteLine("\nEmail document converted successfully. \nCheck output in {0}", outputFolder); }
public static void Run() { string outputFolder = Constants.GetOutputDirectoryPath(); string outputFile = Path.Combine(outputFolder, "converted.odt"); using (Converter converter = new Converter(Constants.SAMPLE_PDF)) { WordProcessingConvertOptions options = new WordProcessingConvertOptions { PageNumber = 2, PagesCount = 1, Format = WordProcessingFileType.Odt, }; converter.Convert(outputFile, options); } Console.WriteLine("\nDocument converted successfully. \nCheck output in {0}", outputFolder); }
public static void Run() { string outputFolder = Constants.GetOutputDirectoryPath(); string outputFile = Path.Combine(outputFolder, "pst-converted-{0}-to.docx"); // Load the source PST file using (var converter = new GroupDocs.Conversion.Converter(Constants.SAMPLE_PST, fileType => fileType == PersonalStorageFileType.Pst ? new PersonalStorageLoadOptions() : null)) { var options = new WordProcessingConvertOptions(); var counter = 1; // Save converted DOCX file converter.Convert( (FileType fileType) => new FileStream(string.Format(outputFile, counter++), FileMode.Create), options ); } Console.WriteLine("\nConversion to docx 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, "mbox-converted-{0}-to.doc"); // Load the source MBOX file using (var converter = new GroupDocs.Conversion.Converter(Constants.SAMPLE_MBOX, fileType => fileType == EmailFileType.Mbox ? new MboxLoadOptions() : null)) { WordProcessingConvertOptions options = new WordProcessingConvertOptions { Format = GroupDocs.Conversion.FileTypes.WordProcessingFileType.Doc }; var counter = 1; // Save converted DOC file converter.Convert( (FileType fileType) => new FileStream(string.Format(outputFile, counter++), FileMode.Create), options ); } Console.WriteLine("\nConversion to doc completed successfully. \nCheck output in {0}", outputFolder); }
public static void Run() { string outputFolder = Constants.GetOutputDirectoryPath(); string outputFile = Path.Combine(outputFolder, "converted.docx"); #if NETCOREAPP Func <LoadOptions> getLoadOptions = () => new PdfLoadOptions { RemoveEmbeddedFiles = true }; #else Contracts.Func <LoadOptions> getLoadOptions = () => new PdfLoadOptions { RemoveEmbeddedFiles = true }; #endif using (Converter converter = new Converter(Constants.SAMPLE_PDF, getLoadOptions)) { WordProcessingConvertOptions options = new WordProcessingConvertOptions(); converter.Convert(outputFile, options); } Console.WriteLine("\nPdf document converted successfully. \nCheck output in {0}", outputFolder); }