Kenar Boşluklarını Ayarlama

Kenar Boşluklarını Ayarlama

Aspose.Cells bir sınıf sağlar,Çalışma kitabı , bu bir Excel dosyasını temsil eder. buÇalışma kitabı sınıf içerirçalışma sayfaları 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 sağlarSayfa ayarı bir çalışma sayfası için sayfa düzeni seçeneklerini ayarlamak için kullanılan özellik. buSayfa ayarı öznitelik bir nesnedirSayfa ayarı geliştiricilerin yazdırılan bir çalışma sayfası için farklı sayfa düzeni seçenekleri belirlemesine olanak tanıyan sınıf. buSayfa ayarıclass, sayfa düzeni seçeneklerini ayarlamak için kullanılan çeşitli özellikler ve yöntemler sağlar.

Sayfa Kenar Boşlukları

kullanarak sayfa kenar boşluklarını (sol, sağ, üst, alt) ayarlayın.Sayfa ayarısınıf üyeleri. Sayfa kenar boşluklarını belirtmek için kullanılan yöntemlerden birkaçı aşağıda listelenmiştir:

// 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 a workbook object
Workbook workbook = new Workbook();
// Get the worksheets in the workbook
WorksheetCollection worksheets = workbook.Worksheets;
// Get the first (default) worksheet
Worksheet worksheet = worksheets[0];
// Get the pagesetup object
PageSetup pageSetup = worksheet.PageSetup;
// Set bottom,left,right and top page margins
pageSetup.BottomMargin = 2;
pageSetup.LeftMargin = 1;
pageSetup.RightMargin = 1;
pageSetup.TopMargin = 3;
// Save the Workbook.
workbook.Save(dataDir + "SetMargins_out.xls");

Sayfada Ortala

Bir sayfada bir şeyi yatay ve dikey olarak ortalamak mümkündür. Bunun için bazı yararlı üyeler var.Sayfa ayarı sınıf,MerkezYatay veMerkezDikey.

// 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 a workbook object
Workbook workbook = new Workbook();
// Get the worksheets in the workbook
WorksheetCollection worksheets = workbook.Worksheets;
// Get the first (default) worksheet
Worksheet worksheet = worksheets[0];
// Get the pagesetup object
PageSetup pageSetup = worksheet.PageSetup;
// Specify Center on page Horizontally and Vertically
pageSetup.CenterHorizontally = true;
pageSetup.CenterVertically = true;
// Save the Workbook.
workbook.Save(dataDir + "CenterOnPage_out.xls");

Üstbilgi ve Altbilgi Kenar Boşlukları

ile üstbilgi ve altbilgi kenar boşluklarını ayarlayın.Sayfa ayarı gibi sınıf üyeleriBaşlık Marjı veAltbilgi Kenar Boşluğu.

// 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 a workbook object
Workbook workbook = new Workbook();
// Get the worksheets in the workbook
WorksheetCollection worksheets = workbook.Worksheets;
// Get the first (default) worksheet
Worksheet worksheet = worksheets[0];
// Get the pagesetup object
PageSetup pageSetup = worksheet.PageSetup;
// Specify Header / Footer margins
pageSetup.HeaderMargin = 2;
pageSetup.FooterMargin = 2;
// Save the Workbook.
workbook.Save(dataDir + "CenterOnPage_out.xls");