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);
            }
        }
Ejemplo n.º 2
0
        public void CellsPivotTablesDeletePivotTableFieldTest()
        {
            string name                    = "TestCase.xlsx";
            string sheetName               = "SHEET4";
            int?   pivotTableIndex         = 0;
            string pivotFieldType          = "row";
            PivotTableFieldRequest request = new PivotTableFieldRequest();

            request.Data = new List <int?> {
                1
            };
            string folder = "TEMPFOLDER";

            new Config().UpdateDataFile(folder, name);
            var response = instance.CellsPivotTablesDeletePivotTableField(name, sheetName, pivotTableIndex, pivotFieldType, request, folder);

            Console.WriteLine(response);
        }
        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";

            PivotTableFieldRequest pivotTableFieldRequest = new PivotTableFieldRequest();

            pivotTableFieldRequest.Data = new System.Collections.Generic.List <int>();
            pivotTableFieldRequest.Data.Add(1);
            pivotTableFieldRequest.Data.Add(1);
            Common.CellsService.PivotTable.AddPivotFieldIntoIntoPivotTable(input, sheetName, 0, "Row", pivotTableFieldRequest, Common.FOLDER, storage: Common.STORAGE);

            Common.StorageService.File.DownloadFile(input, dataDir + output, storage: Common.STORAGE);
        }
Ejemplo n.º 4
0
        public void CellsPivotTablesDeletePivotTableFieldTest()
        {
            // TODO uncomment below to test the method and replace null with proper value
            string name                    = PivTestFile;
            string sheetName               = SHEET4;
            int?   pivotTableIndex         = 0;
            string pivotFieldType          = "row";
            PivotTableFieldRequest request = new PivotTableFieldRequest();

            request.Data = new List <int?> {
                1
            };
            string folder = TEMPFOLDER;

            UpdateDataFile(instance, folder, name);
            var response = instance.CellsPivotTablesDeletePivotTableField(name, sheetName, pivotTableIndex, pivotFieldType, request, folder);

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