static void Main() { string dataDir = Common.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); string input = "sample1.xlsx"; Common.StorageService.File.UploadFile(dataDir + input, input, storage: Common.STORAGE); string sheetName = "Sheet1"; CellsCommentResponse apiResponse = Common.CellsService.Worksheets.GetWorksheetCommentByCellName(input, sheetName, "A1", Common.FOLDER, storage: Common.STORAGE); Console.WriteLine(" Cell Comment : " + apiResponse.Comment.Note); }
public void Cells_Worksheets_Tests() { try { storageService.File.CopyFile(Utils.CloudStorage_Input_Folder + "/cells-sample.xlsx", Utils.CloudStorage_Output_Folder + "/cells-sample.xlsx"); WorksheetsResponse WorksheetsResponse = cellsService.Worksheets.ReadWorksheetsInfo(name, Utils.CloudStorage_Output_Folder); WorksheetResponse ReadWorksheetInfo = cellsService.Worksheets.ReadWorksheetInfo(name, "sheet2", Utils.CloudStorage_Output_Folder); cellsService.Worksheets.ExportWorksheet(name, "sheet1", WorksheetExportFormat.Gif, 0, 0, Utils.CloudStorage_Output_Folder, Utils.Local_Output_Path + "cells_worksheet_gif.gif"); cellsService.Worksheets.AddNewWorksheet(name, "sheetZ", Utils.CloudStorage_Output_Folder); cellsService.Worksheets.DeleteWorksheet(name, "sheetZ", Utils.CloudStorage_Output_Folder); ReadWorksheetInfo.Worksheet.IsSelected = true; WorksheetResponse WorksheetResponse = cellsService.Worksheets.UpdateWorksheetProperty(name, "sheet2", ReadWorksheetInfo.Worksheet, Utils.CloudStorage_Output_Folder); WorksheetResponse WorksheetResponse2 = cellsService.Worksheets.ChangeWorksheetVisibility(name, "sheet1", false, Utils.CloudStorage_Output_Folder); WorksheetResponse WorksheetResponse3 = cellsService.Worksheets.ChangeWorksheetVisibility(name, "sheet1", true, Utils.CloudStorage_Output_Folder); CellsMoveWorksheetRequest cellsMoveWorksheetRequest = new CellsMoveWorksheetRequest(); cellsMoveWorksheetRequest.DestinationWorksheet = "sheet3"; cellsMoveWorksheetRequest.Position = 3; cellsService.Worksheets.MoveWorksheet(name, "sheet1", cellsMoveWorksheetRequest, Utils.CloudStorage_Output_Folder); CellsProtectParameter cellsProtectParameter = new CellsProtectParameter(CellsProtectionType.All); cellsProtectParameter.Password = "******"; cellsService.Worksheets.ProtectWorksheet(name, "sheet1", cellsProtectParameter, Utils.CloudStorage_Output_Folder); cellsService.Worksheets.UnprotectWorksheet(name, "sheet1", cellsProtectParameter, Utils.CloudStorage_Output_Folder); CellsTextItemsResponse CellsTextItemsResponse = cellsService.Worksheets.GetWorksheetTextItems(name, "sheet1", Utils.CloudStorage_Output_Folder); CellsCommentRequest cellsCommentRequest = new CellsCommentRequest(); cellsCommentRequest.Note = "Aspose.Cells for .NET"; cellsCommentRequest.IsVisible = true; cellsCommentRequest.CellName = "A1"; cellsCommentRequest.Width = 100; cellsCommentRequest.Height = 50; cellsService.Worksheets.AddWorksheetsCellComment(name, "sheet1", "A1", cellsCommentRequest, Utils.CloudStorage_Output_Folder); CellsCommentsResponse CellsCommentsResponse = cellsService.Worksheets.GetWorksheetComments(name, "sheet1", Utils.CloudStorage_Output_Folder); CellsCommentResponse CellsCommentResponse = cellsService.Worksheets.GetWorksheetCommentByCellName(name, "sheet1", "A1", Utils.CloudStorage_Output_Folder); cellsCommentRequest.Author = "Aspose"; cellsService.Worksheets.UpdateWorksheetsCellComment(name, "sheet1", "A1", cellsCommentRequest, Utils.CloudStorage_Output_Folder); cellsService.Worksheets.DeleteWorksheetsCellComment(name, "sheet1", "A1", Utils.CloudStorage_Output_Folder); MergedCellsResponse MergedCellsResponse = cellsService.Worksheets.GetWorksheetMergedCells(name, "sheet1", Utils.CloudStorage_Output_Folder); MergedCellResponse MergedCellResponse = cellsService.Worksheets.GetWorksheetMergedCellByItsIndex(name, "sheet1", 0, Utils.CloudStorage_Output_Folder); CellsForumulaValueResponse CellsForumulaValueResponse = cellsService.Worksheets.CalculateFormulaValue(name, "sheet1", "D5*E5", Utils.CloudStorage_Output_Folder); CellsTextItemsResponse CellsTextItemsResponse2 = cellsService.Worksheets.SearchText(name, "sheet1", "Student1", Utils.CloudStorage_Output_Folder); CellsWorksheetMatchesResponse CellsWorksheetMatchesResponse = cellsService.Worksheets.ReplaceText(name, "sheet1", "Student", "Employee", Utils.CloudStorage_Output_Folder); CellsDataSorterRequest dataSorter = new CellsDataSorterRequest(); dataSorter.CaseSensitive = true; dataSorter.HasHeaders = true; CellsKeyList cellsKeyList = new CellsKeyList(); cellsKeyList.Key = 1; cellsKeyList.SortOrder = "DESCENDING"; dataSorter.KeyList = new List <CellsKeyList>(); dataSorter.KeyList.Add(cellsKeyList); cellsService.Worksheets.SortWorksheetRange(name, "sheet1", "B4:F19", dataSorter, Utils.CloudStorage_Output_Folder); CellsAutoFitterOptionsRequest autoFitterOptions = new CellsAutoFitterOptionsRequest(); autoFitterOptions.OnlyAuto = true; cellsService.Worksheets.AutofitWorksheetRows(name, "sheet1", 1, 100, true, autoFitterOptions, Utils.CloudStorage_Output_Folder); cellsService.Worksheets.SetWorksheetBackgroundImage(name, "sheet1", Utils.Local_Input_Path + "signature.jpg", Utils.CloudStorage_Output_Folder); cellsService.Worksheets.DeleteWorksheetBackgroundImage(name, "sheet1", Utils.CloudStorage_Output_Folder); cellsService.Worksheets.SetFreezePanes(name, "sheet1", 4, 1, 1, 1, Utils.CloudStorage_Output_Folder); cellsService.Worksheets.UnfreezePanes(name, "sheet1", 4, 1, 1, 1, Utils.CloudStorage_Output_Folder); cellsService.Worksheets.CopyWorksheet(name, "sheetZ", "sheet1", Utils.CloudStorage_Output_Folder); cellsService.Worksheets.RenameWorksheet(name, "sheetZ", "sheetRenamed", Utils.CloudStorage_Output_Folder); //storageService.File.DownloadFile(Utils.CloudStorage_Output_Folder + "/cells-sample.xlsx", Utils.Local_Output_Path + "/cells-sample.xlsx"); } catch (Exception ex) { Assert.Fail(ex.Message); } }