/// <summary>
 /// Initializes a new instance of the <see cref="PostPresentationMergeRequest"/> class.
 /// </summary>
 /// <param name="name">Original presentation name.</param>
 /// <param name="request">with a list of presentations to merge.</param>
 /// <param name="storage">The storage.</param>
 /// <param name="folder">The folder.</param>
 public PostPresentationMergeRequest(string name, PresentationsMergeRequest request = null, string storage = null, string folder = null)
 {
     this.Name    = name;
     this.Request = request;
     this.Storage = storage;
     this.Folder  = folder;
 }
Exemple #2
0
        public void MergeStorage()
        {
            TestUtils.Upload(c_fileName, c_folderName + "/" + c_fileName);
            TestUtils.Upload(c_fileName2, c_folderName + "/" + c_fileName2);
            TestUtils.Upload(c_pdfFileName, c_folderName + "/" + c_pdfFileName);
            PresentationsMergeRequest request = new PresentationsMergeRequest
            {
                PresentationPaths = new List <string> {
                    c_folderName + "/" + c_fileName2, c_folderName + "/" + c_pdfFileName
                }
            };
            Document result = TestUtils.SlidesApi.Merge(c_fileName, request, c_password, c_folderName);

            Assert.IsNotNull(result);
        }
        public static void Run()
        {
            // ExStart:1
            SlidesApi  slidesApi  = new SlidesApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH);
            StorageApi storageApi = new StorageApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH);

            String fileName = "sample.pptx";
            String storage  = "";
            String folder   = "";

            String mergeFile1 = "sample-input.pptx";
            String mergeFile2 = "demo.pptx";

            PresentationsMergeRequest body = new PresentationsMergeRequest();

            body.PresentationPaths = new System.Collections.Generic.List <string> {
                mergeFile1, mergeFile2
            };

            try
            {
                // Upload source file to aspose cloud storage
                storageApi.PutCreate(fileName, "", "", System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
                storageApi.PutCreate(mergeFile1, null, null, System.IO.File.ReadAllBytes(Common.GetDataDir() + mergeFile1));
                storageApi.PutCreate(mergeFile2, null, null, System.IO.File.ReadAllBytes(Common.GetDataDir() + mergeFile2));

                // Invoke Aspose.Slides Cloud SDK to merge PowerPoint presentations
                DocumentResponse apiResponse = slidesApi.PostPresentationMerge(fileName, storage, folder, body);

                if (apiResponse != null)
                {
                    // Download merged document from storage
                    Com.Aspose.Storage.Model.ResponseMessage storageRes = storageApi.GetDownload(fileName, null, null);
                    System.Diagnostics.Debug.WriteLine("response:" + storageRes.ResponseStream);
                    System.IO.File.WriteAllBytes(Common.GetDataDir() + fileName, storageRes.ResponseStream);
                    Console.WriteLine("Merge PowerPoint Presentations, Done!");
                    Console.ReadKey();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
            }
            // ExEnd:1
        }