日期:2014-05-18  浏览次数:20760 次

请教两个问题,关于EXCEL和SESSION的~~~~~~~~~~~~~~~~~~
请教两个问题,先谢谢了!

问题一:一个固定格式的EXCEL表,需要向其中几个固定的位置写数据,如第三列第八行,第四列第五行……

能给点代码就更感激不尽了!

问题二:有两个系统:A,B。

A系统需要调用B系统的很多个页面。但是B系统的每个页面都有权限判断,根据Session里存的用户名user_id判断该用户是否有访问此页面的权限。

现在A系统调用B系统页面时,这个Session[ "user_id "]怎么处理?

改B系统的页面太麻烦了,好多个页面。

谢谢!!!!!!!

------解决方案--------------------
#region 工作调动.xls
/// <summary>
/// 工作调动.xls
/// </summary>
/// <param name= "saveRows "> </param>
internal static void SaveGZDD_DataToExcel(GridEXRow[] saveRows)
{
string fileName = "工作调动.xls ";
Excel.Application excel = new Excel.Application();
try
{
SelectSavePath();
if (File.Exists(fileName))
{
if (File.Exists(SavePath + fileName))
{
File.Delete(SavePath + fileName);
}
File.Copy(fileName, SavePath + fileName);
}
else
{
MessageBox.Show( "模板文件不存在! ");
return;
}

object oMissiong = System.Reflection.Missing.Value;
excel.Application.Workbooks.Open(SavePath + fileName, oMissiong, oMissiong, oMissiong, oMissiong, oMissiong, oMissiong, oMissiong, oMissiong, oMissiong, oMissiong, oMissiong, oMissiong);
Excel.Workbook mybook = (Excel.Workbook)excel.ActiveWorkbook;
Excel.Worksheet mysheet = (Excel.Worksheet)mybook.ActiveSheet;
int row = 2;
foreach (GridEXRow gridrow in saveRows)
{
excel.Cells[row, 1] = gridrow.Cells[ "GZTD_RYBH "].Value.ToString();
excel.Cells[row, 2] = gridrow.Cells[ "GZTD_RYXM "].Value.ToString();
excel.Cells[row, 3] = gridrow.Cells[ "GZTD_DWXZ "].Value.ToString();
excel.Cells[row, 4] = gridrow.Cells[ "GZTD_DWMC "].Value.ToString();
excel.Cells[row, 5] = gridrow.Cells[ "GZTD_ZW "].Value.ToString();
excel.Cells[row, 6] = gridrow.Cells[ "GZTD_KSRQ "].Value.ToString();
excel.Cells[row, 7] = gridrow.Cells[ "GZTD_JSRQ "].Value.ToString();
excel.Cells[row, 8] = gridrow.Cells[ "GZTD_LXRY "].Value.ToString();
excel.Cells[row, 9] = gridrow.Cells[ "GZTD_LXDH "].Value.ToString();
excel.Cells[row, 9] = gridrow.Cells[ "GZTD_BZ "].Value.ToString();
row++;
}
//mybook.Close(0, oMissiong, oMissiong);
//excel.Save(SavePath + "帮负责任.xls ");
excel.Visible = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
excel.Quit();
}
}
#endregion
------解决方案--------------------
A请求B的登陆页面,然后自动提交用户名密码
------解决方案--------------------
A绕过B的权限验证??
不会,帮顶!
------解决方案--------------------
设个判断!加个权限参数。Session[ "user_id "]与参数对应,建个表!然后根据参数访问!