Cell Değerinin Metin Genişliğini Alın
Contents
[
Hide
]
Cell Değerinin Metin Genişliğini Alın
Bazen geliştiricilerin, verileri bir düzende düzenlemek için hücrenin değerinin genişliğini hesaplaması gerekebilir. Aspose.Cells şunları sağlar:CellsHelper.GetTextWidth geliştiricilerin hücrenin değerinin metin genişliğini almasına izin veren yöntem. Aşağıdaki örnek kod, nasıl kullanılacağını gösterirCellsHelper.GetTextWidth hücrenin değerinin metin genişliğine erişmek için.
Aşağıdaki kod parçacığında kullanılan Kaynak dosyası, referansınız için eklenmiştir.
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-Java | |
// The path to the output directory. | |
String sourceDir = Utils.Get_SourceDirectory();Workbook workbook = new Workbook(sourceDir + "GetTextWidthSample.xlsx"); | |
System.out.println("Text width: " + CellsHelper.getTextWidth(workbook.getWorksheets().get(0).getCells().get("A1").getStringValue(), workbook.getDefaultStyle().getFont(), 1)); |