Hücreden HTML5 dizesi al
Olası Kullanım Senaryoları
Aspose.Cells for Python via .NET, bir boolean parametre alan get_html_string(html5) yöntemini kullanarak hücrenin HTML dizesini döndürür. Parametre olarak false geçirirseniz Normal HTML döndürür, ancak true geçirirseniz HTML5 dizesini döndürür.
Hücreden HTML5 dizesi al
Aşağıdaki örnek kod, bir çalışma kitabı nesnesi oluşturur ve ilk çalışsayısının A1 hücresine bazı metinler ekler. Ardından, A1 hücresinden Normal HTML ve HTML5 dizelerini get_html_string(html5) yöntemini kullanarak alır ve bunları konsola yazdırır.
Örnek Kod
from aspose.cells import Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# Create workbook. | |
wb = Workbook() | |
# Access first worksheet. | |
ws = wb.worksheets[0] | |
# Access cell A1 and put some text inside it. | |
cell = ws.cells.get("A1") | |
cell.put_value("This is some text.") | |
# Get the Normal and Html5 strings. | |
strNormal = cell.get_html_string(False) | |
strHtml5 = cell.get_html_string(True) | |
# Print the Normal and Html5 strings on console. | |
print("Normal:\r\n" + strNormal) | |
print() | |
print("Html5:\r\n" + strHtml5) |
Konsol Çıktısı
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>