不允许文件操作。保存对话框中拒绝访问路径'''对话。打开文件()

时间:2013-10-31 08:46:43

标签: c# excel silverlight internet-explorer windows-8

我正在使用excellite lib在Silverlight 4中导出excel,它在Windows 7中工作查找,这里的问题是,相同的应用程序导出excel在Windows 8 IE中不起作用,它会抛出一个错误sDialog.OpenFile(),但它在windows 8 chrome中工作正常。

  

不允许进行文件操作。访问路径''被拒绝

void exportExcel_Click(object sender, RoutedEventArgs e)
{
    SaveFileDialog sDialog = new SaveFileDialog();
    sDialog.Filter = "Excel Files(*.xls)|*.xls";
    if (sDialog.ShowDialog() == true)
    {
        Workbook workbook = new Workbook();
        Worksheet worksheet = new Worksheet("Friends");
        // write data in worksheet cells
        worksheet.Cells[0, 0] = new Cell("Column1");
        worksheet.Cells[0, 1] = new Cell("Column2");
        worksheet.Cells[0, 2] = new Cell("Column3");
        worksheet.Cells[1, 0] = new Cell("string value");
        worksheet.Cells[1, 1] = new Cell(478574.5, "#,###.00");
        worksheet.Cells[1, 2] = new Cell(4);
        workbook.Worksheets.Add(worksheet);
        using (var stream = sDialog.OpenFile())
        {
            workbook.Save(stream);
        }
    }
}

Windows 8 IE有这个限制,或者我做错了什么?

0 个答案:

没有答案