For exporting to Excel copy and paste the below event handler into MainPage.xaml.cs. Here we’re using the AutomationFactory to create an instance of Excel. Then we construct a worksheet.
Write this code in the Code Behind!
void ExcelButton_Click(object sender, RoutedEventArgs e)
{
dynamic excel = AutomationFactory.CreateObject("Excel.Application");
excel.Visible = true;
dynamic workbook = excel.workbooks;
workbook.Add();
dynamic sheet = excel.ActiveSheet;
dynamic cell = null;
int i = 1;
foreach (var item in (LayoutRoot.DataContext as Bookmarks).Sites)
{
cell = sheet.Cells[i, 1];
cell.Value = item.Title;
cell = sheet.Cells[i, 2];
cell.Value = item.Uri;
cell.ColumnWidth = 100;
i++;
}
}