Hücreden HTML5 dizesi al
Olası Kullanım Senaryoları
Aspose.Cells, hücrenin HTML dizesini getHtmlString(boolean html5) yöntemini kullanarak döndürür. Bir parametre olarak false geçirirseniz, Normal HTML’u döndürecek ancak true geçirirseniz, HTML5 dizesini döndürecektir.
Hücreden HTML5 dizesi al
Aşağıdaki örnek kod bir çalışma kitabı nesnesi oluşturur ve ilk çalışma sayfasının A1 hücresine bazı metinler ekler. Ardından getHtmlString(boolean html5) yöntemini kullanarak A1 hücresinden Normal HTML ve HTML5 dizesi alır ve bunları konsola yazdırır.
Örnek Kod
// 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 Çı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>