我正在使用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 有这个限制或者我做错了什么?