找回密码
 立即注册

QQ登录

只需一步,快速开始

wjj_123

银牌会员

44

主题

81

帖子

2173

积分

银牌会员

积分
2173

活字格认证

wjj_123
银牌会员   /  发表于:2012-5-15 11:54  /   查看:4741  /  回复:3
上传一张图片,显示在Spread 某一单元格中但没显示?

3 个回复

倒序浏览
iceman
社区贡献组   /  发表于:2012-5-15 11:58:00
沙发

回复 1# wjj_123 的帖子

楼主你好,
请参考该贴:http://gcdn.grapecity.com/showtopic-3680.html
回复 使用道具 举报
gsyxy100
初级会员   /  发表于:2012-5-22 11:01:00
板凳
#region 设置报表图片显示

            // 设置报表图片显示
            string localAddr = HttpContext.Current.Request.ServerVariables["local_addr"];

            string serverPort = HttpContext.Current.Request.ServerVariables["Server_Port"];

            string relativeUrl = null;
            if (serverPort != null && serverPort != "80")
            {
                relativeUrl = "http://" + localAddr + ":" + serverPort + ReportConstants.ReportFileVirtualPath;
            }
            else
            {
                relativeUrl = "http://" + localAddr + ReportConstants.ReportFileVirtualPath;
            }

            string imgPath = ReportConstants.ReportFilePhisicalPath + reportID + "\\" + Path.GetFileNameWithoutExtension(ReportFileName);
            if (Directory.Exists(imgPath))
            {
                string[] Files = Directory.GetFiles(imgPath);
                for (int i = 0; i < Files.Length; i++)
                {
                    FarPoint.Web.Spread.ImageCellType imgcell = new FarPoint.Web.Spread.ImageCellType();
                    if (!string.IsNullOrEmpty(Files) && Path.GetFileNameWithoutExtension(Files).Contains("_"))
                    {
                        imgcell.ImageUrl = relativeUrl + reportID + "/" + Path.GetFileNameWithoutExtension(ReportFileName) + "/" + Path.GetFileName(Files);
                        string[] ColAndRow = Path.GetFileNameWithoutExtension(Files).Split('_');

                        // 判断是否为本SHEET内的图片
                        if (ColAndRow.Length == 3 && FpSpread1.ActiveSheetView.SheetName.Equals(ColAndRow[0]))
                        {
                            // 设置最大行数
                            if (FpSpread1.ActiveSheetView.RowCount < Convert.ToInt32(ColAndRow[2]) + 1)
                            {
                                FpSpread1.ActiveSheetView.RowCount = Convert.ToInt32(ColAndRow[2]) + 1;
                            }

                            // 设置最大列数
                            if (FpSpread1.ActiveSheetView.ColumnCount < Convert.ToInt32(ColAndRow[1]) + 1)
                            {
                                FpSpread1.ActiveSheetView.ColumnCount = Convert.ToInt32(ColAndRow[1]) + 1;
                            }

                            this.FpSpread1.ActiveSheetView.Cells[Convert.ToInt32(ColAndRow[2]), Convert.ToInt32(ColAndRow[1])].CellType = imgcell;
                        }
                    }
                }
            }

            # endregion
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-5-22 15:11:00
地板

回复 3# gsyxy100 的帖子

:strong:
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部