Hi.
I tried to use ExportToXlsx to export a grid to Excel. I used your example (below), but it will only export the last item of the grid. Do you have any idea what can be wrong? I have sold it by using Spreadsheet and building the xlsx by looping through each item, but it would be nicer and easier to use ExportToXlsx.
- Odd
string
extension =
"xlsx"
;
SaveFileDialog dialog =
new
SaveFileDialog()
{
DefaultExt = extension,
FileName =
"GiekExport.xlsx"
,
Filter = String.Format(
"{1} files (*.{0})|*.{0}|All files (*.*)|*.*"
, extension,
"Excel"
),
FilterIndex = 1
};
if
(dialog.ShowDialog() ==
true
)
{
using
(Stream stream = dialog.OpenFile())
{
GiekExcelGrid.ExportToXlsx(stream,
new
GridViewDocumentExportOptions()
{
ShowColumnFooters =
false
,
ShowColumnHeaders =
true
,
ShowGroupFooters =
false
,
AutoFitColumnsWidth =
true
});
}
}