Ejemplo n.º 1
0
        public ArrayList GetMidColNameList()
        {
            ArrayList list = new ArrayList();
            int       row  = PPCConvert.Address2Row(this.midBegin);
            int       num2 = PPCConvert.Address2Col(this.midBegin);
            int       num3 = PPCConvert.Address2Col(this.midEnd);

            for (int i = num2; i <= num3; i++)
            {
                string address = this.GetRange(row, i).MergeArea.Address;
                if (address.IndexOf(":") > 0)
                {
                    string firstCell = this.GetFirstCell(address);
                    if (PPCConvert.Address2Col(firstCell) == i)
                    {
                        list.Add(PPCConvert.Address2ColName(firstCell));
                    }
                }
                else
                {
                    list.Add(PPCConvert.Address2ColName(address));
                }
            }
            return(list);
        }
Ejemplo n.º 2
0
 private Range GetRange(string address)
 {
     if (address.IndexOf(":") < 0)
     {
         return(this.GetRange(PPCConvert.Address2Row(address), PPCConvert.Address2Col(address)));
     }
     return(this.GetRange(address.Substring(0, address.IndexOf(":")), address.Substring(address.IndexOf(":") + 1)));
 }
Ejemplo n.º 3
0
        public bool SetPageRange(string tabText)
        {
            string address = this.axSpreadsheet1.Selection.Address;

            if (address.IndexOf(":") < 0)
            {
                MessageBox.Show("选择区域不合理。不能只是一个单元格。", "卡片模板", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
            string str2 = address.Substring(0, address.IndexOf(":"));
            string str3 = address.Substring(address.IndexOf(":") + 1);

            if (!CLPPFile.CheckAddress(str2) || !CLPPFile.CheckAddress(str3))
            {
                MessageBox.Show("选择区域不合理。不能只是一行或者一列。", "卡片模板", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
            if (str2 != "A1")
            {
                MessageBox.Show("必须从A1单元格开始选择区域。", "卡片模板", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
            try {
                this.axSpreadsheet1.ViewableRange = address;
            } catch {
                MessageBox.Show("选择区域不合理。要确保选择区域所有单元格(特别是合并形成的单元格)都是完整的。", "卡片模板", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
            if (MessageBox.Show(tabText + "有效区域已经重新设置,是否保存这些设置?请注意:模板定制时如果插入、删除行和列,必须重新设置模板的有效区域和表中区域。", "卡片模板", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                string str4 = "A1:" + PPCConvert.RowCol2Address(this.countRows, this.countColumns);
                this.axSpreadsheet1.ViewableRange = str4;
                return(false);
            }
            this.countRows    = PPCConvert.Address2Row(str3);
            this.countColumns = PPCConvert.Address2Col(str3);
            string str5 = tabText;

            if (str5 != null)
            {
                if (str5 == "封面")
                {
                    this.m_tp.RowCountOfCover = this.countRows;
                    this.m_tp.ColCountOfCover = this.countColumns;
                }
                else if (str5 == "首页")
                {
                    this.m_tp.RowCountOfMain = this.countRows;
                    this.m_tp.ColCountOfMain = this.countColumns;
                }
                else if (str5 == "续页")
                {
                    this.m_tp.RowCountOfNext = this.countRows;
                    this.m_tp.ColCountOfNext = this.countColumns;
                }
            }
            return(true);
        }
Ejemplo n.º 4
0
        public ArrayList GetMidBindCells()
        {
            ArrayList list = new ArrayList();

            if ((this.midBegin != null) && (this.midEnd != null))
            {
                int row  = PPCConvert.Address2Row(this.midBegin);
                int num2 = PPCConvert.Address2Col(this.midBegin);
                int num3 = PPCConvert.Address2Col(this.midEnd);
                for (int i = num2; i <= num3; i++)
                {
                    if ((this.GetCellValue(row, i) != null) && (this.GetCellValue(row, i) != string.Empty))
                    {
                        PPCardCell cc = new PPCardCell();
                        PPCardCompiler.ExplainXml(this.GetCellValue(row, i), cc);
                        list.Add(cc);
                    }
                }
            }
            return(list);
        }
Ejemplo n.º 5
0
        public string GetMainItem()
        {
            int row  = PPCConvert.Address2Row(this.midBegin);
            int num2 = PPCConvert.Address2Col(this.midBegin);
            int num3 = PPCConvert.Address2Col(this.midEnd);

            for (int i = num2; i <= num3; i++)
            {
                string cellValue = this.GetCellValue(row, i);
                if ((cellValue != null) && (cellValue != ""))
                {
                    PPCardCell cc = new PPCardCell();
                    PPCardCompiler.ExplainXml(cellValue, cc);
                    if (((cc != null) && (cc.Area == PPCardArea.Mid)) && (cc.Attachment == PPCellAttach.Option))
                    {
                        return(cc.ClassName);
                    }
                }
            }
            return("");
        }
Ejemplo n.º 6
0
 private void GetColList(ArrayList midColLstOfMain, ArrayList midColLstOfNext)
 {
     try {
         if (this.m_tp != null)
         {
             int num  = PPCConvert.Address2Col(this.m_tp.MidBeginOfMain);
             int num2 = PPCConvert.Address2Col(this.m_tp.MidEndOfMain);
             int num3 = PPCConvert.Address2Col(this.m_tp.MidBeginOfNext);
             int num4 = PPCConvert.Address2Col(this.m_tp.MidEndOfNext);
             int row  = PPCConvert.Address2Row(this.m_tp.MidBeginOfMain);
             int num6 = PPCConvert.Address2Row(this.m_tp.MidBeginOfNext);
             if (base.Parent.Text == "首页")
             {
                 for (int i = num; i <= num2; i++)
                 {
                     if (this.GetFirstCell(PPCConvert.RowCol2Address(row, i)) == PPCConvert.RowCol2Address(row, i))
                     {
                         midColLstOfMain.Add(PPCConvert.Int2ABC(i));
                         midColLstOfNext.Add(PPCConvert.Int2ABC(i));
                     }
                 }
             }
             else if (base.Parent.Text == "续页")
             {
                 for (int j = num3; j <= num4; j++)
                 {
                     if (this.GetFirstCell(PPCConvert.RowCol2Address(num6, j)) == PPCConvert.RowCol2Address(num6, j))
                     {
                         midColLstOfNext.Add(PPCConvert.Int2ABC(j));
                         midColLstOfMain.Add(PPCConvert.Int2ABC(j));
                     }
                 }
             }
         }
     } catch (Exception exception) {
         throw new Exception("获取首页或续页的表中有效列出错。" + exception.Message);
     }
 }
Ejemplo n.º 7
0
 private void OnShowCellProperty(object sender, EventArgs e)
 {
     if ((this.countColumns == 0x4e) && (this.countRows == 100))
     {
         MessageBox.Show("必须先设置本页的有效区域和表中区域。\n请先选中有效区域,然后在模板的快捷菜单中点击“设为有效区域”命令。", "卡片模板", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else if ((this.midBegin == "AZ100") && (this.midBegin == "AZ100"))
     {
         MessageBox.Show("必须先设置本页的有效区域和表中区域。\n请先选中表中区域,然后在模板的快捷菜单中点击“设为表中区域”命令。", "卡片模板", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else
     {
         string     cellValue = this.GetCellValue(this.curCell);
         PPCardArea head      = PPCardArea.Head;
         if ((sender == null) && (e == null))
         {
             head = PPCardArea.Mid;
         }
         bool isCAPP = ModelContext.MetaModel.IsCard(this.m_tp.TemplateType);
         this.SetOptionHasKeyOrSbuKey();
         DlgOption2 option = new DlgOption2(cellValue, head, this.readOnly, this.curCell, isCAPP, this.m_tp.TemplateType, this.m_tp);
         try {
             if (PPCConvert.Address2Row(this.curCell) > 1)
             {
                 option.BlurLabel = this.GetCellValueEx(PPCConvert.Address2Row(this.curCell) - 1, PPCConvert.Address2Col(this.curCell));
             }
             if ((option.BlurLabel == "") && (PPCConvert.Address2Row(this.curCell) > 2))
             {
                 option.BlurLabel = this.GetCellValueEx(PPCConvert.Address2Row(this.curCell) - 2, PPCConvert.Address2Col(this.curCell));
             }
             else if (((option.BlurLabel.Length > 0) && (option.BlurLabel[0] == '<')) && (PPCConvert.Address2Col(this.curCell) > 1))
             {
                 option.BlurLabel = this.GetCellValueEx(PPCConvert.Address2Row(this.curCell), PPCConvert.Address2Col(this.curCell) - 1);
             }
             if ((option.BlurLabel == "") && (PPCConvert.Address2Row(this.curCell) > 3))
             {
                 option.BlurLabel = this.GetCellValueEx(PPCConvert.Address2Row(this.curCell) - 3, PPCConvert.Address2Col(this.curCell));
             }
             else if (((option.BlurLabel.Length > 0) && (option.BlurLabel[0] == '<')) && (PPCConvert.Address2Col(this.curCell) > 1))
             {
                 option.BlurLabel = this.GetCellValueEx(PPCConvert.Address2Row(this.curCell), PPCConvert.Address2Col(this.curCell) - 1);
             }
             if ((option.BlurLabel == "") && (PPCConvert.Address2Row(this.curCell) > 4))
             {
                 option.BlurLabel = this.GetCellValueEx(PPCConvert.Address2Row(this.curCell) - 4, PPCConvert.Address2Col(this.curCell));
             }
             else if (((option.BlurLabel.Length > 0) && (option.BlurLabel[0] == '<')) && (PPCConvert.Address2Col(this.curCell) > 1))
             {
                 option.BlurLabel = this.GetCellValueEx(PPCConvert.Address2Row(this.curCell), PPCConvert.Address2Col(this.curCell) - 1);
             }
             if ((option.BlurLabel != "") && (option.BlurLabel[0] == '<'))
             {
                 option.BlurLabel = "";
             }
         } catch {
         }
         if (option.BlurLabel != null)
         {
             option.BlurLabel.Replace(" ", "");
         }
         option.Text = this.curCell + "单元格属性";
         if ((option.CCInit.AttributeName != "") || !this.readOnly)
         {
             try {
                 if (option.ShowDialog() == DialogResult.OK)
                 {
                     this.GetRange(this.curCell).Value = option.CardCell.Script.Trim();
                 }
             } catch (Exception exception) {
                 MessageBox.Show(exception.Message);
             }
         }
     }
 }
Ejemplo n.º 8
0
 private OWC.Range GetRange(string address)
 {
     return(this.axSpreadsheet1.ActiveSheet.UsedRange.get_Item(PPCConvert.Address2Row(address), PPCConvert.Address2Col(address)));
 }