Excel 포맷 셀

사용성은 사람이 프로그램, 웹사이트 또는 장치와 얼마나 잘 상호 작용할 수 있는지를 설명하는 용어입니다. 사용성을 높이는 요인에는 학습 용이성과 사용 효율성이 있습니다. 색상을 사용하여 여러 가지 방법으로 스프레드시트의 사용성을 높일 수 있습니다. 예를 들어, 값이 1000을 초과하는 스프레드시트의 모든 셀을 식별해야 하는 경우 Excel에 해당 셀을 빨간색으로 칠하도록 지시하여 작업을 더 쉽게 할 수 있습니다. 그러면 사람들이 몇 초 만에 식별할 수 있습니다. 스프레드시트의 행 색상을 통해 전문적인 모양을 제공하고 더 읽기 쉽게 만들 수 있습니다. 또한 스타일은 통합 문서의 모든 제목이 동일하게 보이도록 하려는 경우에 유용합니다.

색상은 또한 관련 정보 그룹을 눈으로 인식할 수 있게 하여 데이터를 보다 효과적으로 시각화하는 데 도움이 됩니다. 게다가 스타일을 사용하여 워크시트와 워크북에 일관된 서식을 포함하도록 도울 수 있습니다.

워크시트 처리를 위한 클라우드 API

Aspose.Cells Cloud API는 로컬 시스템 및 클라우드에서 호스팅되는 MS Excel 및 OpenOffice 스프레드시트를 만들고 조작하는 기능을 제공합니다. 워크시트를 처리하기 위해 MS Office 또는 OpenOffice를 포함한 소프트웨어를 설치할 필요가 없으며 모든 처리가 Cloud API를 사용하여 수행됩니다. 모든 새로운 릴리스에서 우리는 제품의 안정성을 높이기 위해 노력하고 있으며 API를 더욱 강력하게 만드는 새로운 기능을 도입하기 위해 노력하고 있습니다. 따라서 Aspose.Cells Cloud 20.7의 최근 릴리스에서 통합 문서 생성, 셀 특성 설정, 셀 범위 값 가져오기 및 셀 스타일 게시와 관련된 기능을 크게 개선했습니다.

C#을 사용하여 통합 문서 만들기

API는 더 적은 코드 줄을 사용하여 Excel 워크시트를 만드는 기능을 제공합니다. 단 하나의 코드 줄만으로도 기존 Excel 워크북에 새 워크시트를 추가할 수 있습니다. 아래 코드 조각은 샘플 Excel 워크북을 만들고, 두 번째 인덱스에 Excel 워크시트를 추가하고, 결과 파일을 클라우드 스토리지에 저장하는 단계를 보여줍니다.

string MyAppKey = "xxxxxxxx";    // Get AppKey from https://dashboard.aspose.cloud/
string MyAppSid = "xxxxxxxxx";   // Get AppSID from https://dashboard.aspose.cloud/
// 전체 예는 https://github.com/aspose-cells-cloud/aspose-cells-cloud-dotnet에서 확인할 수 있습니다.
// Cells Cloud API 인스턴스를 생성합니다.
CellsApi instance = new CellsApi(MyAppSid, MyAppKey);
// 결과 파일의 이름을 지정하세요
string name = "NewBook" + DateTime.Now.ToString("yymmddhhmiss") + ".xlsx";
// Excel 파일을 클라우드 저장소에 저장
instance.CellsWorkbookPutWorkbookCreate(name);
// 두 번째 위치에 워크시트 추가
instance.CellsWorksheetsPutAddNewWorksheet(name, "Sheet2", 2);

셀 범위 값 가져오기

API는 명명된 범위에 따라 셀 데이터를 페치, 추가 또는 업데이트하는 기능을 제공합니다. 최근 릴리스에서 API는 워크시트 셀에서 범위 값을 가져오도록 개선되었습니다.

string MyAppKey = "xxxxxxxx";    // Get AppKey from https://dashboard.aspose.cloud/
string MyAppSid = "xxxxxxxxx";   // Get AppSID from https://dashboard.aspose.cloud/
// 전체 예는 https://github.com/aspose-cells-cloud/aspose-cells-cloud-dotnet에서 확인할 수 있습니다.
// Cells Cloud API 인스턴스를 생성합니다.
CellsApi instance = new CellsApi(MyAppSid, MyAppKey);
string name = "NewBook2056160256i53.xlsx";
string sheetName = "Sheet1";
int? firstRow = 0;
int? firstColumn = 0;
int? rowCount = 3;
int? columnCount = 2;
var response = instance.CellsRangesGetWorksheetCellsRangeValue(name, sheetName, null, firstRow, firstColumn, rowCount, columnCount);
NUnit.Framework.Assert.AreEqual(response.Code, 200);

var rangeName = "A1:B3";
response = instance.CellsRangesGetWorksheetCellsRangeValue(name, sheetName, rangeName, null, null, null, null);
NUnit.Framework.Assert.AreEqual(response.Code, 200);

rangeName = "MyRange";
response = instance.CellsRangesGetWorksheetCellsRangeValue(name, sheetName, rangeName, null, null, null, null);
NUnit.Framework.Assert.AreEqual(response.Code, 200);

셀에 서식 있는 텍스트 서식 적용

개별 셀에는 데이터가 포함되어 있으며 각 셀의 데이터를 적절히 구분하기 위해 각 셀에 대한 특정 서식 스타일을 적용할 수 있습니다. API는 또한 Excel 워크시트 셀에 대한 서식 있는 텍스트 서식을 설정하는 기능을 지원합니다. API는 특정 셀에 대한 글꼴 정보를 지정하는 기능을 제공하는 Font 클래스를 제공합니다. 굵게, 기울임꼴, 취소선, 아래 첨자, 위 첨자, 밑줄, 크기, 글꼴 이름과 같은 서식을 설정할 수 있습니다.

string MyAppKey = "xxxxxxxx";    // Get AppKey from https://dashboard.aspose.cloud/
string MyAppSid = "xxxxxxxxx";   // Get AppSID from https://dashboard.aspose.cloud/
// 전체 예는 https://github.com/aspose-cells-cloud/aspose-cells-cloud-dotnet에서 확인할 수 있습니다.

// Cells Cloud API 인스턴스를 생성합니다.
Aspose.Cells.Cloud.SDK.Api.CellsApi cellsApi = new Aspose.Cells.Cloud.SDK.Api.CellsApi(MyAppSid, MyAppKey);

string fileName = "NewBook2056160256i53.xlsx";
String sheetName = "Sheet1";
String cellName = "A3";

Aspose.Cells.Cloud.SDK.Model.Style style = new Aspose.Cells.Cloud.SDK.Model.Style();
Aspose.Cells.Cloud.SDK.Model.Font font = new Aspose.Cells.Cloud.SDK.Model.Font();
font.IsBold = true;
font.Color = new Aspose.Cells.Cloud.SDK.Model.Color() { A = 10, R = 120, G = 200, B = 230 };
font.Size = 16;

Aspose.Cells.Cloud.SDK.Model.ThemeColor themeColor = new Aspose.Cells.Cloud.SDK.Model.ThemeColor();
themeColor.ColorType = "Text2";
themeColor.Tint = 2;
style.BackgroundThemeColor = themeColor;
style.Font = font;            

try
{
    // Aspose.Cells Cloud SDK API를 호출하여 셀 스타일을 변경합니다.
    Aspose.Cells.Cloud.SDK.Model.StyleResponse apiResponse = cellsApi.CellsPostUpdateWorksheetCellStyle(fileName, sheetName, cellName, style);

    if (apiResponse != null && apiResponse.Status.Equals("OK"))
    {
        Console.WriteLine("Change Cell Style in Excel Worksheet, Done!");
        Console.ReadKey();
    }
}
catch (Exception ex)
{
    System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
코드 실행 후 Excel 셀 서식이 업데이트됨

그림 1: 코드 실행 후 셀 서식이 업데이트되었습니다.

관련기사

자세한 내용은 다음 기사를 참조하세요.