FineUI 官方论坛
标题:
能否增加对Aspose.Cells的支持
[打印本页]
作者:
就让云飘过
时间:
2014-8-12 09:44
标题:
能否增加对Aspose.Cells的支持
本帖最后由 就让云飘过 于 2014-8-12 09:47 编辑
在用finui导出数据表时,示例页面“grid_excel.aspx”,导出文件用excel2010打开,总是提示“文件格式或扩展名不匹配。文件可能已损坏或不安全。除服您信任其来源,否则请勿打开。是否仍要打开它”。这应该是存储excel文件采用html样式存储的缘故。
尝试使用Aspose.Cells组件进行导出,去发现改组件与fineui兼容不好。不能使用finuibutton,只能如下面格式使用:
<
x
:
ContentPanel
ID
=
"ContentPanel1"
runat
=
"Server"
ShowBorder
=
"false"
ShowHeader
=
"false"
> <
asp
:
Button
ID
=
"btnExport"
runat
=
"server"
OnClick
=
"btnExport_Click"
Text
=
"导出"
></
asp
:
Button
></
x
:
ContentPanel
>
后台也要进行修改
protected
override
void
btnExport_Click
(
object
sender
,
EventArgs
e
) {
try
{
DataTable
dt
=
ListFactory
.
Fetch
(
string
.
Format
(
"Select * From V_Details Where ParentId='{0}'"
,
this
.
Id
));
dt
.
TableName
=
"V_Details"
;
WorkbookDesigner
designer
=
new
WorkbookDesigner
();
designer
.
Open
(
MapPath
(
"../Template/明细.xls"
));
//数据源
designer
.
SetDataSource
(
dt
);
//导出日期
designer
.
SetDataSource
(
"Supplier"
,
dt
.
Rows
[
0
][
9
]);
designer
.
SetDataSource
(
"ReportDate"
,
DateTime
.
Now
.
ToString
(
"yyyy年MM月dd日"
));
designer
.
Process
();
designer
.
Save
(
string
.
Format
(
"{0}.xls"
,
"补货单"
),
SaveType
.
OpenInExcel
,
FileFormatType
.
Excel2003
,
Response
);
Response
.
Flush
();
Response
.
Close
();
designer
=
null
;
//Response.End();
HttpContext
.
Current
.
ApplicationInstance
.
CompleteRequest
();
}
catch
(
Exception
ex
)
{
throw
new
Exception
(
ex
.
Message
);
}
}
Response.End();不能使用,必须修改为 HttpContext.Current.ApplicationInstance.CompleteRequest();
这样在使用很不方便,各位大能,能否设计一个兼容Aspose.Cells组件的导出功能,谢谢!
并请也更新V3.3版本,没有找到一键直升V4的工具,升不了级,谢谢!
欢迎光临 FineUI 官方论坛 (https://fineui.com/BBS/)
Powered by Discuz! X3.4