public static void Main(String[] args) { string APIKEY = "xxxxx"; string APPSID = "xxxxx"; string BASEPATH = "http://api.aspose.com/v1.1"; try { SlidesApi target = new SlidesApi(APIKEY, APPSID, BASEPATH); StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); //string name = "slide_" + new Random().Next(100) + ".pptx"; //string password = null; //string storage = null; //string folder = null; //byte[] file = System.IO.File.ReadAllBytes("\\temp\\slides\\resources\\" + "test_slide.pptx"); ////System.Diagnostics.Debug.WriteLine("-------------working......"); //ResponseMessage actual; //actual = target.PutNewPresentation(name, password, storage, folder, file); string name = "test_slide.pptx"; int? slideIndex = 1; int? shapeIndex = 1; int? paragraphIndex = 1; int? portionIndex = 1; string folder = null; string storage = null; Portion body = new Portion(); body.Text = "Newer value"; body.FontColor = "#FFFF0000"; storageApi.PutCreate(name, null, null, System.IO.File.ReadAllBytes("\\temp\\slides\\resources\\" + name)); ResponseMessage actual; actual = target.PutSetParagraphPortionProperties(name, slideIndex, shapeIndex, paragraphIndex, portionIndex, folder, storage, body); System.Diagnostics.Debug.WriteLine("-------------working......"+actual); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("--------------------------------\nException:" + ex.Message + "\n" + ex.StackTrace); } }
public void TestPutSetParagraphPortionProperties() { SlidesApi target = new SlidesApi(APIKEY, APPSID, BASEPATH); StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); string name = "test_slide.pptx"; int? slideIndex = 1; int? shapeIndex = 1; int? paragraphIndex = 1; int? portionIndex = 1; string folder = null; string storage = null; Portion body = new Portion(); body.Text = "Newer Value"; body.FontColor = "#FFFF0000"; body.FontHeight = 5.0; storageApi.PutCreate(name, null, null, System.IO.File.ReadAllBytes("\\temp\\slides\\resources\\" + name)); ResponseMessage actual; actual = target.PutSetParagraphPortionProperties(name, slideIndex, shapeIndex, paragraphIndex, portionIndex, folder, storage, body); Assert.AreEqual("200", actual.Code); Assert.IsInstanceOfType(new Com.Aspose.Slides.Model.ResponseMessage(), actual.GetType()); }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <param name="slideIndex"></param> /// <param name="shapeIndex"></param> /// <param name="paragraphIndex"></param> /// <param name="portionIndex"></param> /// <param name="folder"></param> /// <param name="storage"></param> /// <param name="body"></param> /// <returns></returns> public ResponseMessage PutSetParagraphPortionProperties (string name, int? slideIndex, int? shapeIndex, int? paragraphIndex, int? portionIndex, string folder, string storage, Portion body) { // create path and map variables var ResourcePath = "/slides/{name}/slides/{slideIndex}/shapes/{shapeIndex}/paragraphs/{paragraphIndex}/portions/{portionIndex}/?appSid={appSid}&folder={folder}&storage={storage}".Replace("{format}","json"); ResourcePath = Regex.Replace(ResourcePath, "\\*", "").Replace("&", "&").Replace("/?", "?").Replace("toFormat={toFormat}", "format={format}"); // query params var queryParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, object>(); // verify required params are set if (name == null || slideIndex == null || shapeIndex == null || paragraphIndex == null || portionIndex == null || body == null ) { throw new ApiException(400, "missing required params"); } if (name == null){ ResourcePath = Regex.Replace(ResourcePath, @"([&?])name=", ""); }else{ ResourcePath = ResourcePath.Replace("{" + "name" + "}", apiInvoker.ToPathValue(name)); } if (slideIndex == null){ ResourcePath = Regex.Replace(ResourcePath, @"([&?])slideIndex=", ""); }else{ ResourcePath = ResourcePath.Replace("{" + "slideIndex" + "}", apiInvoker.ToPathValue(slideIndex)); } if (shapeIndex == null){ ResourcePath = Regex.Replace(ResourcePath, @"([&?])shapeIndex=", ""); }else{ ResourcePath = ResourcePath.Replace("{" + "shapeIndex" + "}", apiInvoker.ToPathValue(shapeIndex)); } if (paragraphIndex == null){ ResourcePath = Regex.Replace(ResourcePath, @"([&?])paragraphIndex=", ""); }else{ ResourcePath = ResourcePath.Replace("{" + "paragraphIndex" + "}", apiInvoker.ToPathValue(paragraphIndex)); } if (portionIndex == null){ ResourcePath = Regex.Replace(ResourcePath, @"([&?])portionIndex=", ""); }else{ ResourcePath = ResourcePath.Replace("{" + "portionIndex" + "}", apiInvoker.ToPathValue(portionIndex)); } if (folder == null){ ResourcePath = Regex.Replace(ResourcePath, @"([&?])folder=", ""); }else{ ResourcePath = ResourcePath.Replace("{" + "folder" + "}", apiInvoker.ToPathValue(folder)); } if (storage == null){ ResourcePath = Regex.Replace(ResourcePath, @"([&?])storage=", ""); }else{ ResourcePath = ResourcePath.Replace("{" + "storage" + "}", apiInvoker.ToPathValue(storage)); } try { if (typeof(ResponseMessage) == typeof(ResponseMessage)) { var response = apiInvoker.invokeBinaryAPI(basePath, ResourcePath, "PUT", queryParams, null, headerParams, formParams); return (ResponseMessage) ApiInvoker.deserialize(response, typeof(ResponseMessage)); } else { var response = apiInvoker.invokeAPI(basePath, ResourcePath, "PUT", queryParams, body, headerParams, formParams); if(response != null){ return (ResponseMessage) ApiInvoker.deserialize(response, typeof(ResponseMessage)); } else { return null; } } } catch (ApiException ex) { if(ex.ErrorCode == 404) { return null; } else { throw ex; } } }