Lägger till HTML Rich Text i Cell
Contents
[
Hide
]
Aspose.Cells stöder konvertering av Microsoft Excel-orienterad HTML till XLS/XLSX-format. Det betyder att HTML som genereras av Microsoft Excel kan konverteras tillbaka till XLS/XLSX-formatet med Aspose.Cells.
På samma sätt, om det finns en enkel HTML, kan Aspose.Cells konvertera den till HTML Rich Text. Aspose.Cells tillhandahållerCell.HtmlString egenskap som kan ta en så enkel HTML och konvertera den till formaterad celltext.
Nedan kodexempel visar hur du lägger till HTML rich text inuti cellen. Se skärmdumpen av den utgående Excel-filen.
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
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
Workbook workbook = new Workbook(); | |
Worksheet worksheet = workbook.Worksheets[0]; | |
Cell cell = worksheet.Cells["A1"]; | |
cell.HtmlString = "<Font Style=\"FONT-WEIGHT: bold;FONT-STYLE: italic;TEXT-DECORATION: underline;FONT-FAMILY: Arial;FONT-SIZE: 11pt;COLOR: #ff0000;\">This is simple HTML formatted text.</Font>"; | |
workbook.Save(dataDir + "output_out.xlsx"); |