public static void Run() { // ExStart:1 PdfApi pdfApi = new PdfApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH); StorageApi storageApi = new StorageApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH); String fileName = "Lenovo_Tablet_2_Datasheet.pdf"; String format = "html"; String storage = ""; String folder = ""; String outPath = "Lenovo_Tablet_2_Datasheet.zip"; try { // Upload source file to aspose cloud storage storageApi.PutCreate(fileName, "", "", System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName)); // Invoke Aspose.PDF Cloud SDK API to convert pdf to HTML ResponseMessage apiResponse = pdfApi.GetDocumentWithFormat(fileName, format, storage, folder, outPath); if (apiResponse != null) { // Download converted HTML file Com.Aspose.Storage.Model.ResponseMessage storageRes = storageApi.GetDownload(outPath, null, storage); // Save response stream to a file System.IO.File.WriteAllBytes(Common.GetDataDir() + outPath, storageRes.ResponseStream); Console.WriteLine("Convert PDF to HTML, Done!"); Console.ReadKey(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); } // ExEnd:1 }
public void Run() { // setup a file to upload string name = "testpage3_embcss.html"; // setup a local file system directory where is the source file string srcLocalDir = CommonSettings.LocalDataFolder; // setup a folder path where the file will be uploaded string folder = CommonSettings.StorageDataFolder; // setup storage name (your default storage if null) string storage = null; string suffix = "new"; var newName = $"{Path.GetFileNameWithoutExtension(name)}_{suffix}{Path.GetExtension(name)}"; var srcPath = Path.Combine(srcLocalDir, name); var dstPath = Path.Combine(folder, newName).Replace('\\', '/'); IStorageFileApi fApi = new StorageApi(CommonSettings.ClientId, CommonSettings.ClientSecret, CommonSettings.BasePath); IStorageApi stApi = (IStorageApi)fApi; CheckIfFolderExistsAndCreate(stApi, folder, storage); using (Stream fstr = File.Open(srcPath, FileMode.Open, FileAccess.Read)) { var response = fApi.UploadFile(fstr, dstPath, storage); if (response.Code == 200) { bool exists = stApi.FileOrFolderExists(dstPath); if (exists) { Console.WriteLine($"File uploaded by path: {dstPath}"); } else { Console.WriteLine($"Something went wrong: file not found by path {dstPath}"); } } } }
public static void Run() { // ExStart:1 EmailApi emailApi = new EmailApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH); StorageApi storageApi = new StorageApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH); String fileName = "email_test.eml"; String propertyName = "Subject"; String storage = ""; String folder = ""; EmailProperty emailSubject = new EmailProperty(); emailSubject.Name = "Subject"; emailSubject.Value = "This is a new subject"; try { // Upload source file to aspose cloud storage storageApi.PutCreate(fileName, "", "", System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName)); // Invoke Aspose.Email Cloud SDK API to set message property EmailPropertyResponse apiResponse = emailApi.PutSetEmailProperty(fileName, propertyName, storage, folder, emailSubject); if (apiResponse != null) { Console.WriteLine("Property Name :: " + apiResponse.EmailProperty.Name); Console.WriteLine("Property Value :: " + apiResponse.EmailProperty.Value); Console.WriteLine("Set Message Property, Done!"); Console.ReadKey(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); } // ExEnd:1 }
public void TestGetRecognizeDocument() { OcrApi target = new OcrApi(APIKEY, APPSID, BASEPATH); StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); string name = "Sampleocr.bmp"; string language = "english"; int? rectX = null; int? rectY = null; int? rectWidth = null; int? rectHeight = null; bool? useDefaultDictionaries = null; string storage = null; string folder = null; storageApi.PutCreate(name, "", "", System.IO.File.ReadAllBytes("\\temp\\ocr\\resources\\" + name)); Com.Aspose.OCR.Model.OCRResponse actual; actual = target.GetRecognizeDocument(name, language, rectX, rectY, rectWidth, rectHeight, useDefaultDictionaries, storage, folder); Assert.AreEqual("200", actual.Code); Assert.IsInstanceOfType(new OCRResponse(), actual.GetType()); }
public TestsSetup() { var comparisonConfig = new Configuration { AuthType = AuthType.OAuth2, AppSid = _appSid, AppKey = _appKey, ApiBaseUrl = _apiBaseUrl }; ComparisonApi = new ComparisonApi(comparisonConfig); ChangesApi = new ChangesApi(comparisonConfig); var storageConfig = new Configuration { AuthType = AuthType.OAuth2, AppSid = _appSid, AppKey = _appKey, ApiBaseUrl = _apiBaseUrl }; StorageApi = new StorageApi(storageConfig); }
public void TestGetChangeImageScale() { ImagingApi target = new ImagingApi(APIKEY, APPSID, BASEPATH); StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); string name = "aspose_imaging_for_cloud.png"; string format = "jpg"; int? newWidth = 200; int? newHeight = 200; string outPath = ""; string folder = ""; string storage = ""; storageApi.PutCreate(name, null, null, System.IO.File.ReadAllBytes("\\temp\\imaging\\resources\\" + name)); ResponseMessage actual; actual = target.GetChangeImageScale(name, format, newWidth, newHeight, outPath, folder, storage); Assert.AreEqual(200, actual.Code); Assert.IsInstanceOfType(new ResponseMessage(), actual.GetType()); }
public void TestGetCropImage() { ImagingApi target = new ImagingApi(APIKEY, APPSID, BASEPATH); StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); string name = "aspose.jpg"; string format = "png"; int? x = 30; int? y = 40; int? width = 100; int? height = 100; string outPath = ""; string folder = ""; string storage = ""; storageApi.PutCreate(name, null, null, System.IO.File.ReadAllBytes("\\temp\\imaging\\resources\\" + name)); ResponseMessage actual; actual = target.GetCropImage(name, format, x, y, width, height, outPath, folder, storage); Assert.AreEqual(200, actual.Code); Assert.IsInstanceOfType(new ResponseMessage(), actual.GetType()); }
public void TestPostDocumentProperty() { TasksApi target = new TasksApi(APIKEY, APPSID, BASEPATH); StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); string name = "sample-project-2.mpp"; string propertyName = "Title"; string storage = null; string folder = null; string filename = null; DocumentProperty body = new DocumentProperty(); body.Name = "Title"; body.Value = "Tasks"; storageApi.PutCreate(name, null, null, System.IO.File.ReadAllBytes("\\temp\\tasks\\resources\\" + name)); DocumentPropertyResponse actual; actual = target.PostDocumentProperty(name, propertyName, storage, folder, filename, body); Assert.AreEqual("200", actual.Code); Assert.IsInstanceOfType(new DocumentPropertyResponse(), actual.GetType()); }
public void TestPostTaskLink() { TasksApi target = new TasksApi(APIKEY, APPSID, BASEPATH); StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); string name = "sample-project-2.mpp"; string storage = null; string folder = null; string fileName = null; TaskLink body = new TaskLink(); body.Index = 2; body.PredecessorUid = 1; body.SuccessorUid = 2; storageApi.PutCreate(name, null, null, System.IO.File.ReadAllBytes("\\temp\\tasks\\resources\\" + name)); SaaSposeResponse actual; actual = target.PostTaskLink(name, storage, folder, fileName, body); Assert.AreEqual("200", actual.Code); Assert.IsInstanceOfType(new SaaSposeResponse(), actual.GetType()); }
public static void Run() { // ExStart:1 StorageApi storageApi = new StorageApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH); string storage = "MyStorageName"; try { // Invoke Aspose.Storage Cloud SDK API to get disc usage DiscUsageResponse apiResponse = storageApi.GetDiscUsage(storage); if (apiResponse != null && apiResponse.Status.Equals("OK")) { Console.WriteLine("Total Size (bytes): " + apiResponse.DiscUsage.TotalSize); Console.WriteLine("Used Size (bytes): " + apiResponse.DiscUsage.UsedSize); Console.ReadKey(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); } // ExEnd:1 }
public void Test_PutHtmlTranslate_en_ru_1() { string name = "testpage1.html"; string folder = "HtmlTestTranslate"; string storagePath = $"{folder}/{name}"; string srcPath = Path.Combine(dataFolder, name); StorageApi.PutCreate(storagePath, null, null, File.ReadAllBytes(srcPath)); FileExistResponse resp = StorageApi.GetIsExist(storagePath, null, null); Assert.IsTrue(resp.FileExist.IsExist); var response = TranslationApi.PutTranslateDocument(name, "en", "ru", folder); Assert.AreEqual("storage", (string)response.Content); Assert.IsTrue(response.ContentName != null); storagePath = string.Format("{0}/{1}", folder, response.ContentName); var stResp = StorageApi.GetIsExist(storagePath, null, null); Assert.IsTrue(stResp.FileExist.IsExist); }
public void TestPostImageBmp() { ImagingApi target = new ImagingApi(APIKEY, APPSID, BASEPATH); StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); string name = "sample.bmp"; int? bitsPerPixel = 24; int? horizontalResolution = 300; int? verticalResolution = 300; bool? fromScratch = null; string outPath = ""; byte[] file = System.IO.File.ReadAllBytes("\\temp\\imaging\\resources\\" + name); //storageApi.PutCreate(name, null, null, System.IO.File.ReadAllBytes("\\temp\\imaging\\resources\\" + name)); ResponseMessage actual; actual = target.PostImageBmp(bitsPerPixel, horizontalResolution, verticalResolution, fromScratch, outPath, file); Assert.AreEqual(200, actual.Code); Assert.IsInstanceOfType(new ResponseMessage(), actual.GetType()); }
public void TestPostProcessTiff() { ImagingApi target = new ImagingApi(APIKEY, APPSID, BASEPATH); StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); string name = "demo.tif"; string compression = "ccittfax3"; string resolutionUnit = "inch"; int? bitDepth = 1; bool? fromScratch = null; float? horizontalResolution = null; float? verticalResolution = null; string outPath = ""; byte[] file = System.IO.File.ReadAllBytes("\\temp\\imaging\\resources\\" + name); ResponseMessage actual; actual = target.PostProcessTiff(compression, resolutionUnit, bitDepth, fromScratch, horizontalResolution, verticalResolution, outPath, file); Assert.AreEqual(200, actual.Code); Assert.IsInstanceOfType(new ResponseMessage(), actual.GetType()); }
public void TestGetImagePsd() { ImagingApi target = new ImagingApi(APIKEY, APPSID, BASEPATH); StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); string name = "sample.psd"; int? channelsCount = 3; string compressionMethod = "rle"; bool? fromScratch = null; string outPath = ""; string folder = ""; string storage = ""; storageApi.PutCreate(name, null, null, System.IO.File.ReadAllBytes("\\temp\\imaging\\resources\\" + name)); ResponseMessage actual; actual = target.GetImagePsd(name, channelsCount, compressionMethod, fromScratch, outPath, folder, storage); Assert.AreEqual(200, actual.Code); Assert.IsInstanceOfType(new ResponseMessage(), actual.GetType()); }
public void TestGetImageJpg() { ImagingApi target = new ImagingApi(APIKEY, APPSID, BASEPATH); StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); string name = "aspose.jpg"; int? quality = 100; string compressionType = "progressive"; bool? fromScratch = null; string outPath = ""; string folder = ""; string storage = ""; storageApi.PutCreate(name, null, null, System.IO.File.ReadAllBytes("\\temp\\imaging\\resources\\" + name)); ResponseMessage actual; actual = target.GetImageJpg(name, quality, compressionType, fromScratch, outPath, folder, storage); Assert.AreEqual(200, actual.Code); Assert.IsInstanceOfType(new ResponseMessage(), actual.GetType()); }
public void TestPutSetEmailProperty() { EmailApi target = new EmailApi(APIKEY, APPSID, BASEPATH); StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); string name = "email_test.eml"; string propertyName = "Body"; string storage = null; string folder = null; EmailProperty body = new EmailProperty(); body.Name = "Subject"; body.Value = "This is the subject"; storageApi.PutCreate(name, null, null, System.IO.File.ReadAllBytes("\\temp\\email\\resources\\" + name)); EmailPropertyResponse actual; actual = target.PutSetEmailProperty(name, propertyName, storage, folder, body); Assert.AreEqual("200", actual.Code); Assert.IsInstanceOfType(new EmailPropertyResponse(), actual.GetType()); }
public static void Run() { // ExStart:1 CellsApi cellsApi = new CellsApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH); StorageApi storageApi = new StorageApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH); String fileName = "Sample_Test_Book.xls"; String sheetName = "Sheet6"; int pictureIndex = 0; String storage = ""; String folder = ""; Picture body = new Picture(); body.Name = "aspose-cloud-logo"; body.RotationAngle = 90.0; try { // Upload source file to aspose cloud storage storageApi.PutCreate(fileName, "", "", System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName)); // Invoke Aspose.Cells Cloud SDK API to update specific picture from excel worksheet PictureResponse apiResponse = cellsApi.PostWorkSheetPicture(fileName, sheetName, pictureIndex, storage, folder, body); if (apiResponse != null && apiResponse.Status.Equals("OK")) { Console.WriteLine("Update a specific Picture from Excel Worksheet , Done!"); Console.ReadKey(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); } // ExEnd:1 }
public static void Run() { // ExStart:1 WordsApi wordsApi = new WordsApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH); StorageApi storageApi = new StorageApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH); string fileName = "TestExecuteTemplate.doc"; string cleanup = null; string destFileName = "updated-" + fileName; string mailMergeDataFile = null; string storage = null; string folder = null; bool useWholeParagraphAsRegion = false; bool withRegions = true; byte[] file = System.IO.File.ReadAllBytes(Common.GetDataDir() + "SampleMailMergeTemplateData.txt"); try { // Upload the file storageApi.PutCreate(fileName, "", "", System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName)); // Invoke Aspose.Words Cloud SDK API to execute mail merge template with regions DocumentResponse apiResponse = wordsApi.PostDocumentExecuteMailMerge(fileName, withRegions, mailMergeDataFile, cleanup, destFileName, storage, folder, useWholeParagraphAsRegion, file); if (apiResponse != null && apiResponse.Status.Equals("OK")) { Console.WriteLine("mail merge template has been executed successfully"); Console.ReadKey(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); } // ExEnd:1 }
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-input.pptx"; String oldValue = "aspose"; String newValue = "aspose2"; bool ignoreCase = true; String folder = ""; String storage = ""; try { // Upload source file to aspose cloud storage storageApi.PutCreate(fileName, "", "", System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName)); // Invoke Aspose.Slides Cloud SDK API to get all text instances from presentation PresentationStringReplaceResponse apiResponse = slidesApi.PostSlidesPresentationReplaceText(fileName, oldValue, newValue, ignoreCase, folder, storage); if (apiResponse != null && apiResponse.Status.Equals("OK")) { // Download updated presentation from cloud 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("Replace All Text Instances in a Presentation, Done!"); Console.ReadKey(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); } // ExEnd:1 }
public void Run() { string name = "testpage5.html.zip"; // storage file name string folder = "HtmlTemp"; // storage folder name string filePath = Path.Combine(CommonSettings.DataFolder, name); StorageApi storageApi = new StorageApi(CommonSettings.AppKey, CommonSettings.AppSID, CommonSettings.BasePath); string storagePath = string.IsNullOrEmpty(folder) ? name : string.Format("{0}/{1}", folder, name); if (File.Exists(filePath)) { // upload source file to the cloud storage (default is AmazonS3) //filePath = string.Format("file:///{0}", filePath.Replace('\\', '/')); storageApi.PutCreate(storagePath, null, null, File.ReadAllBytes(filePath)); } else { throw new Exception(string.Format("Error: file {0} not found.", filePath)); } IDocumentApi docApi = new DocumentApi(CommonSettings.AppKey, CommonSettings.AppSID, CommonSettings.BasePath); // call SDK method that gets a zip archive with all HTML document images Stream stream = docApi.GetDocumentImages(name, null, folder); if (stream != null && typeof(FileStream) == stream.GetType()) { string outFile = $"{Path.GetFileNameWithoutExtension(name)}_images.zip"; string outPath = Path.Combine(CommonSettings.OutDirectory, outFile); using (FileStream fstr = new FileStream(outPath, FileMode.Create, FileAccess.Write)) { stream.Position = 0; stream.CopyTo(fstr); fstr.Flush(); Console.WriteLine(string.Format("\nResult file downloaded to: {0}", outPath)); } } }
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 name = "sample"; String fileName = name + ".pptx"; String format = "tiff"; String jpegQuality = null; String password = ""; String storage = ""; String folder = ""; String outPath = ""; try { // Upload source file to aspose cloud storage storageApi.PutCreate(fileName, "", "", System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName)); // Invoke Aspose.Slides Cloud SDK API to convert document to other format ResponseMessage apiResponse = slidesApi.GetSlidesDocumentWithFormat(fileName, format, jpegQuality, password, storage, folder, outPath); if (apiResponse != null) { // Download appended document from storage server System.IO.File.WriteAllBytes(Common.GetDataDir() + name + "." + format, apiResponse.ResponseStream); Console.WriteLine("Convert PowerPoint Documents to other File Formats, Done!"); Console.ReadKey(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); } // ExEnd:1 }
public void Run() { string srcUrl = @"http://www.htmlhelp.com/reference/css/stylesheets-now.html"; //string srcUrl = @"https://www.le.ac.uk/oerresources/bdra/html/page_01.htm"; string folder = null; // default folder is root string storage = null; // default storage is AmazonS3 TranslationApi transApi = new TranslationApi(CommonSettings.AppKey, CommonSettings.AppSID, CommonSettings.BasePath); NativeRestResponse resp = transApi.PutTranslateDocumentByUrl(srcUrl, SrcLang, ResLang, folder, storage); if (resp.ContentType == NativeRestResponse.RespContentType.FileName && resp.ContentName != null) { StorageApi storageApi = new StorageApi(CommonSettings.AppKey, CommonSettings.AppSID, CommonSettings.BasePath); var storagePath = !string.IsNullOrEmpty(folder) ? string.Format("{0}/{1}", folder, resp.ContentName) : resp.ContentName; var stResp = storageApi.GetIsExist(storagePath, null, storage); if (stResp.FileExist.IsExist) { Console.WriteLine(string.Format("\nFile '{0}' created in the cloud storage: folder = '{1}', storage = '{2}' ", resp.ContentName, folder ?? "", storage ?? "<default>")); ResponseMessage resp2 = storageApi.GetDownload(storagePath, null, storage); using (MemoryStream resStream = new MemoryStream(resp2.ResponseStream)) { var outPath = Path.Combine(CommonSettings.OutDirectory, resp.ContentName); using (FileStream fstr = new FileStream(outPath, FileMode.Create, FileAccess.Write)) { resStream.Position = 0; resStream.CopyTo(fstr); fstr.Flush(); Console.WriteLine(string.Format("\nResult file downloaded to: {0}", outPath)); } } } } }
public static void Run() { // ExStart:1 CellsApi cellsApi = new CellsApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH); StorageApi storageApi = new StorageApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH); // Set input file name String fileName = "Sample_Book1.xlsx"; String propertyName = "AsposeAuthor"; String storage = ""; String folder = ""; CellsDocumentProperty body = new CellsDocumentProperty(); body.Name = "AsposeAuthor"; body.Value = "Aspose Plugin Developer"; body.BuiltIn = "false"; try { // Upload source file to aspose cloud storage storageApi.PutCreate(fileName, "", "", System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName)); // Invoke Aspose.Cells Cloud SDK API to set particular property CellsDocumentPropertyResponse apiResponse = cellsApi.PutDocumentProperty(fileName, propertyName, storage, folder, body); if (apiResponse != null) { Console.WriteLine("New values for the Property have been changed!"); Console.ReadKey(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); } // ExEnd:1 }
public void TestCopyMoveFile() { var testFile = TestFiles.FourPagesDocx; // Create temp folder var cRequest = new CreateFolderRequest("temp"); FolderApi.CreateFolder(cRequest); // Copy file var destPath = $"temp/{testFile.FileName}"; var request = new CopyFileRequest(testFile.FullName, destPath); FileApi.CopyFile(request); // Check copied file var eRequest = new ObjectExistsRequest(destPath); var eResponse = StorageApi.ObjectExists(eRequest); Assert.IsTrue(eResponse.Exists); // Move file var newDestPath = $"temp/{testFile.FileName.Replace(".", "_1.")}"; var mRequest = new MoveFileRequest(destPath, newDestPath); FileApi.MoveFile(mRequest); // Check moved file eRequest = new ObjectExistsRequest(newDestPath); eResponse = StorageApi.ObjectExists(eRequest); Assert.IsTrue(eResponse.Exists); // Delete temp folder var delRequest = new DeleteFolderRequest("temp", null, true); FolderApi.DeleteFolder(delRequest); }
public static void Run() { // ExStart:1 CellsApi cellsApi = new CellsApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH); StorageApi storageApi = new StorageApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH); String fileName = "Sample_Test_Book.xls"; String sheetName = "Sheet2"; int hyperlinkIndex = 0; String storage = ""; String folder = ""; Hyperlink body = new Hyperlink(); body.Address = "http://www.aspose.com/cloud/total-api.aspx"; body.TextToDisplay = "Aspose Cloud APIs"; try { // Upload source file to aspose cloud storage storageApi.PutCreate(fileName, "", "", System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName)); // Invoke Aspose.Cells Cloud SDK API to update hyperlinks HyperlinkResponse apiResponse = cellsApi.PostWorkSheetHyperlink(fileName, sheetName, hyperlinkIndex, storage, folder, body); if (apiResponse != null && apiResponse.Status.Equals("OK")) { Console.WriteLine("Hyperlink Address : " + apiResponse.Hyperlink.Address); Console.ReadKey(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); } // ExEnd:1 }
public void StorageCopyMoveFile() { var testFile = TestFiles.PdfStorage.FirstOrDefault(x => x.Name.Equals("01_pages.pdf")); // Create temp folder var cRequest = new CreateFolderRequest("temp"); FolderApi.CreateFolder(cRequest); // Copy file var destPath = $"temp/{testFile.Name}"; var request = new CopyFileRequest(testFile.Path, destPath); FileApi.CopyFile(request); // Check copied file var eRequest = new ObjectExistsRequest(destPath); var eResponse = StorageApi.ObjectExists(eRequest); Assert.IsTrue(eResponse.Exists); // Move file var newDestPath = $"temp/{testFile.Path.Replace(".", "_1.")}"; var mRequest = new MoveFileRequest(destPath, newDestPath); FileApi.MoveFile(mRequest); // Check moved file eRequest = new ObjectExistsRequest(newDestPath); eResponse = StorageApi.ObjectExists(eRequest); Assert.IsTrue(eResponse.Exists); // Delete temp folder var delRequest = new DeleteFolderRequest("temp", null, true); FolderApi.DeleteFolder(delRequest); }
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-input.pptx"; int slideIndex = 1; Boolean withEmpty = false; String folder = ""; String storage = ""; try { // Upload source file to aspose cloud storage storageApi.PutCreate(fileName, "", "", System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName)); // Invoke Aspose.Slides Cloud SDK API to append word document TextItemsResponse apiResponse = slidesApi.GetSlidesSlideTextItems(fileName, slideIndex, withEmpty, folder, storage); if (apiResponse != null && apiResponse.Status.Equals("OK")) { foreach (TextItem textItem in apiResponse.TextItems.Items) { Console.WriteLine("Text :: " + textItem.Text); } Console.WriteLine("Get All Text Items from a Slide, Done!"); Console.ReadKey(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); } // ExEnd:1 }
public static void Run() { // ExStart:1 PdfApi pdfApi = new PdfApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH); StorageApi storageApi = new StorageApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH); string fileName = "test.pdf"; string storage = null; string folder = null; Com.Aspose.PDF.Model.TextReplaceListRequest body = new Com.Aspose.PDF.Model.TextReplaceListRequest(); Com.Aspose.PDF.Model.TextReplace tr = new Com.Aspose.PDF.Model.TextReplace(); tr.NewValue = "This will be the new text"; body.TextReplaces = new System.Collections.Generic.List <Com.Aspose.PDF.Model.TextReplace> { tr }; try { // Upload source file to aspose cloud storage storageApi.PutCreate(fileName, "", "", System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName)); // Invoke Aspose.PDF Cloud SDK API to replace pdf text list DocumentTextReplaceResponse apiResponse = pdfApi.PostDocumentReplaceTextList(fileName, storage, folder, body); if (apiResponse != null && apiResponse.Status.Equals("OK")) { Console.WriteLine("Replace PDF Document Text List, Done!"); Console.ReadKey(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); } // ExEnd:1 }
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 = "demo.pptx"; int slideIndex = 1; String folder = ""; String storage = ""; try { // Upload source file to aspose cloud storage storageApi.PutCreate(fileName, "", "", System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName)); // Invoke Aspose.Slides Cloud SDK API to get slide color scheme ColorSchemeResponse apiResponse = slidesApi.GetSlidesThemeColorScheme(fileName, slideIndex, folder, storage); if (apiResponse != null && apiResponse.Status.Equals("OK")) { ColorScheme colorScheme = apiResponse.ColorScheme; Console.WriteLine("Accent1 : " + colorScheme.Accent1); Console.WriteLine("Accent3 : " + colorScheme.Accent2); Console.WriteLine("Dark1 : " + colorScheme.Dark1); Console.WriteLine("Dark2 : " + colorScheme.Dark2); Console.WriteLine("Light1 : " + colorScheme.Light1); Console.WriteLine("Get Color Scheme of a PowerPoint Slide, Done!"); Console.ReadKey(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); } // ExEnd:1 }
public static void Run() { // ExStart:1 CellsApi cellsApi = new CellsApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH); StorageApi storageApi = new StorageApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH); String fileName = "Sample_Test_Book.xls"; String sheetName = "Sheet5"; int chartIndex = 0; String storage = ""; String folder = ""; Legend body = new Legend(); body.Height = 15; body.Position = "Left"; try { // Upload source file to aspose cloud storage storageApi.PutCreate(fileName, "", "", System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName)); // Invoke Aspose.Cells Cloud SDK API to update chart legend LegendResponse apiResponse = cellsApi.PostWorksheetChartLegend(fileName, sheetName, chartIndex, storage, folder, body); if (apiResponse != null && apiResponse.Status.Equals("OK")) { Console.WriteLine("Chart Legend Position :: " + apiResponse.Legend.Position); Console.ReadKey(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); } // ExEnd:1 }