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 background SlideBackgroundResponse apiResponse = slidesApi.GetSlidesSlideBackground(fileName, slideIndex, folder, storage); if (apiResponse != null && apiResponse.Status.Equals("OK")) { SlideBackground slideBackground = apiResponse.Background; Console.WriteLine("SlideBackground Type :: " + slideBackground.Type); Console.WriteLine("Get Background 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 SetSlideBackground() { string name = "template.pptx"; int? slideIndex = 0; //solid //SlideBackground source = new SlideBackground("custom"); //source.Type = "SolidFill"; //source.FillFormat = new SolidFill("SolidFill", "red"); //gradient //List<GradientFillStop> stops = new List<GradientFillStop>(); //GradientFillStop stop1 = new GradientFillStop("red", 0); //GradientFillStop stop2 = new GradientFillStop("blue", 1); //stops.Add(stop1); //stops.Add(stop2); //GradientFill g = new GradientFill("FromCorner1", "Linear", stops, 30, false, "Horizontal"); //source.FillFormat = g; //picture SlideBackground source = new SlideBackground("custom"); string fileName = "image.jpg"; ResourceUriElement image = new ResourceUriElement(new ResourceUri(fileName)); source.FillFormat = new PictureFill(0, 0, 0, 0, 96, image, null, null, "Stretch"); string password = null; string folder = "input"; string storage = null; var response = slidesApi.SetSlideBackground(name, slideIndex, source, folder, password, storage); }
public void DeleteBackground() { TestUtils.Upload(c_fileName, c_folderName + "/" + c_fileName); int slideIndex = 5; SlideBackground response = TestUtils.SlidesApi.DeleteBackground(c_fileName, slideIndex, c_password, c_folderName); Assert.IsInstanceOf <NoFill>(response.FillFormat); }
public void SetBackgroundColor() { TestUtils.Upload(c_fileName, c_folderName + "/" + c_fileName); SlideBackground response = TestUtils.SlidesApi.SetBackgroundColor(c_fileName, c_slideIndex, c_color, c_password, c_folderName); Assert.IsInstanceOf <SolidFill>(response.FillFormat); Assert.AreEqual(c_color, ((SolidFill)response.FillFormat).Color); }
/// <summary> /// Initializes a new instance of the <see cref="PutSlidesSlideBackgroundRequest"/> class. /// </summary> /// <param name="name"></param> /// <param name="slideIndex"></param> /// <param name="background"></param> /// <param name="folder"></param> /// <param name="storage"></param> /// <param name="color"></param> public PutSlidesSlideBackgroundRequest(string name, int slideIndex, SlideBackground background = null, string folder = null, string storage = null, string color = null) { this.Name = name; this.SlideIndex = slideIndex; this.Background = background; this.Folder = folder; this.Storage = storage; this.Color = color; }