本文整理汇总了C#中Worksheet.MergeRange方法的典型用法代码示例。如果您正苦于以下问题:C# Worksheet.MergeRange方法的具体用法?C# Worksheet.MergeRange怎么用?C# Worksheet.MergeRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Worksheet
的用法示例。
在下文中一共展示了Worksheet.MergeRange方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SS_LoadSheet
//.........这里部分代码省略.........
{
sheet.Cells[count, 0].Style.Italic = true;
}
sheet[count, 0] = entry.Value;
sheet.SetRowsHeight(count, 1, 23);
sheet.Cells[count, 0].Tag = entry.Key.Replace("z", "").Replace("r", "");
sheet.Cells[count, 0].Style.VAlign = ReoGridVerAlign.Middle;
sheet.Cells[count, 0].Style.HAlign = ReoGridHorAlign.Left;
sheet.Cells[count, 0].Style.FontName = "Arial";
sheet.Cells[count, 0].Style.FontSize = 8;
string sDates = "";
foreach (DateTime date in dates)
{
if (!IsWeekend(date))
{
sDates += sDates.Length > 0 ? " OR " : "";
sDates += "BDates LIKE '" + date.ToString("dd/MM/yyyy") + "%'";
}
}
if (sDates.Length > 0)
{
DataSet d = Program.DB.SelectAll("SELECT ID,BName,BDates,BTimes,BRoom,BComments,Confirmed,Completed FROM Jobs WHERE " + sDates + (iFilterCompany > 0 ? " AND BCompany=" + iFilterCompany : "") + ";");
if (d.Tables.Count > 0 && d.Tables[0].Rows.Count > 0)
{
foreach (DataRow dr in d.Tables[0].Rows)
{
int iColumn = 1;
string[] sRooms = new string[] { };
if (dr["BRoom"] != DBNull.Value && dr["BRoom"].ToString().Length > 0)
{
sRooms = dr["BRoom"].ToString().Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
}
if (dr["BRoom"] != DBNull.Value && sRooms.Contains(entry.Key.Replace("r", "").Replace("z", "")))
{
foreach (DateTime date in dates)
{
string[] sD = dr["BDates"].ToString().Split('|');
for (int i = 0; i < sD.Length; i++)
{
sD[i] = sD[i].Replace(" 00:00:00", "");
}
if (sD[0] == date.ToString("dd/MM/yyyy"))
{
ReoGridRange rgr = new ReoGridRange(count, iColumn, 1, 1);
DateTime dtF = Convert.ToDateTime(sD[1]);
double iDays = (dtF - date).TotalDays;
if (iDays > 0)
{
rgr.Cols = Convert.ToInt32(iDays) + 1;
}
if (sRooms.Length > 1)
{
rgr.Rows = sRooms.Length;
}
bool rs = sheet.HasIntersectedMergingRange(rgr);
if (!rs && (rgr.Rows > 1 || rgr.Cols > 1))
{
sheet.MergeRange(rgr);
}
sheet[count, iColumn] = dr["BName"].ToString();
sheet.Cells[count, iColumn].Tag = Convert.ToInt32(dr["ID"]);
sheet.Cells[count, iColumn].Style.HAlign = ReoGridHorAlign.Center;
sheet.Cells[count, iColumn].Style.VAlign = ReoGridVerAlign.Middle;
if (dr["Completed"] != DBNull.Value && dr["Completed"].ToString() == "Y")
{
sheet.Cells[count, iColumn].Style.BackColor = Color.MediumVioletRed;
//sheet.SetRangeBorders(rgr, BorderPositions.Outside, new RangeBorderStyle { Color = Color.IndianRed, Style = BorderLineStyle.Solid });
}
else
{
sheet.Cells[count, iColumn].Style.BackColor = Color.PaleVioletRed;
//sheet.SetRangeBorders(rgr, BorderPositions.Outside, new RangeBorderStyle { Color = Color.MediumVioletRed, Style = BorderLineStyle.Solid });
}
if (dr["BComments"].ToString().Length > 0)
{
sheet.Cells[count, iColumn].Style.Bold = true;
}
break;
}
iColumn++;
}
}
}
}
}
count++;
}
}