我正在VS2010中开发一个rdlc报告,我需要在报告中添加一个表,但是这个表有固定的文本,不需要数据源.但该报告发出错误,因为该表与数据源无关.所以我的问题是如何在不需要datsource的rdlc中创建表?
谢谢
我已经在这个问题上苦苦挣扎了几天,我已经进行了研究并应用了我在各种论坛上发现的所有建议,但我仍然无法解决它.
我的问题是excel使用互操作库,我有一个excel文件用作模板,所以我打开它并保存在一个新名称的新位置.一切都很好,除了Excel进程在创建和关闭文件后继续运行.
这是我的代码
protected string CreateExcel(string strProjectID, string strFileMapPath)
{
string strCurrentDir = HttpContext.Current.Server.MapPath("~/Reports/Templates/");
string strFile = "Not_Created";
Application oXL;
Workbook oWB;
oXL = new Application();
oXL.Visible = false;
Workbooks wbks = oXL.Workbooks;
//opening template file
oWB = wbks.Open(strFileMapPath);
oXL.Visible = false;
oXL.UserControl = false;
strFile = strProjectID + "_" + DateTime.Now.Ticks.ToString() + ".xlsx";
//Saving file with new name
oWB.SaveAs(strCurrentDir + strFile, XlFileFormat.xlWorkbookDefault, null, null, false, false, XlSaveAsAccessMode.xlExclusive, false, false, null, null);
oWB.Close(false, strCurrentDir + strFile, Type.Missing);
wbks.Close();
oXL.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(oXL); …
Run Code Online (Sandbox Code Playgroud)