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); }
private void btnOK_Click(object sender, EventArgs e) { if (CLPPFile.CheckAddress(this.txtCell.Text)) { base.DialogResult = DialogResult.OK; } else { MessageBox.Show("签名单元格填写错误,请检查。", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtCell.Focus(); this.txtCell.SelectAll(); } }
public bool SetMidTable(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); } this.midBegin = str2; this.midEnd = str3; string str4 = tabText; if (str4 != null) { if (str4 == "封面") { this.m_tp.MidBeginOfCover = str2; this.m_tp.MidEndOfCover = str3; } else if (str4 == "首页") { this.m_tp.MidBeginOfMain = str2; this.m_tp.MidEndOfMain = str3; } else if (str4 == "续页") { this.m_tp.MidBeginOfNext = str2; this.m_tp.MidEndOfNext = str3; } } return(true); }
private void btnOK_Click(object sender, EventArgs e) { if (!CLPPFile.CheckAddress(this.txtCellSign.Text)) { MessageBox.Show("签名单元格填写错误,请检查。", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtCellSign.Focus(); this.txtCellSign.SelectAll(); } else if (!CLPPFile.CheckAddress(this.txtCellDate.Text)) { MessageBox.Show("日期单元格填写错误,请检查。", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtCellDate.Focus(); this.txtCellDate.SelectAll(); } else if (((this.txtCellsRemark.Text.IndexOf(";") > 1) || (this.txtCellsRemark.Text.IndexOf(",") > 1)) || ((this.txtCellsRemark.Text.IndexOf(",") > 1) || (this.txtCellsRemark.Text.IndexOf(";") > 1))) { foreach (string str in this.txtCellsRemark.Text.Split(new char[] { ';', ',', ',', ';' })) { if (!CLPPFile.CheckAddress(str)) { MessageBox.Show("修改说明单元格填写错误,请检查。", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtCellsRemark.Focus(); this.txtCellsRemark.SelectAll(); return; } } base.DialogResult = DialogResult.OK; } else if (!CLPPFile.CheckAddress(this.txtCellsRemark.Text)) { MessageBox.Show("修改说明单元格填写错误,请检查。", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtCellsRemark.Focus(); this.txtCellsRemark.SelectAll(); } else { base.DialogResult = DialogResult.OK; } }
private void btnOK_Click(object sender, EventArgs e) { PPCardCell cardCell = this.CardCell; if ((cardCell.AttributeName == "") || (cardCell.ClassName == "")) { MessageBox.Show("有关属性没有定制或者没有正确定制,请检查并更正。", "工艺", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if ((!this.IsPrintTemplate && (((this.m_tp.HeadClass != ((string)this.txtField.Tag)) && ModelContext.MetaModel.IsCard(this.txtField.Tag as string)) || this.rbtMid.Checked)) && ((cardCell.LeftClassName == "") || (cardCell.LeftRelName == ""))) { MessageBox.Show("关联关系没有定制,请检查并更正。", "工艺", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (cardCell.IsBarcode && (cardCell.BarcodeTemplate == "")) { MessageBox.Show("条码输出没有选择条码模板,请检查并更正。", "工艺", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if ((!this.IsPrintTemplate && (cardCell.DataType == 9)) && (cardCell.Area != PPCardArea.Head)) { MessageBox.Show("只有表头才能绑定网格类型,请检查并更正。", "工艺", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { if (this.pnlGrid.Visible) { if (!CLPPFile.CheckAddress(cardCell.Address)) { MessageBox.Show("网格的起始单元格格式不对。", "工艺", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (!CLPPFile.CheckAddress(cardCell.Address2)) { MessageBox.Show("网格的结束单元格格式不对。", "工艺", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } if (cardCell.IsSubKey) { if (!HasKey) { MessageBox.Show("您还没有设置关键列,不能设置子关键列。", "工艺", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (cardCell.IsKey) { MessageBox.Show("一列不能既设置成关键列,又设置成子关键列。", "工艺", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } this.rtxScript.Text = PPCardCompiler.CreateXML(cardCell); ccFavorite = new PPCardCell(cardCell); ccFavorite.Script = ""; if (cardCell.IsKey) { HasKey = true; } else if (cardCell.IsSubKey) { HasSubKey = true; } base.DialogResult = DialogResult.OK; } }