请教两个问题,先谢谢了!问题一:一个固定格式的EXCEL表,需要向其中几个固定的位置写数据,如第三列第八行,第四列第五行……能给点代码就更感激不尽了!问题二:有两个系统:A,B。A系统需要调用B系统的很多个页面。但是B系统的每个页面都有权限判断,根据Session里存的用户名user_id判断该用户是否有访问此页面的权限。现在A系统调用B系统页面时,这个Session["user_id"]怎么处理?改B系统的页面太麻烦了,好多个页面。谢谢!!!!!!!
调试欢乐多
/// <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