Exemple #1
0
        public static void Run()
        {
            string inputfile    = "doc-sample-protect.doc";
            string subdirection = "Protection";

            // Upload input file from local directory to Cloud Storage
            Common.UploadFile(inputfile, subdirection);

            // Protect a Word Document
            WordsProtectionRequest wordsProtectionRequest = new WordsProtectionRequest("aspose", "aspose", ProtectionType.ReadOnly);

            Common.WordsService.WordsDocumentProtection.ProtectDocument(inputfile, Common.GetOutputFilePath(inputfile, true), wordsProtectionRequest, Common.FOLDER);

            // Download output file from cloud storage and save on local directory
            string dataDir = Common.DownloadFile(inputfile, subdirection);

            Console.WriteLine("\nRead only protection added.\nFile saved at " + dataDir);
        }
        public static void Run()
        {
            string inputfile    = "doc-sample-unprotect.doc";
            string subdirection = "Protection";

            // Upload input file from local directory to Cloud Storage
            Common.UploadFile(inputfile, subdirection);

            // Modify Protection of the Word Document
            WordsProtectionRequest wordsProtectionRequest2 = new WordsProtectionRequest("aspose", "aspose2", ProtectionType.ReadOnly);

            Common.WordsService.WordsDocumentProtection.ChangeDocumentProtection(inputfile, Common.GetOutputFilePath(inputfile, true), wordsProtectionRequest2, Common.FOLDER);

            // Download output file from cloud storage and save on local directory
            string dataDir = Common.DownloadFile(inputfile, subdirection);

            Console.WriteLine("\nDocument protection updated successfully.\nFile saved at " + dataDir);
        }
Exemple #3
0
        public static void Run()
        {
            string inputfile    = "doc-sample-unprotect.doc";
            string subdirection = "Protection";

            // Upload input file from local directory to Cloud Storage
            Common.UploadFile(inputfile, subdirection);

            // Unprotect a Word Document
            WordsProtectionRequest wordsProtectionRequest3 = new WordsProtectionRequest("aspose", string.Empty, ProtectionType.NoProtection);

            Common.WordsService.WordsDocumentProtection.UnprotectDocument(inputfile, Common.GetOutputFilePath(inputfile, true), wordsProtectionRequest3, Common.FOLDER);

            // Download output file from cloud storage and save on local directory
            string dataDir = Common.DownloadFile(inputfile, subdirection);

            Console.WriteLine("\nDocument unprotected successfully.\nFile saved at " + dataDir);
        }
Exemple #4
0
        public void Words_DocumentProtection_Tests()
        {
            try
            {
                storageService.File.CopyFile(Utils.CloudStorage_Input_Folder + "/doc-sample.doc", Utils.CloudStorage_Output_Folder + "/doc-sample.doc");

                WordsProtectionDataResponse wordsProtectionDataResponse = wordsService.WordsDocumentProtection.ReadDocumentProtectionCommonInfo("doc-sample.doc", Utils.CloudStorage_Output_Folder);

                WordsProtectionRequest wordsProtectionRequest = new WordsProtectionRequest("aspose", "aspose", ProtectionType.ReadOnly);
                wordsService.WordsDocumentProtection.ProtectDocument("doc-sample.doc", string.Empty, wordsProtectionRequest, Utils.CloudStorage_Output_Folder);

                WordsProtectionRequest wordsProtectionRequest2 = new WordsProtectionRequest("aspose", "aspose2", ProtectionType.ReadOnly);
                wordsService.WordsDocumentProtection.ChangeDocumentProtection("doc-sample.doc", string.Empty, wordsProtectionRequest2, Utils.CloudStorage_Output_Folder);

                WordsProtectionRequest wordsProtectionRequest3 = new WordsProtectionRequest("aspose2", string.Empty, ProtectionType.NoProtection);
                wordsService.WordsDocumentProtection.UnprotectDocument("doc-sample.doc", string.Empty, wordsProtectionRequest3, Utils.CloudStorage_Output_Folder);

                //storageService.File.DownloadFile(Utils.CloudStorage_Output_Folder + "/doc-sample.doc", Utils.Local_Output_Path + "/doc-sample.doc");
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }