Пример #1
0
        public static void Run()
        {
            var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
            var apiInstance   = new DocumentApi(configuration);

            try
            {
                var fileInfo = new FileInfo
                {
                    FilePath = "WordProcessing/sample-10-pages.docx"
                };

                var options = new SplitOptions
                {
                    FileInfo        = fileInfo,
                    OutputPath      = "Output/split-by-start-end-numbers",
                    StartPageNumber = 3,
                    EndPageNumber   = 7,
                    Mode            = SplitOptions.ModeEnum.Pages
                };

                var request  = new SplitRequest(options);
                var response = apiInstance.Split(request);

                foreach (var document in response.Documents)
                {
                    Console.WriteLine("Output file path: " + document.Path);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling api: " + e.Message);
            }
        }
Пример #2
0
        public static void Run()
        {
            var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
            var apiInstance   = new DocumentApi(configuration);

            try
            {
                var fileInfo = new FileInfo
                {
                    FilePath = "WordProcessing/sample-10-pages.docx"
                };

                var options = new SplitOptions
                {
                    FileInfo   = fileInfo,
                    OutputPath = "Output/split-to-multipage-document",
                    Pages      = new List <int?> {
                        3, 6, 8
                    },
                    Mode = SplitOptions.ModeEnum.Intervals
                };

                var request  = new SplitRequest(options);
                var response = apiInstance.Split(request);

                foreach (var document in response.Documents)
                {
                    Console.WriteLine("Output file path: " + document.Path);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while calling api: " + e.Message);
            }
        }