Flex下载文件报错Error #2038: 文件 I/O 错误

byby4139 2013-07-02 05:56:21
服务端使用POI生成Excel文件,然后写到流中:
workbook.write(response.getOutputStream());
response.setContentType("application/vnd.ms-excel; charset=UTF-8");
前端使用FileReference.download方式获取服务POI端生成的Excel文件。

生成的2003格式的Excel下载没有问题,但生成2007格式的Excel。Flex报错: Error #2038: 文件 I/O 错误。哪位大牛解决一下
...全文
543 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
kgonihao 2013-07-08
  • 打赏
  • 举报
回复
不清楚你后台用的什么,后台需要导入office 2007的包(很有可能是这里的问题)你最好调试下,前台代码应该没啥子问题:例如:
protected function btn_dload_clickHandler(event:MouseEvent):void
			{
				var SowURL:URLRequest=new URLRequest(TestConstants.SERVER_PATH + "/fileassets/test.ppt");

				var fileR:FileReference=new FileReference();
				fileR.addEventListener(ProgressEvent.PROGRESS, downloadProgress);
				fileR.addEventListener(Event.COMPLETE, drowloadComplete);
				fileR.addEventListener(IOErrorEvent.IO_ERROR, downLoadError);
				configFileDownload(fileR);
				fileR.download(SowURL);
			}


			public function drowloadComplete(event:Event):void
			{
				PopUpManager.removePopUp(bar);
			}

			public function downLoadError(event:Event):void
			{
				var fileR:FileReference=event.currentTarget as FileReference;
				fileR.removeEventListener(ProgressEvent.PROGRESS, downloadProgress);
				var alert4:AlertPanel=new AlertPanel();
				alert4.txtStr=resourceManager.getString(RmsConstants.LOCALE_FILE_NAME, "DOWNLOAD_FAILURE");
				PopUpManager.addPopUp(alert4, this, true);
				PopUpManager.centerPopUp(alert4);
			}

			public function downloadProgress(event:ProgressEvent):void
			{
				//test.label="已上传 " + Math.round(100 * event.bytesLoaded / event.bytesTotal) + "%";
				try
				{
					if (uploadFlag)
					{
						bar=new ProgressBar;
						bar.height=2;
						bar.width=200;
						bar.minimum=0;
						bar.visible=true;
						bar.maximum=100;
						bar.direction="right"
						bar.mode="manual";
						PopUpManager.addPopUp(bar, this, true);
						PopUpManager.centerPopUp(bar);
						uploadFlag=false;
					}
				}
				catch (e:Error)
				{

					Alert.show("Upload PPT file failed", "Message", Alert.OK);
				}
				var proc:uint=event.bytesLoaded / event.bytesTotal * 100;
				bar.setProgress(proc, 100);
				bar.label="Progress : " + " " + (proc - 1) + "%";
			}


			/**
			 *
			 * 文件下载全程监听配置
			 *
			 **/
			private function configFileDownload(eventDispatcher:IEventDispatcher):void
			{

			}

4,328

社区成员

发帖
与我相关
我的任务
社区描述
多媒体/设计 Flex
社区管理员
  • Flex
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧