Cell'den HTML5 dizesini alın
Contents
[
Hide
]
Cell’den HTML5 dizesini alın
Aspose.Cells for Python via Java kullanarak hücreden HTML dizesini alabilirsiniz. Bu kullanılarak elde edilebilirgetHtmlString(boole html5) API tarafından sağlanan yöntem.YANLIŞparametre olarak size Normal HTML döndürür ancak geçersenizdoğruparametre olarak, HTML5 dizesini döndürür.
Aşağıdaki örnek kod, bir çalışma kitabı nesnesi oluşturur ve ilk çalışma sayfasının A1 hücresine bir miktar metin ekler. Daha sonra A1 hücresinden Normal HTML ve HTML5 dizesini alır.getHtmlString(boole html5) yöntemini kullanır ve bunları yazdırır.
Basit kod
This file contains 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
# Load the Sample Workbook | |
workbook = Workbook() | |
# Access first worksheet | |
worksheet = workbook.getWorksheets().get(0) | |
# Access cell A1 and put some text inside it. | |
cell = worksheet.getCells().get("A1") | |
cell.putValue("This is some text.") | |
# Get the Normal and Html5 strings. | |
strNormal = cell.getHtmlString(False) | |
strHtml5 = cell.getHtmlString(True) | |
# Print the Normal and Html5 strings | |
print("Normal:\r\n" + strNormal) | |
print("Html5:\r\n" + strHtml5) |
Aşağıdaki, yukarıda sağlanan kod parçacığı tarafından üretilen çıktıdır.
Çıktı
Normal:
<Font Style="FONT-FAMILY: Arial;FONT-SIZE: 10pt;COLOR: #000000;">This is some text.</Font>
Html5:
<div Style="FONT-FAMILY: Arial;FONT-SIZE: 10pt;COLOR: #000000;">This is some text.</div>