|
namespace Aspose.Cells.Cloud.SDK.Tests.Api.Example |
|
{ |
|
using Microsoft.VisualStudio.TestTools.UnitTesting; |
|
using Aspose.Cells.Cloud.SDK.Request; |
|
using System.Collections.Generic; |
|
using Aspose.Cells.Cloud.SDK.Model; |
|
using Aspose.Cells.Cloud.SDK.Api; |
|
using System; |
|
using System.IO; |
|
|
|
[TestClass] |
|
public class CellsApiExample |
|
{ |
|
string CellsCloudClientId ="....";//get from https://dashboard.aspose.cloud/#/applications |
|
string CellsCloudClientSecret="...";//get from https://dashboard.aspose.cloud/#/applications |
|
private readonly string remoteFolder = "TestData/In"; |
|
string localName = "Book1.xlsx"; |
|
string remoteName = "remote_book1.xlsx"; |
|
string localPath = "D:/TestData/CellsCloud"; |
|
[TestCategory("Cells")] |
|
[TestMethod] |
|
public void Example() |
|
{ |
|
|
|
|
|
UploadFileRequest uploadFileRequest = new UploadFileRequest(); |
|
System.IO.FileInfo fileInfo = new System.IO.FileInfo(localPath + "/" + localName); |
|
uploadFileRequest.path = remoteFolder + "/" + remoteName; |
|
uploadFileRequest.storageName = ""; |
|
uploadFileRequest.UploadFiles = new Dictionary<string, Stream>() { { localName, File.OpenRead(localPath +"/"+ localName) } }; |
|
cellsApi.UploadFile(uploadFileRequest); |
|
|
|
|
|
|
|
ColorFilterRequest colorFilter = new ColorFilterRequest(); |
|
Color color = new Color();//0, 255, 245, 2 |
|
color.R = 255; |
|
color.A = 245; |
|
color.B = 245; |
|
color.G = 0; |
|
|
|
colorFilter.ForegroundColor = new CellsColor(); |
|
colorFilter.ForegroundColor.Color = color; |
|
colorFilter.ForegroundColor.ThemeColor = new ThemeColor(); |
|
colorFilter.ForegroundColor.ThemeColor.ColorType = "Text2"; |
|
colorFilter.ForegroundColor.ThemeColor.Tint = 1; |
|
colorFilter.ForegroundColor.Type = "Automatic"; |
|
colorFilter.BackgroundColor = new CellsColor(); |
|
colorFilter.BackgroundColor.Color = new Color(); |
|
colorFilter.BackgroundColor.Color.A = 255; |
|
colorFilter.BackgroundColor.Color.R = 255; |
|
colorFilter.BackgroundColor.Color.B = 0; |
|
colorFilter.BackgroundColor.Color.G = 0; |
|
colorFilter.BackgroundColor.ThemeColor = new ThemeColor(); |
|
colorFilter.BackgroundColor.ThemeColor.ColorType = "Text2"; |
|
colorFilter.BackgroundColor.ThemeColor.Tint = 1; |
|
colorFilter.BackgroundColor.Type = "Automatic"; |
|
colorFilter.Pattern = "Solid"; |
|
PutWorksheetColorFilterRequest request = new PutWorksheetColorFilterRequest |
|
{ |
|
name = remoteName, |
|
sheetName = "Sheet1", |
|
fieldIndex = 0, |
|
colorFilter = colorFilter, |
|
matchBlanks = true, |
|
range = "A1:C10", |
|
refresh = true, |
|
folder = remoteFolder |
|
}; |
|
cellsApi.PutWorksheetColorFilter(request); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
} |
|
|
|
|