예제 #1
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);

            String fileName             = "Sample_Test_Book.xls";
            String sheetName            = "Sheet1";
            String storage              = "";
            String folder               = "";
            WorksheetMovingRequest body = new WorksheetMovingRequest();

            body.DestinationWorksheet = "Sheet5";
            body.Position             = "after";

            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 move excel worksheets
                WorksheetsResponse apiResponse = cellsApi.PostMoveWorksheet(fileName, sheetName, storage, folder, body);

                if (apiResponse != null && apiResponse.Status.Equals("OK"))
                {
                    Console.WriteLine("WorkSheet moved!");
                    Console.ReadKey();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
            }
            // ExEnd:1
        }
예제 #2
0
        public void CellsWorksheetsPostMoveWorksheetTest()
        {
            string name      = "Book1.xlsx";
            string sheetName = "SHEET1";
            WorksheetMovingRequest moving = new WorksheetMovingRequest();//"SHEET3", "after"

            moving.DestinationWorksheet = "SHEET3";
            moving.Position             = "after";
            string folder = null;

            new Config().UpdateDataFile(folder, name);
            var response = instance.CellsWorksheetsPostMoveWorksheet(name, sheetName, moving, folder);

            Console.WriteLine(response);
        }
예제 #3
0
        public void CellsWorksheetsPostMoveWorksheetTest()
        {
            // TODO uncomment below to test the method and replace null with proper value
            string name      = BOOK1;
            string sheetName = SHEET1;
            WorksheetMovingRequest moving = new WorksheetMovingRequest();//SHEET3, "after"

            moving.DestinationWorksheet = SHEET3;
            moving.Position             = "after";
            string folder = TEMPFOLDER;

            UpdateDataFile(instance, folder, name);
            var response = instance.CellsWorksheetsPostMoveWorksheet(name, sheetName, moving, folder);

            Assert.IsInstanceOf <WorksheetsResponse>(response, "response is WorksheetsResponse");
            Assert.AreEqual(response.Code, 200);
        }