#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 |