Cell'den HTML5 dizesini alın
Contents
[
Hide
]
Olası Kullanım Senaryoları
Aspose.Cells, şunu kullanarak hücrenin HTML dizesini döndürürgetHtmlString(boole html5)yöntem. eğer geçersenYANLIŞparametre olarak size Normal HTML döndürür ancak geçersenizdoğruparametre olarak, HTML5 dizesini döndürür.
Cell’den HTML5 dizesini alın
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ı konsolda yazdırır.
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-Java | |
//Create workbook. | |
Workbook wb = new Workbook(); | |
//Access first worksheet. | |
Worksheet ws = wb.getWorksheets().get(0); | |
//Access cell A1 and put some text inside it. | |
Cell cell = ws.getCells().get("A1"); | |
cell.putValue("This is some text."); | |
//Get the Normal and Html5 strings. | |
String strNormal = cell.getHtmlString(false); | |
String strHtml5 = cell.getHtmlString(true); | |
//Print the Normal and Html5 strings on console. | |
System.out.println("Normal:\r\n" + strNormal); | |
System.out.println(); | |
System.out.println("Html5:\r\n" + strHtml5); |
Konsol Çıkışı
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>