Hi Chong,
Thanks for using Syncfusion products.
We would like to let you know that your requirement has been achieved by using the string values within the HTML Tag. Please refer the below code snippets.
[CS]
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
GetData();
}
public void GetData()
{
List<MyClass> list= new List<MyClass>();
list.Add(new MyClass(1,Convert.ToDateTime("10/11/2010"),"<i><font color=\"Red\"> Html Tag </font></i>","<b>aaaa</b>",2322));
list.Add(new MyClass(2, Convert.ToDateTime("11/12/2011"), "<i><font color=\"Red\"> Html Tag </font></i>", "<b>bbbb</b>", 2323));
list.Add(new MyClass(3, Convert.ToDateTime("12/10/2012"), "<i><font color=\"Red\"> Html Tag </font></i>", "<b>cccc</b>", 2324));
list.Add(new MyClass(4, Convert.ToDateTime("07/08/2013"), "<i><font color=\"Red\"> Html Tag </font></i>", "<b>dddd</b>", 2325));
list.Add(new MyClass(5, Convert.ToDateTime("05/07/2014"), "<i><font color=\"Red\"> Html Tag </font></i>", "<b>eeee</b>", 2326));
this.ggc.DataSource=list;
this.ggc.DataBind();
}
For your convenience we have attached simple sample with the above code snippet please refer the below link. We suspect that this is your requirement, if not, could you please give more information about your exact requirement. So, that we could provide a better solution quickly.
Regards,
Shanmugaraja KHi Chong,
Thanks for your update.
Query 1: Excel Export with Html styling.
We have analysed your requirement. Currently we don’t have support for the feature “Exporting HTML style to Excel Cell”. This is confirmed as a feature request and it will be available in our future volume releases. The feature implementation would also greatly depend on the factors such as product design, code compatibility and complexity. We do not provide confidential information in general forum. Please create new incident in Direct-Trac for better follow up.
Query 2: Excel Export with Date/Number formatting.
We would like to let you know that your requirement has been achievd by handling “ExportExcelCellHandler” event. Please refer the below code snippets.
[CS]
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
GetData();
this.ggc.TableDescriptor.Columns[1].Appearance.AnyCell.Format = "yyyy/MM/dd";
this.ggc.TableDescriptor.Columns[2].Appearance.AnyCell.Format = "$####.##";
}
…..
protected void Button1_Click(object sender, EventArgs e)
{
GridExcelExport excelExport = new GridExcelExport(this.ggc, "ExcelExport.xls");
excelExport.ExportNestedTable = true;
excelExport.FormatExcelCellHandler += new ExportExcelCellHandler(excelExport_FormatExcelCellHandler);
excelExport.Export();
}
void excelExport_FormatExcelCellHandler(object sender, ExcelExportEventArgs e)
{
if (e.RowElement.IsRecord() && e.ExcelCell.Column == 2) // condition to check the record and column as 2th column(Date column)
{
e.ExcelCell.Cells[0].NumberFormat = "yyyy/MM/dd";
}
if (e.RowElement.IsRecord() && e.ExcelCell.Column == 3) // condition to check the record and column as 3rd column(Number column)
{
e.ExcelCell.Cells[0].NumberFormat = "$####.##";
}
}
For your convenience we have created simple sample and the same can be downloaded from the following link.
Sample link: http://www.syncfusion.com/downloads/support/directtrac/117875/Format_Export416113412.zip
Please let us know if you need further assistance.
Regards,
Shanmugaraja K