Exemplo n.º 1
0
        public static void Run()
        {
            string outputFolder = Constants.GetOutputDirectoryPath();
            string outputFile   = Path.Combine(outputFolder, "converted.html");

#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))
            {
                MarkupConvertOptions options = new MarkupConvertOptions
                {
                    PageNumber             = 2,
                    FixedLayout            = true,
                    PagesCount             = 1,
                    FixedLayoutShowBorders = false
                };
                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.html");

            using (Converter converter = new Converter(Constants.SAMPLE_DOCX))
            {
                MarkupConvertOptions options = new MarkupConvertOptions();
                converter.Convert(outputFile, options);
            }

            Console.WriteLine("\nConversion to html completed successfully. \nCheck output in {0}", outputFolder);
        }
Exemplo n.º 3
0
        public static void Run()
        {
            string outputFolder = Constants.GetOutputDirectoryPath();
            string outputFile   = Path.Combine(outputFolder, "ppsm-converted-to.html");

            // Load the source PPSM file
            using (var converter = new GroupDocs.Conversion.Converter(Constants.SAMPLE_PPSM))
            {
                var options = new MarkupConvertOptions();
                // Save converted HTML file
                converter.Convert(outputFile, options);
            }

            Console.WriteLine("\nConversion to html completed successfully. \nCheck output in {0}", outputFolder);
        }
Exemplo n.º 4
0
        public static void Run()
        {
            string outputFolder = Constants.GetOutputDirectoryPath();
            string outputFile   = Path.Combine(outputFolder, "ost-converted-{0}-to.html");

            // Load the source OST file
            using (var converter = new GroupDocs.Conversion.Converter(Constants.SAMPLE_OST, fileType => fileType == PersonalStorageFileType.Ost
                                                                                                                ? new PersonalStorageLoadOptions()
                                                                                                                : null))
            {
                var options = new MarkupConvertOptions();
                var counter = 1;
                // Save converted HTML file
                converter.Convert(
                    (FileType fileType) => new FileStream(string.Format(outputFile, counter++), FileMode.Create),
                    options
                    );
            }

            Console.WriteLine("\nConversion to html completed successfully. \nCheck output in {0}", outputFolder);
        }