Hello,
we are trying to export a Grid to Excel. This works fine, but since we are using percentage based width for some columns, this percentage ("30%") gets turned into a pixel count (30px), which in turn makes the Excel column way too small.
Is there a way to set a better width, or an automatic "Be as big as you need to be in Excel" for the export?
@(Html.Kendo().Grid<BusinessObjectLayer.BusinessObjects.CategoryOfCostBusinessObject>()
.Name(
"CategoryGrid"
)
.Columns(columns =>
{
columns.Bound(p => p.Title).Width(
"30%"
);
columns.Bound(p => p.Rate).Width(70);
columns.Bound(p => p.Description).ClientTemplate(
"#: convertHtmlString(Description, 50)#"
);
columns.Command(command => { command.Edit().Text(
" "
); command.Destroy().Text(
" "
); }).Width(88);
})
.ToolBar(toolbar => { toolbar.Create().Text(
"Add Category"
); toolbar.Excel().HtmlAttributes(
new
{ @
class
=
"pull-right"
}).Text(
" Export to Excel"
); })
.Excel(excel => excel
.FileName(
"Categories.xlsx"
)
.Filterable(
true
)
.AllPages(
true
)
.ProxyURL(Url.Action(
"ExcelExport"
,
"Category"
))
)
Thanks for your help,
Klaus