示例#1
0
        public void CellsPivotTablesPutWorksheetPivotTableTest_2()
        {
            // TODO uncomment below to test the method and replace null with proper value
            string name      = PivTestFile2;
            string sheetName = SHEET3;
            CreatePivotTableRequest request = new CreatePivotTableRequest();

            request.DestCellName      = "C1";
            request.Name              = "Test";
            request.PivotFieldColumns = new List <int?>()
            {
                0, 1
            };
            request.PivotFieldRows = new List <int?>()
            {
                2, 3
            };
            request.PivotFieldData = new List <int?>()
            {
                4
            };
            request.SourceData    = "Sheet2!$A$1:$E$8";
            request.UseSameSource = false;

            string folder = TEMPFOLDER;

            UpdateDataFile(instance, folder, name);
            var response = instance.CellsPivotTablesPutWorksheetPivotTable(name, sheetName, request, folder, null, null, null, null, null);

            Assert.IsInstanceOf <PivotTableResponse>(response, "response is PivotTableResponse");
            Assert.AreEqual(response.Code, 200);
        }
示例#2
0
        public void CellsListObjectsPostWorksheetListObjectSummarizeWithPivotTableTest()
        {
            string name                     = "Book1.xlsx";
            string sheetName                = "SHEET7";
            int?   listObjectIndex          = 0;
            string destsheetName            = "Sheet2";
            CreatePivotTableRequest request = new CreatePivotTableRequest();

            request.DestCellName      = "C1";
            request.Name              = "testp";
            request.PivotFieldColumns = new List <int?>()
            {
                2
            };
            request.PivotFieldData = new List <int?>()
            {
                1
            };
            request.PivotFieldRows = new List <int?>()
            {
                0
            };
            request.SourceData    = "=Sheet2!A1:E8";
            request.UseSameSource = true;
            string folder = null;

            new Config().UpdateDataFile(folder, name);
            var response = instance.CellsListObjectsPostWorksheetListObjectSummarizeWithPivotTable(name, sheetName, listObjectIndex, destsheetName, request, folder);

            Console.WriteLine(response);
        }
示例#3
0
        public void CellsPivotTablesPutWorksheetPivotTableTest()
        {
            // TODO uncomment below to test the method and replace null with proper value
            string name      = PivTestFile;
            string sheetName = SHEET4;
            CreatePivotTableRequest request = new CreatePivotTableRequest();

            //"TestPiov", "=Sheet2!A1:E8", "C10",true
            request.Name              = "TestPivot";
            request.DestCellName      = "C1";
            request.SourceData        = "Sheet1!C6:E13";
            request.UseSameSource     = true;
            request.PivotFieldColumns = new List <int?> {
                1
            };
            request.PivotFieldData = new List <int?> {
                2
            };
            request.PivotFieldRows = new List <int?> {
                3
            };
            request = null;
            string folder        = TEMPFOLDER;
            string sourceData    = "Sheet1!C6:E13";
            string destCellName  = "C1";
            string tableName     = "TestPivot";
            bool?  useSameSource = true;

            UpdateDataFile(instance, folder, name);
            var response = instance.CellsPivotTablesPutWorksheetPivotTable(name, sheetName, request, folder, null, sourceData, destCellName, tableName, useSameSource);

            Assert.IsInstanceOf <PivotTableResponse>(response, "response is PivotTableResponse");
            Assert.AreEqual(response.Code, 200);
        }
示例#4
0
        public void CellsListObjectsPostWorksheetListObjectSummarizeWithPivotTableTest()
        {
            // TODO uncomment below to test the method and replace null with proper value
            string name                     = BOOK1;
            string sheetName                = SHEET7;
            int?   listObjectIndex          = 0;
            string destsheetName            = "Sheet2";
            CreatePivotTableRequest request = new CreatePivotTableRequest();

            //"testP", "=Sheet2!A1:E8","C1",true, new List<int?>() { 1 },new List<int?>() { 2},new List<int?>() { 3 }
            request.DestCellName      = "C1";
            request.Name              = "testp";
            request.PivotFieldColumns = new List <int?>()
            {
                2
            };
            request.PivotFieldData = new List <int?>()
            {
                1
            };
            request.PivotFieldRows = new List <int?>()
            {
                0
            };
            request.SourceData    = "=Sheet2!A1:E8";
            request.UseSameSource = true;
            string folder = TEMPFOLDER;

            UpdateDataFile(instance, folder, name);
            var response = instance.CellsListObjectsPostWorksheetListObjectSummarizeWithPivotTable(name, sheetName, listObjectIndex, destsheetName, request, folder);

            Assert.IsInstanceOf <CellsCloudResponse>(response, "response is CellsCloudResponse");
            Assert.AreEqual(response.Code, 200);
        }
        static void Main()
        {
            string dataDir = Common.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            string input  = "sample1.xlsx";
            string output = "output.xlsx";

            Common.StorageService.File.UploadFile(dataDir + input, input, storage: Common.STORAGE);
            string sheetName = "Sheet1";

            CreatePivotTableRequest createPivotTableRequest = new CreatePivotTableRequest();

            createPivotTableRequest.Name          = "ASPOSE Pivot Table";
            createPivotTableRequest.SourceData    = "A1:C7";
            createPivotTableRequest.DestCellName  = "H10";
            createPivotTableRequest.UseSameSource = true;

            createPivotTableRequest.PivotFieldRows = new System.Collections.Generic.List <int>();
            createPivotTableRequest.PivotFieldRows.Add(1);

            createPivotTableRequest.PivotFieldColumns = new System.Collections.Generic.List <int>();
            createPivotTableRequest.PivotFieldColumns.Add(1);

            createPivotTableRequest.PivotFieldData = new System.Collections.Generic.List <int>();
            createPivotTableRequest.PivotFieldData.Add(1);

            Common.CellsService.PivotTable.AddAPivotTableIntoWorksheet(input, sheetName, createPivotTableRequest, Common.FOLDER, storage: Common.STORAGE);

            Common.StorageService.File.DownloadFile(input, dataDir + output, storage: Common.STORAGE);
        }
        public void Cells_PivotTable_Tests()
        {
            try
            {
                storageService.File.CopyFile(Utils.CloudStorage_Input_Folder + "/cells-sample.xlsx", Utils.CloudStorage_Output_Folder + "/cells-sample.xlsx");

                string name = "cells-sample.xlsx";

                PivotTablesResponse pivotTablesResponse = cellsService.PivotTable.GetWorksheetPivottablesInfo(name, "sheet6", Utils.CloudStorage_Output_Folder);
                PivotTableResponse  pivotTableResponse  = cellsService.PivotTable.GetWorksheetPivottableInfoByIndex(name, "sheet6", 0, Utils.CloudStorage_Output_Folder);
                cellsService.PivotTable.DeleteWorksheetPivotTableByIndex(name, "sheet6", 0, Utils.CloudStorage_Output_Folder);
                cellsService.PivotTable.DeleteWorksheetPivotTables(name, "sheet6", Utils.CloudStorage_Output_Folder);

                CreatePivotTableRequest createPivotTableRequest = new CreatePivotTableRequest();
                createPivotTableRequest.Name          = "Test Pivot Table";
                createPivotTableRequest.SourceData    = "A1:C7";
                createPivotTableRequest.DestCellName  = "H10";
                createPivotTableRequest.UseSameSource = true;

                createPivotTableRequest.PivotFieldRows = new List <int>();
                createPivotTableRequest.PivotFieldRows.Add(1);

                createPivotTableRequest.PivotFieldColumns = new List <int>();
                createPivotTableRequest.PivotFieldColumns.Add(1);

                createPivotTableRequest.PivotFieldData = new List <int>();
                createPivotTableRequest.PivotFieldData.Add(1);

                cellsService.PivotTable.AddAPivotTableIntoWorksheet(name, "sheet7", createPivotTableRequest, Utils.CloudStorage_Output_Folder);

                PivotTableFieldRequest pivotTableFieldRequest = new PivotTableFieldRequest();
                pivotTableFieldRequest.Data = new List <int>();
                pivotTableFieldRequest.Data.Add(1);
                pivotTableFieldRequest.Data.Add(2);
                cellsService.PivotTable.AddPivotFieldIntoIntoPivotTable(name, "sheet6", 0, "Row", pivotTableFieldRequest, Utils.CloudStorage_Output_Folder);

                WorkbookStyleResponse workbookStyleResponse = cellsService.WorksheetColumns.ReadCellStyleInfo(name, "sheet6", "A8", Utils.CloudStorage_Output_Folder);

                cellsService.PivotTable.UpdateCellStyleForPivotTable(name, "sheet6", 0, 1, 1, workbookStyleResponse.Style, Utils.CloudStorage_Output_Folder);

                cellsService.PivotTable.UpdateStyleForPivotTable(name, "sheet6", 0, workbookStyleResponse.Style, Utils.CloudStorage_Output_Folder);

                storageService.File.DownloadFile(Utils.CloudStorage_Output_Folder + "/cells-sample.xlsx", "d:\\cells-sample.xlsx");
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
示例#7
0
        public void CellsPivotTablesPutWorksheetPivotTableTest()
        {
            string name      = "TestCase.xlsx";
            string sheetName = "SHEET4";
            CreatePivotTableRequest request = new CreatePivotTableRequest();

            request.Name          = "TestPivot";
            request.DestCellName  = "C1";
            request.SourceData    = "Sheet1!C6:E13";
            request.UseSameSource = true;
            string folder        = "TEMPFOLDER";
            string sourceData    = "Sheet1!C6:E13";
            string destCellName  = "C1";
            string tableName     = "TestPivot";
            bool?  useSameSource = true;

            new Config().UpdateDataFile(folder, name);
            var response = instance.CellsPivotTablesPutWorksheetPivotTable(name, sheetName, null, folder, null, sourceData, destCellName, tableName, useSameSource);

            Console.WriteLine(response);
        }