Yazı Tipi Ayarları

Yazı Tipi Ayarlarını Yapılandırma

Aspose.Cells bir sınıf sağlar,Çalışma kitabı bu bir Microsoft Excel dosyasını temsil eder. buÇalışma kitabı sınıf bir içerirçalışma sayfaları bir Excel dosyasındaki her çalışma sayfasına erişim sağlayan koleksiyon. Bir çalışma sayfası şununla temsil edilir:Çalışma kağıdı sınıf. buÇalışma kağıdı sınıf bir sağlarCells Toplamak. İçindeki her öğeCells koleksiyon bir nesneyi temsil ederCellsınıf.

Aspose.Cells şunları sağlar:Cell sınıf'Stil Al veSetStyle bir hücrenin biçimlendirme stilini almak ve ayarlamak için kullanılan yöntemler. bustilclass, yazı tipi ayarlarını yapılandırmak için özellikler sağlar.

Yazı Tipi Adını Ayarlama

Geliştiriciler, kullanarak herhangi bir yazı tipini bir hücre içindeki metne uygulayabilir.Stil.Yazı Tipi nesneninİsimEmlak.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
// Instantiating a Workbook object
Workbook workbook = new Workbook();
// Adding a new worksheet to the Excel object
int i = workbook.Worksheets.Add();
// Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[i];
// Accessing the "A1" cell from the worksheet
Aspose.Cells.Cell cell = worksheet.Cells["A1"];
// Adding some value to the "A1" cell
cell.PutValue("Hello Aspose!");
// Obtaining the style of the cell
Style style = cell.GetStyle();
// Setting the font name to "Times New Roman"
style.Font.Name = "Times New Roman";
// Applying the style to the cell
cell.SetStyle(style);
// Saving the Excel file
workbook.Save(dataDir + "book1.out.xls", SaveFormat.Excel97To2003);

Yazı Tipi Stilini Kalın Olarak Ayarlama

Geliştiriciler,Stil.Yazı Tipi nesneninKalın mı mülkiyetdoğru.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Instantiating a Workbook object
Workbook workbook = new Workbook();
// Adding a new worksheet to the Excel object
int i = workbook.Worksheets.Add();
// Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[i];
// Accessing the "A1" cell from the worksheet
Aspose.Cells.Cell cell = worksheet.Cells["A1"];
// Adding some value to the "A1" cell
cell.PutValue("Hello Aspose!");
// Obtaining the style of the cell
Style style = cell.GetStyle();
// Setting the font weight to bold
style.Font.IsBold = true;
// Applying the style to the cell
cell.SetStyle(style);
// Saving the Excel file
workbook.Save("out.xlsx");

Yazı Tipi Boyutunu Ayarlama

ile yazı tipi boyutunu ayarlayın.Stil.Yazı TipinesneninBoyEmlak.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Instantiating a Workbook object
Workbook workbook = new Workbook();
// Adding a new worksheet to the Excel object
int i = workbook.Worksheets.Add();
// Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[i];
// Accessing the "A1" cell from the worksheet
Aspose.Cells.Cell cell = worksheet.Cells["A1"];
// Adding some value to the "A1" cell
cell.PutValue("Hello Aspose!");
// Obtaining the style of the cell
Style style = cell.GetStyle();
// Setting the font size to 14
style.Font.Size = 14;
// Applying the style to the cell
cell.SetStyle(style);
// Saving the Excel file
workbook.Save("out.xlsx");

Yazı Tipi Rengini Ayarlama

KullanStil.Yazı Tipi nesneninRenkyazı tipi rengini ayarlama özelliği. Renk numaralandırmasından (.NET çerçevesinin bir parçası) herhangi bir rengi seçin ve onuRenkEmlak.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Instantiating a Workbook object
Workbook workbook = new Workbook();
// Adding a new worksheet to the Excel object
int i = workbook.Worksheets.Add();
// Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[i];
// Accessing the "A1" cell from the worksheet
Aspose.Cells.Cell cell = worksheet.Cells["A1"];
// Adding some value to the "A1" cell
cell.PutValue("Hello Aspose!");
// Obtaining the style of the cell
Style style = cell.GetStyle();
// Setting the font color to blue
style.Font.Color = Color.Blue;
// Applying the style to the cell
cell.SetStyle(style);
// Saving the Excel file
workbook.Save("out.xlsx");

Yazı Tipi Altı Çizili Tipini Ayarlama

KullanStil.Yazı TipinesneninAltını çizmekmetnin altını çizme özelliği. Aspose.Cells, önceden tanımlanmış çeşitli alt çizgili yazı tipleri sunar.FontUnderlineType numaralandırma.

Alt Çizgi Tipleri Açıklama
Muhasebe Tek bir muhasebe alt çizgisi
Çift Çift alt çizgi
Çift Muhasebe Çift hesap altı çizili
Hiçbiri Alt çizgi yok
Bekar Tek bir alt çizgi
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
// Instantiating a Workbook object
Workbook workbook = new Workbook();
// Adding a new worksheet to the Excel object
int i = workbook.Worksheets.Add();
// Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[i];
// Accessing the "A1" cell from the worksheet
Aspose.Cells.Cell cell = worksheet.Cells["A1"];
// Adding some value to the "A1" cell
cell.PutValue("Hello Aspose!");
// Obtaining the style of the cell
Style style = cell.GetStyle();
// Setting the font to be underlined
style.Font.Underline = FontUnderlineType.Single;
// Applying the style to the cell
cell.SetStyle(style);
// Saving the Excel file
workbook.Save(dataDir + "out.xlsx");

Üstü Çizili Efekti Ayarlama

Ayarlayarak üstü çizili uygulaStil.Yazı Tipi nesneninÜstü çizili mimülkiyetdoğru.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Instantiating a Workbook object
Workbook workbook = new Workbook();
// Adding a new worksheet to the Excel object
int i = workbook.Worksheets.Add();
// Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[i];
// Accessing the "A1" cell from the worksheet
Aspose.Cells.Cell cell = worksheet.Cells["A1"];
// Adding some value to the "A1" cell
cell.PutValue("Hello Aspose!");
// Obtaining the style of the cell
Style style = cell.GetStyle();
// Setting the strike out effect on the font
style.Font.IsStrikeout = true;
// Applying the style to the cell
cell.SetStyle(style);
// Saving the Excel file
workbook.Save(dataDir + "out.xlsx");

Abonelik Etkisini Ayarlama

ayarlayarak alt simgeyi uygulaStil.Yazı TipinesneninIsSubScript mülkiyetdoğru.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Instantiating a Workbook object
Workbook workbook = new Workbook();
// Adding a new worksheet to the Excel object
int i = workbook.Worksheets.Add();
// Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[i];
// Accessing the "A1" cell from the worksheet
Aspose.Cells.Cell cell = worksheet.Cells["A1"];
// Adding some value to the "A1" cell
cell.PutValue("Hello Aspose!");
// Obtaining the style of the cell
Style style = cell.GetStyle();
// Setting subscript effect
style.Font.IsSubscript = true;
// Applying the style to the cell
cell.SetStyle(style);
// Saving the Excel file
workbook.Save(dataDir + "out.xlsx");

Yazı Tipinde Üst Simge Efekti Ayarlama

Geliştiriciler, üst simge efektini yazı tipine ayarlayarak uygulayabilir.üst simge mülkiyetiStil.Yazı Tipi itiraz etmekdoğru.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Instantiating a Workbook object
Workbook workbook = new Workbook();
// Adding a new worksheet to the Excel object
int i = workbook.Worksheets.Add();
// Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[i];
// Accessing the "A1" cell from the worksheet
Aspose.Cells.Cell cell = worksheet.Cells["A1"];
// Adding some value to the "A1" cell
cell.PutValue("Hello Aspose!");
// Obtaining the style of the cell
Style style = cell.GetStyle();
// Setting superscript effect
style.Font.IsSuperscript = true;
// Applying the style to the cell
cell.SetStyle(style);
// Saving the Excel file
workbook.Save(dataDir + "out.xlsx");

ileri konular