This is a migrated thread and some comments may be shown as answers.

ExceL ML not working

3 Answers 84 Views
Grid
This is a migrated thread and some comments may be shown as answers.
AG
Top achievements
Rank 1
AG asked on 31 May 2011, 04:44 PM
I am trying to generate Excel ML Export file but no cell is getting created. It is generating file with empty rows. Any ideas ?

3 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 31 May 2011, 05:05 PM
Hello AG,

Judging by the provided information, you have to set UseAllDataFields to true as explained in our documentation:
ExcelML basics

Kind regards,
Daniel
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
AG
Top achievements
Rank 1
answered on 31 May 2011, 06:56 PM
Thanks, it worked ! Another question , how to set decimal places in excel  and gridlines around it.



Regards,
0
Daniel
Telerik team
answered on 31 May 2011, 09:12 PM
Hello AG,

Question 1: How to set decimal places:

Create your own style on ExcelMLExportStylesCreated
protected void RadGrid1_ExcelMLExportStylesCreated(object source, GridExportExcelMLStyleCreatedArgs e)
{
    StyleElement myStyle = new StyleElement("myCustomStyle");
    myStyle.NumberFormat.FormatType = NumberFormatType.Currency;  //Option 1: Predefined number format
    //   myStyle.NumberFormat.Attributes["ss:Format"] = "MM/dd";  // Option 2: Custom format
    myStyle.FontStyle.Bold = true;
    e.Styles.Add(myStyle);
}

Assign this style to the desired cells on ExcelMLExportRowCreated :
protected void RadGrid1_ExcelMLExportRowCreated(object source, GridExportExcelMLRowCreatedArgs e)
{
    e.Row.Cells.GetCellByName("Name").StyleValue = "myCustomStyle";
}

For more information please examine the following link:
ExcelML basics

Question 2: How to set gridlines:
protected void RadGrid1_ExcelMLExportStylesCreated(object source, GridExcelBuilder.GridExportExcelMLStyleCreatedArgs e)
{
    StyleElement cstyle = new StyleElement("MyCustomStyle");
    BorderStylesCollection borders = new BorderStylesCollection();
    BorderStyles borderStyle;
    for (int i = 1; i <= 4; i++) //four borders  
    {
        borderStyle = new BorderStyles();
        borderStyle.PositionType = (PositionType)i;
        borderStyle.Color = System.Drawing.Color.Black;
        borderStyle.LineStyle = LineStyle.Continuous;
        borderStyle.Weight = 1.0;
        borders.Add(borderStyle);
    }
    foreach (BorderStyles border in borders)
        cstyle.Borders.Add(border);
    e.Styles.Add(cstyle);
}

Regards,
Daniel
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
AG
Top achievements
Rank 1
Answers by
Daniel
Telerik team
AG
Top achievements
Rank 1
Share this question
or