Çalışma Sayfasında Yorum veya Şeklin Kenar Boşluklarını Ayarlama
Contents
[
Hide
]
Olası Kullanım Senaryoları
Aspose.Cells, herhangi bir şeklin veya yorumun kenar boşluklarınıShape.TextBody.TextAlignment Emlak. Bu özellik, nesnesini döndürürAspose.Cells.Drawing.Texts.ShapeTextAlignment örneğin farklı özelliklere sahip sınıfÜstMarjPt, SolMarginPt, AltKenarPt, SağMarginPtvb. üst, sol, alt ve sağ kenar boşluklarını ayarlamak için kullanılabilir.
Çalışma Sayfasında Yorum veya Şeklin Kenar Boşluklarını Ayarlama
Lütfen aşağıdaki örnek koda bakın. o yüklerörnek excel dosyası iki şekil içerir. Kod, şekillere tek tek erişir ve üst, sol, alt ve sağ kenar boşluklarını ayarlar. Lütfen bkzçıktı excel dosyası kod tarafından oluşturulan ve kodun çıktı Excel dosyası üzerindeki etkisini gösteren ekran görüntüsü.
Basit kod
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
//Load the sample Excel file | |
Workbook wb = new Workbook("sampleSetMarginsOfCommentOrShapeInsideTheWorksheet.xlsx"); | |
//Access first worksheet | |
Worksheet ws = wb.Worksheets[0]; | |
foreach (Shape sh in ws.Shapes) | |
{ | |
//Access the text alignment | |
Aspose.Cells.Drawing.Texts.ShapeTextAlignment txtAlign = sh.TextBody.TextAlignment; | |
//Set auto margin false | |
txtAlign.IsAutoMargin = false; | |
//Set the top, left, bottom and right margins | |
txtAlign.TopMarginPt = 10; | |
txtAlign.LeftMarginPt = 10; | |
txtAlign.BottomMarginPt = 10; | |
txtAlign.RightMarginPt = 10; | |
} | |
//Save the output Excel file | |
wb.Save("outputSetMarginsOfCommentOrShapeInsideTheWorksheet.xlsx"); |