/// <summary> /// Unprotect document from changes. /// </summary> /// <param name="name">Document name.</param> /// <param name="folder">Document folder.</param> /// <param name="storage">The document storage.</param> public void UnprotectDocumentFromChanges(string name, string folder, ProtectDocumentRequest password, string storage = "") { // DELETE cells/{name}/writeProtection?appSid={appSid}&storage={storage}&folder={folder} string apiUrl = string.Format(@"cells/{0}/writeProtection?storage={1}&folder={2}", name, storage, folder); ServiceController.Delete(apiUrl, AppSid, AppKey, JsonConvert.SerializeObject(password)); }
public void Cells_Workbook_Tests() { try { storageService.File.CopyFile(Utils.CloudStorage_Input_Folder + "/cells-sample.xlsx", Utils.CloudStorage_Output_Folder + "/cells-sample.xlsx"); WorkbookResponse WorkbookResponse = cellsService.Workbook.ReadWorkbookInfo(name, string.Empty, true, Utils.CloudStorage_Output_Folder); cellsService.Workbook.ExportWorkbook(name, WorkbookExportFormat.Pdf, string.Empty, false, Utils.CloudStorage_Output_Folder, Utils.Local_Output_Path + "cells-workbook-pdf.pdf"); cellsService.Workbook.ExportWorkbook(name, WorkbookExportFormat.Pdf, string.Empty, false, Utils.CloudStorage_Output_Folder, Utils.CloudStorage_Output_Folder + "/cells-workbook-pdf.pdf"); //To test //WorkbookResponse WorkbookResponse2 = cellsService.Workbook.CreateNewWorkbookUsingDeferentMethods(name, "templateFile", "dataFile", Utils.CloudStorage_Output_Folder); cellsService.Workbook.ConvertWorkbookToSomeFormat(WorkbookExportFormat.Pdf, string.Empty, Utils.CloudStorage_Output_Folder + "/cells-workbook-pdf2.pdf", Utils.Local_Input_Path + name); WorkbookEncryptionRequest workbookEncryptionRequest = new WorkbookEncryptionRequest(WorkbookEncryptionType.XOR, 128, "Aspose"); cellsService.Workbook.EncriptDocument(name, Utils.CloudStorage_Output_Folder, workbookEncryptionRequest); cellsService.Workbook.DecryptDocument(name, Utils.CloudStorage_Output_Folder, workbookEncryptionRequest); WorkbookStyleResponse WorkbookStyleResponse = cellsService.Workbook.ReadWorkbookDefaultStyleInfo(name, Utils.CloudStorage_Output_Folder); WorkbookTextItemsResponse WorkbookTextItemsResponse = cellsService.Workbook.ReadWorkbooksTextItems(name, Utils.CloudStorage_Output_Folder); WorkbookNamesResponse WorkbookNamesResponse = cellsService.Workbook.ReadWorkbooksNames(name, Utils.CloudStorage_Output_Folder); WorkbookNameResponse WorkbookNameResponse = cellsService.Workbook.ReadWorkbooksName(name, "TestName", Utils.CloudStorage_Output_Folder); ProtectDocumentRequest protectDocumentRequest = new ProtectDocumentRequest(); protectDocumentRequest.Password = "******"; cellsService.Workbook.ProtectDocumentFromChanges(name, Utils.CloudStorage_Output_Folder, protectDocumentRequest); cellsService.Workbook.UnprotectDocumentFromChanges(name, Utils.CloudStorage_Output_Folder, protectDocumentRequest); storageService.File.CopyFile(Utils.CloudStorage_Input_Folder + "/cells-sample.xlsx", Utils.CloudStorage_Output_Folder + "/cells-sample2.xlsx"); WorkbookResponse WorkbookResponse4 = cellsService.Workbook.MergeWorkbooks(name, Utils.CloudStorage_Output_Folder + "/cells-sample2.xlsx", Utils.CloudStorage_Output_Folder); CellsTextItemsResponse CellsTextItemsResponse = cellsService.Workbook.SearchText(name, "Student1", Utils.CloudStorage_Output_Folder); WorkbookReplaceTextResponse WorkbookReplaceTextResponse = cellsService.Workbook.ReplaceText(name, "Student", "Employee", Utils.CloudStorage_Output_Folder); //To test //WorkbookResponse WorkbookResponse5 = cellsService.Workbook.SmartMarkerProcessingResult(name, "xmlFile", Utils.CloudStorage_Output_Folder, "outPath"); WorkbookSplitResponse WorkbookSplitResponse = cellsService.Workbook.SplitWorkbook(name, CellsSplitFormat.Gif, 1, 2, 0, 0, Utils.CloudStorage_Output_Folder); //To test //cellsService.Workbook.ImportDataToWorkbook(name, Utils.CloudStorage_Output_Folder, WorkbookImportOption); cellsService.Workbook.CalculateAllFormulasInWorkbook(name, Utils.CloudStorage_Output_Folder); CellsAutoFitterOptionsRequest autoFitterOptions = new CellsAutoFitterOptionsRequest(); autoFitterOptions.AutoFitMergedCells = true; autoFitterOptions.IgnoreHidden = true; autoFitterOptions.OnlyAuto = false; cellsService.Workbook.AutofitWorkbookRows(name, 1, 50, false, autoFitterOptions, Utils.CloudStorage_Output_Folder); //storageService.File.DownloadFile(Utils.CloudStorage_Output_Folder + "/cells-sample.xlsx", Utils.Local_Output_Path + "/cells-sample.xlsx"); } catch (Exception ex) { Assert.Fail(ex.Message); } }