When I try to Open & Save an HTML file as Excel in XLSX format, it looses the color and border formatting. How can I fix it? Please see my code below -
string htmlContent = System.IO.File.ReadAllText(TemplateFilePath);
htmlContent = htmlContent.Replace("##TABLECONTENT##", “
”);
Name |
---|
James |
System.IO.File.WriteAllText(TemplateFilePath, htmlContent);
using (FileStream fileStream = new FileStream(TemplateFilePath, FileMode.Open))
{
HTMLLoadOptions options = new HTMLLoadOptions(LoadFormat.Html);
Workbook wb = new Workbook(fileStream, options);
wb.Save(Path.Combine(OutputFilePath, ReportFileName), SaveFormat.Xlsx);
}