复制代码 代码如下:
string cCount = "";
string dCount = "";
string jCount = "";
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string id = Request.QueryString["OrderID"] == null ? "1" : Request.QueryString["OrderID"].ToString();
SqlConnection con = new SqlConnection("server=CHENZQ;uid=sa;pwd=luca623;database=luca");
SqlDataAdapter sda = new SqlDataAdapter("select * from view_Order where C_orderID='" + id + "'", con);
DataSet ds = new DataSet();
sda.Fill(ds);
cCount = ds.Tables[0].Rows[0]["C_CTime"].ToString();
dCount = ds.Tables[0].Rows[0]["C_TTime"].ToString();
jCount = ds.Tables[0].Rows[0]["C_DTime"].ToString();
//这段代码是最重要
ReportViewer1.Reset();
this.ReportViewer1.LocalReport.LoadReportDefinition(GenerateRdlc());
ReportViewer1.LocalReport.DataSources.Clear();
//Orders_DataTable1 数据源名字必须和此报表原绑定的数据源名相同
this.ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Orders_DataTable1", ds.Tables[0]));
this.ReportViewer1.LocalReport.Refresh();
}
}
//这个方法就是自定义报表的样式
public MemoryStream GenerateRdlc()
{
XmlDocument sourceDoc = new XmlDocument();
string path = AppDomain.CurrentDomain.BaseDirectory + "Orders.rdlc";
//c_CTime = ds.Tables[0].Rows[0]["C_CTime"].ToString();
sourceDoc.Load(path);
//下面就是xml操作了 没必要看我的 根据自己的需求而做
XmlNode xHeader = sourceDoc.ChildNodes.Item(1).ChildNodes.Item(13).ChildNodes.Item(1).ChildNodes.Item(0).ChildNodes.Item(4);
XmlNode xCells = xHeader.ChildNodes.Item(0).ChildNodes.Item(0).ChildNodes.Item(0);
//建设期
XmlNode xmlCell = xCells.ChildNodes.Item(1);
XmlElement xeCol = sourceDoc.CreateElement("ColSpan");
xeCol.InnerText = cCount;
xeCol.InnerXml = cCount;
xmlCell.InnerXml += xeCol.OuterXml;
XmlNode xmlCellValue = xmlCell.ChildNodes.Item(0).ChildNodes.Item(0).ChildNodes.Item(4);
xmlCellValue.InnerXml = "建设期";
xmlCellValue.InnerText = "建设期";
XmlNode xnRemove;
for (int i = 0; i <int.Parse(cCount) - 1; i++)
{
xnRemove = xCells.ChildNodes.Item(2);
xCells.RemoveChild(xnRemove);
}
//投产期
XmlNode xmlCellT = xCells.ChildNodes.Item(2);
XmlElement xeColT = sourceDoc.CreateElement("ColSpan");
xeColT.InnerText = dCount;
xeColT.InnerXml = dCount;
xmlCellT.InnerXml += xeColT.OuterXml;
XmlNode xmlCellValueT = xmlCellT.ChildNodes.Item(0).ChildNodes.Item(0).ChildNodes.Item(4);
xmlCellValueT.InnerXml = "投产期";
xmlCellValueT.InnerText = "投产期";
for (int j = 0; j < int.Parse(dCount) - 1; j++)
{
xnRemove = xCells.ChildNodes.Item(3);
xCells.RemoveChild(xnRemove);
}
//生产期
XmlNode xmlCellC = xCells.ChildNodes.Item(3);
XmlElement xeColC = sourceDoc.CreateElement("ColSpan");
xeColC.InnerText = jCount.ToString();
xeColC.InnerXml = jCount.ToString();
xmlCellC.InnerXml += xeColC.OuterXml;
XmlNode xmlCellValueC = xmlCellC.ChildNodes.Item(0).ChildNodes.Item(0).ChildNodes.Item(4);
xmlCellValueC.InnerXml = "生产期";
xmlCellValueC.InnerText = "生产期";
for (int j = 0; j < int.Parse(jCount) - 1; j++)
{
xnRemove = xCells.ChildNodes.Item(4);
xCells.RemoveChild(xnRemove);
}
MemoryStream ms = new MemoryStream();
XmlSerializer serializer = new XmlSerializer(typeof(XmlDocument));
serializer.Serialize(ms, sourceDoc);
ms.Position = 0;
return ms;
}

技巧 可以先在报表里自己设计好需要的格式 用
XmlDocument sourceDoc = new XmlDocument();
string path = AppDomain.CurrentDomain.BaseDirectory + "Orders.rdlc";
然后用sourceDoc .save()保存生成xml
可以看到此xml你需要改的格式是哪个地方
华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com

《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线

暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。

艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。

《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。