当前位置: 首页>>代码示例>>C#>>正文


C# Worksheet.HasIntersectedMergingRange方法代码示例

本文整理汇总了C#中Worksheet.HasIntersectedMergingRange方法的典型用法代码示例。如果您正苦于以下问题:C# Worksheet.HasIntersectedMergingRange方法的具体用法?C# Worksheet.HasIntersectedMergingRange怎么用?C# Worksheet.HasIntersectedMergingRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Worksheet的用法示例。


在下文中一共展示了Worksheet.HasIntersectedMergingRange方法的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++;
            }
        }
开发者ID:etechuk,项目名称:hcfcpc,代码行数:101,代码来源:frmMain.cs


注:本文中的Worksheet.HasIntersectedMergingRange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。