Completed
Last Updated: 09 Mar 2015 13:05 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 25 Feb 2015 14:31
Category: GridView
Type: Bug Report
0
FIX. RadGridView - SpreadExport should create a Workbook with font "Calibri, 11" instead of "Calibri, 14"
To reproduce:
            string fileName = @"..\..\..\exported" + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".xlsx";
            SpreadExport spreadExporter = new SpreadExport(radGridView1);
            spreadExporter.ExportVisualSettings = false;      
            spreadExporter.RunExport(fileName);


Workaround:
spreadExporter.WorkbookCreated += spreadExporter_WorkbookCreated;
private void spreadExporter_WorkbookCreated(object sender, WorkbookCreatedEventArgs e)
{

    Telerik.Windows.Documents.Spreadsheet.PropertySystem.CellStyle defaultStyle = e.Workbook.Styles.Add("DefaultStyle");
    defaultStyle.FontSize = Telerik.Windows.Documents.Spreadsheet.Utilities.UnitHelper.PointToDip(11);
    Telerik.Windows.Documents.Spreadsheet.Model.Worksheet sheet = e.Workbook.Worksheets.First();
    sheet.Cells[0, 0, sheet.UsedCellRange.RowCount, sheet.UsedCellRange.ColumnCount].SetStyleName("DefaultStyle");
    sheet.Columns[sheet.UsedCellRange].AutoFitWidth();
}

0 comments