Cells'in HTML Dize Değerini DataTable'a aktarın
Contents
[
Hide
]
Olası Kullanım Senaryoları
Aspose.Cells API’lerini kullanan geliştiriciler, çalışma sayfası verilerini dışa aktarırken bir DataTable’ı karşılık gelen HTML dizeleriyle (hücre değerlerine dayalı olarak) doldurabilir. Bu belge, Aspose.Cells API’leri kullanılarak bir DataTable’ı doldurmak üzere biçimlendirilmiş hücreler verileri için HTML dizelerinin nasıl dışa aktarılacağını açıklar.
Cells’in HTML Dize Değerini DataTable’a aktarın
Aşağıdaki örnek kod, çalışma sayfasından DataTable’a veri aktarılırken hücrelerin HTML dize değerinin DataTable’a nasıl aktarılacağını gösterir. Lütfen bkzörnek excel dosyası, ekran görüntüsü ve referans için konsol çıktısı.
Ekran görüntüsü
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-.NET | |
//Load sample Excel file | |
Workbook wb = new Workbook(sourceDir + "sampleExportTableAsHtmlString.xlsx"); | |
//Access first worksheet | |
Worksheet ws = wb.Worksheets[0]; | |
//Specify export table options and set ExportAsHtmlString to true | |
ExportTableOptions opts = new ExportTableOptions(); | |
opts.ExportColumnName = false; | |
opts.ExportAsHtmlString = true; | |
//Export the cells data to data table with the specified export table options | |
DataTable dt = ws.Cells.ExportDataTable(0, 0, 3, 3, opts); | |
//Print the cell html string value that is in third row and second column | |
Console.WriteLine(dt.Rows[2][1].ToString()); |
Konsol Çıkışı
<Font Style="FONT-FAMILY: Calibri;FONT-SIZE: 11pt;COLOR: #00b0f0;Background-Color: #ffe699;">Crow</Font>