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_Book1.xlsx";
            String propertyName = "Author";
            String storage      = "";
            String folder       = "";

            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 get particular property
                CellsDocumentPropertyResponse apiResponse = cellsApi.GetDocumentProperty(fileName, propertyName, storage, folder);

                if (apiResponse != null && apiResponse.Status.Equals("OK"))
                {
                    CellsDocumentProperty docProperty = apiResponse.DocumentProperty;
                    Console.WriteLine("Name: " + docProperty.Name);
                    Console.WriteLine("Value: " + docProperty.Value);
                    Console.WriteLine("BuiltIn: " + docProperty.BuiltIn);
                    Console.ReadKey();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
            }
            // ExEnd:1
        }
        public void CellsPropertiesPutDocumentPropertyTest()
        {
            string name                    = "Book1.xlsx";
            string propertyName            = "Name";
            CellsDocumentProperty property = new CellsDocumentProperty();

            //(null, "Author", "Val"
            property.Name  = "Author";
            property.Value = "Val";
            string folder = null;

            new Config().UpdateDataFile(folder, name);
            var response = instance.CellsPropertiesPutDocumentProperty(name, propertyName, property, folder);

            Console.WriteLine(response);
        }
Пример #3
0
        public void CellsPropertiesPutDocumentPropertyTest()
        {
            // TODO uncomment below to test the method and replace null with proper value
            string name                    = BOOK1;
            string propertyName            = "Name";
            CellsDocumentProperty property = new CellsDocumentProperty();

            //(null, "Author", "Val"
            property.Name  = "Author";
            property.Value = "Val";
            string folder = TEMPFOLDER;

            UpdateDataFile(folder, name);
            var response = instance.CellsPropertiesPutDocumentProperty(name, propertyName, property, folder);

            Assert.IsInstanceOf <CellsDocumentPropertyResponse>(response, "response is CellsDocumentPropertyResponse");
            Assert.AreEqual(response.Code, 201);
        }
Пример #4
0
        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
        }