public DlgPicture(string xml, bool readOnly) { this.InitializeComponent(); this.cmbPicType.Items.Add(PPCConvert.PicType2String(InterPicType.SourceFile)); this.cmbPicType.Items.Add(PPCConvert.PicType2String(InterPicType.ResourcePic)); this.chkGrayscale.Checked = PLSystemParam.GrayResPicWhenPrint; if (PPCardCompiler.ExplainInterPicXml(xml, this.info)) { this.cmbPicType.Enabled = false; this.cmbPicType.Text = PPCConvert.PicType2String(this.info.Type); this.cmbPicType.Enabled = true; if (this.info.FileIndex >= 0) { this.numFileIndex.Value = Convert.ToDecimal(this.info.FileIndex); } else { this.numFileIndex.Enabled = false; } this.txtCellStart.Text = this.info.CellStart; this.txtCellEnd.Text = this.info.CellEnd; this.chkGrayscale.Checked = this.info.Grayscale; } else { this.cmbPicType.SelectedIndex = 0; } if (readOnly) { this.panel1.Enabled = false; this.btnOk.Visible = false; this.btnCancel.Text = "确定"; } }
private void cmbPicType_SelectedIndexChanged(object sender, EventArgs e) { if (this.cmbPicType.Enabled) { if (this.cmbPicType.Text == PPCConvert.PicType2String(InterPicType.ResourcePic)) { this.numFileIndex.Enabled = false; FrmRESPicture picture = new FrmRESPicture { WindowState = FormWindowState.Normal }; if (picture.ShowDialog() == DialogResult.OK) { this.info.FileOid = picture.SelectedPicture.Oid; } else { this.cmbPicType.Text = PPCConvert.PicType2String(InterPicType.SourceFile); } } else { this.numFileIndex.Enabled = true; } } }
private PPCellAttach CheckEditStyle(string cell) { string cellValue = this.GetCellValue(cell); int num = PPCConvert.Address2Row(cell); if (CLCard.InRange(this.midBegin, this.midEnd, this.curCell)) { if (num == PPCConvert.Address2Row(this.midBegin)) { return(PPCellAttach.Option); } return(PPCellAttach.None); } if ((cellValue != "") && (cellValue[0] != '<')) { if (this.readOnly) { return(PPCellAttach.None); } return(PPCellAttach.Label); } if (cellValue == string.Empty) { if (this.readOnly) { return(PPCellAttach.None); } return(PPCellAttach.Unknow); } if (cellValue[0] == '<') { return(PPCardCompiler.GetXmlEditStyle(cellValue)); } return(PPCellAttach.None); }
private void OnFunction(object sender, EventArgs e) { ArrayList midColLstOfMain = new ArrayList(); ArrayList midColLstOfNext = new ArrayList(); this.GetColList(midColLstOfMain, midColLstOfNext); CLFunction func = new CLFunction(); string cellValue = this.GetCellValue(this.curCell); if ((cellValue != null) && (cellValue != "")) { PPCardCompiler.ExplainXml(cellValue, func); } else { func.ColInMainPage = func.ColInNextPage = PPCConvert.Address2ColName(this.GetFirstCell(this.curCell)); func.FuncType = ((MenuItemEx)sender).Text; func.DisplayInLastPage = true; if (func.FuncType == "单页列小计") { func.DisplayInLastPage = false; } } DlgFunction function2 = new DlgFunction(this.m_tp, midColLstOfMain, midColLstOfNext, base.Parent.Text == "首页", func, this.readOnly); if ((function2.ShowDialog() == DialogResult.OK) && (function2.script != null)) { this.SetCellValue(this.curCell, function2.script); } }
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); }
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))); }
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 InitializeSheet(bool readOnly) { try { string str = "A1:" + PPCConvert.RowCol2Address(this.countRows, this.countColumns); this.axSpreadsheet1.ViewableRange = str; } catch { this.axSpreadsheet1.ViewableRange = "A1:CZ100"; MessageBox.Show("模板的总行数或者总列数不合理。有效区域已重置,请仔细检查,并重新设置有效区域。"); } this.ReadOnly = readOnly; }
private void axSpreadsheet1_DblClick(object sender, IWebCalcEventSink_DblClickEvent e) { this.m_tp.IsSaved = false; this.curCell = this.GetFirstCell(e.eventInfo.Range.Address); switch (this.CheckEditStyle(this.curCell)) { case PPCellAttach.Option: this.OnShowCellProperty(null, null); return; case PPCellAttach.Process: this.OnInsertProcessRecord(null, null); return; case PPCellAttach.History: this.OnInsertModifyRecord(null, null); return; case PPCellAttach.PageIndex: this.OnInsertPageIndex(null, null); return; case PPCellAttach.PagesCount: this.OnInsertPagesCount(null, null); return; case PPCellAttach.FormSign: case PPCellAttach.Remark: case PPCellAttach.Other: this.OnFormSignature(null, null); return; case PPCellAttach.Picture: if (PPCConvert.ToPicType(PPCardCompiler.GetXmlAttr(this.GetCellValue(this.curCell), "类型")) != InterPicType.BarCode) { this.OnInsertPicture(null, null); return; } this.OnInsertBarcode(null, null); return; case PPCellAttach.Function: this.OnFunction(null, null); return; case PPCellAttach.Unknow: this.BuildContextMenu().Show(this, new Point(e.eventInfo.X, e.eventInfo.Y)); return; } }
private void btnOk_Click(object sender, EventArgs e) { this.info.Type = PPCConvert.ToPicType(this.cmbPicType.Text); if (this.info.Type == InterPicType.SourceFile) { this.info.FileIndex = Convert.ToInt32(this.numFileIndex.Value); } else { this.info.FileIndex = -1; } this.info.CellStart = this.txtCellStart.Text.Trim(); this.info.CellEnd = this.txtCellEnd.Text.Trim(); this.info.Grayscale = this.chkGrayscale.Checked; this.Script = PPCardCompiler.CreateInterPicXml(this.info); this.PicType = this.info.Type; base.DialogResult = DialogResult.OK; }
private void DlgAutoNumber_Load(object sender, EventArgs e) { if (this.isTiModeler) { this.rbtCurrentPage.Enabled = false; } if (!this.hasNextPage) { this.cmbNextPageCol.Enabled = false; } if (this.readOnly) { this.rbtAllPages.Enabled = false; this.groupBox1.Enabled = false; this.groupBox2.Enabled = false; if (this.allowUpdate) { if (this.m_tp.AutoNumber == null) { this.btnOK.Text = "设置"; } else { this.btnOK.Text = "更新"; } } else { this.btnOK.Visible = false; this.btnCancel.Text = "确定"; } } if ((this.AutoNumberXml != null) && (this.AutoNumberXml.ToString() != "")) { AutoNumber number = PPCardCompiler.ExplainAutoNumberXML(this.AutoNumberXml); this.txtPrefix.Text = number.Prefix; this.txtPostfix.Text = number.Postfix; this.numStart.Value = number.Start; this.cmbInterval.Text = number.Interval.ToString(); this.cmbMainPageCol.Text = PPCConvert.Int2ABC(number.ColAtMainPage); this.cmbNextPageCol.Text = PPCConvert.Int2ABC(number.ColAtNextPage); } }
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); }
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(""); }
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); } }
private void SetDefaultColor(PPTmpPage comparedPage) { this.SetFontColor(this.GetRange("A1", PPCConvert.RowCol2Address(this.countRows, this.countColumns)), "Black"); comparedPage.SetFontColor(comparedPage.GetRange("A1", PPCConvert.RowCol2Address(comparedPage.countRows, comparedPage.countColumns)), "Black"); }
private void SetColColor(int colStart, int colEnd, int row) { OWC.Range r = this.GetRange(PPCConvert.RowCol2Address(1, colStart), PPCConvert.RowCol2Address(row, colEnd)); this.SetFontColor(r, "Fuchsia"); }
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); } } } }
private OWC.Range GetRange(string address) { return(this.axSpreadsheet1.ActiveSheet.UsedRange.get_Item(PPCConvert.Address2Row(address), PPCConvert.Address2Col(address))); }
private void SetRowColor(int rowStart, int rowEnd, int col) { OWC.Range r = this.GetRange(PPCConvert.RowCol2Address(rowStart, 1), PPCConvert.RowCol2Address(rowEnd, col)); this.SetFontColor(r, "Fuchsia"); }