private DataTable GetExcel(string filepach) { string str; FarPoint.Win.Spread.FpSpread fpSpread1 = new FarPoint.Win.Spread.FpSpread(); try { fpSpread1.OpenExcel(filepach); } catch { string filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName(filepach); File.Copy(filepach, filepath1); fpSpread1.OpenExcel(filepath1); File.Delete(filepath1); } DataTable dt = new DataTable(); //for (int k = 1; k <= fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; k++) //{ //} foreach (GridColumn gc in ctrlBurdenMonth1.GridView.VisibleColumns) dt.Columns.Add(gc.Caption); for (int i = 3; i < fpSpread1.Sheets[0].GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data); i++) { DataRow dr = dt.NewRow(); str = ""; for (int j = 0; j <= fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data); j++) { str = str + fpSpread1.Sheets[0].Cells[i, j].Text; dr[j] = fpSpread1.Sheets[0].Cells[i, j].Text; } if (str != "") dt.Rows.Add(dr); } return dt; }
private DataTable GetExcel(string filepach) { string str; FarPoint.Win.Spread.FpSpread fpSpread1 = new FarPoint.Win.Spread.FpSpread(); try { fpSpread1.OpenExcel(filepach); } catch { string filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName(filepach); File.Copy(filepach, filepath1); fpSpread1.OpenExcel(filepath1); File.Delete(filepath1); } DataTable dt = new DataTable(); Hashtable h1 = new Hashtable(); int aa = 0; int sheetcount = 0; if (fpSpread1.Sheets.Count > 1) sheetcount = 1; for (int k = 0; k <= fpSpread1.Sheets[sheetcount].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; k++) { bool bl = false; try { foreach (TreeListColumn tlc in treeList1.Columns) { if (tlc.Caption == fpSpread1.Sheets[sheetcount].Cells[2, k].Text) { if (!h1.Contains(tlc.Caption)) { dt.Columns.Add(tlc.FieldName); h1.Add(tlc.Caption, tlc.FieldName); //aa++; } } else if (fpSpread1.Sheets[sheetcount].Cells[2, k].Text.IndexOf("��")>0) { try { int maonth = Convert.ToInt32(fpSpread1.Sheets[sheetcount].Cells[2, k].Text.Replace("��","")); if (maonth>0&&maonth<13) if (!h1.Contains(maonth)) { dt.Columns.Add(maonth.ToString()); h1.Add(fpSpread1.Sheets[sheetcount].Cells[2, k].Text, maonth); //aa++; } } catch { } } } } catch (Exception e) { //MessageBox.Show(e.Message+" "+gridcolumn); } } int m = 3; for (int i = m; i < fpSpread1.Sheets[sheetcount].GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data) - 4; i++) { try { DataRow dr = dt.NewRow(); str = ""; for (int j = 0; j < fpSpread1.Sheets[sheetcount].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data); j++) // for (int j = 0; j < h1.Count; j++) { str = str + fpSpread1.Sheets[sheetcount].Cells[i, j].Text; if (h1[fpSpread1.Sheets[sheetcount].Cells[2, j].Text] != null) if(i%4==3) dr[h1[fpSpread1.Sheets[sheetcount].Cells[2, j].Text].ToString()] = fpSpread1.Sheets[sheetcount].Cells[i, j].Text; } if (str != "") dt.Rows.Add(dr); } catch (Exception ex) { System.Console.WriteLine(ex.Message); } } return dt; ////////int m = 3; ////////for (int i = m; i < fpSpread1.Sheets[0].GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data); i++) ////////{ //////// DataRow dr = dt.NewRow(); //////// str = ""; //////// for (int j = 0; j < fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data)+1 ; j++) //////// { //////// str = str + fpSpread1.Sheets[0].Cells[i, j].Text; //////// dr[h1[j.ToString()].ToString()] = fpSpread1.Sheets[0].Cells[i, j].Text; //////// } //////// if (str != "") //////// dt.Rows.Add(dr); ////////} ////////return dt; }
public static tempU::DataTable GetExcel(string filepach, IList<string> filedList, IList<string> capList) { string str; FarPoint.Win.Spread.FpSpread fpSpread1 = new FarPoint.Win.Spread.FpSpread(); try { fpSpread1.OpenExcel(filepach); } catch { string filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName(filepach); File.Copy(filepach, filepath1); fpSpread1.OpenExcel(filepath1); File.Delete(filepath1); } tempU::DataTable dt = new tempU::DataTable(); IList<string> fie = new List<string>(); int m = 3; for (int j = 0; j < fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; j++) { if (capList.Contains(fpSpread1.Sheets[0].Cells[2, j].Text)) fie.Add(filedList[capList.IndexOf(fpSpread1.Sheets[0].Cells[2, j].Text)]); } for (int k = 0; k < fie.Count; k++) { dt.Columns.Add(fie[k]); } for (int i = m; i <= fpSpread1.Sheets[0].GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data); i++) { DataRow dr = dt.NewRow(); for (int j = 0; j < fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; j++) { dr[fie[j]] = fpSpread1.Sheets[0].Cells[i, j].Text; } dt.Rows.Add(dr); } return dt; }
private DataTable GetExcel(string filepach) { string str; FarPoint.Win.Spread.FpSpread fpSpread1 = new FarPoint.Win.Spread.FpSpread(); try { fpSpread1.OpenExcel(filepach); } catch { string filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName(filepach); File.Copy(filepach, filepath1); fpSpread1.OpenExcel(filepath1); File.Delete(filepath1); } DataTable dt = new DataTable(); Hashtable h1 = new Hashtable(); int aa = 0; ////////for (int k = 1; k <= fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; k++) ////////{ //////// bool bl = false; //////// foreach (GridBand gb in this.ctrlLine_Info1.GridView.Bands) //////// { //////// if (gb.Caption == fpSpread1.Sheets[0].Cells[0, k - 1].Text && gb.Columns.Count == 1) //////// { //////// if (type2 == "66" && gb.Columns[0].FieldName == "K1") //////// continue; //////// if (type2 == "10" && gb.Columns[0].FieldName == "L1") //////// continue; //////// dt.Columns.Add(gb.Columns[0].FieldName); //////// h1.Add(aa.ToString(), gb.Columns[0].FieldName); //////// aa++; //////// } //////// } ////////} for (int k = 1; k <= fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; k++) { bool bl = false; GridColumn gc = this.ctrlLine_Info1.GridView.VisibleColumns[k - 1]; dt.Columns.Add(gc.FieldName); h1.Add(aa.ToString(), gc.FieldName); aa++; } int m = 0; if (type2 == "10") m = 1; for (int i = m; i < fpSpread1.Sheets[0].GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; i++) { DataRow dr = dt.NewRow(); str = ""; for (int j = 0; j < fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; j++) { str = str + fpSpread1.Sheets[0].Cells[i, j].Text; dr[h1[j.ToString()].ToString()] = fpSpread1.Sheets[0].Cells[i, j].Text; } if (str != "") dt.Rows.Add(dr); } return dt; }
private DataTable GetExcel(string filepach) { string str; FarPoint.Win.Spread.FpSpread fpSpread1 = new FarPoint.Win.Spread.FpSpread(); try { fpSpread1.OpenExcel(filepach); } catch { string filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName(filepach); File.Copy(filepach, filepath1); fpSpread1.OpenExcel(filepath1); File.Delete(filepath1); } DataTable dt = new DataTable(); Hashtable h1 = new Hashtable(); int aa = 0; string[] col = new string[14]{"S3", "AreaName", "Title", "L1", "L2", "L3", "L4","L5", "L9","L10","S1","S2","S4","S5" }; int[] colnum = new int[7] {0,2,6,8,9,7,11 };//�������� int c = 0; //for (int k = 1; k <= fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; k++) //{ // bool bl = false; // GridColumn gc = this.ctrlSubstation_Info1.GridView.VisibleColumns[k - 1]; // dt.Columns.Add(gc.FieldName); // h1.Add(aa.ToString(), gc.FieldName); // aa++; //} for (int k = 0; k < col.Length; k++) { dt.Columns.Add(col[k]); } string[] cnNum = new string[9] { "һ", "��", "��", "��", "��", "��", "��", "��", "��" }; int cn=0; int gong = 65; int m = 2; string L1 = ""; string S4 = ""; string L2 = ""; string AreaName = ""; string temStr=""; // string L if (fpSpread1.Sheets[0].Cells[1, 0].Text != "���" && fpSpread1.Sheets[0].Cells[1, 0].Text != "") m = 1; for (int i = m; i <= fpSpread1.Sheets[0].GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data); i++) { c = 0; if (fpSpread1.Sheets[0].Cells[i, 0].Text == cnNum[cn]) { GetL1S4(fpSpread1.Sheets[0].Cells[i, 1].Text, out L1, out S4); AreaName = ""; gong = 65; cn++; continue; } else if ((temStr=fpSpread1.Sheets[0].Cells[i, 0].Text.Replace(" ","")) == Convert.ToChar(gong).ToString().ToLower()) { AreaName = fpSpread1.Sheets[0].Cells[i, 1].Text; gong++; continue; } DataRow dr = dt.NewRow(); str = ""; for (int j = 0; j < fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; j++) { str = str + fpSpread1.Sheets[0].Cells[i, j].Text; dr[col[colnum[c]]] = fpSpread1.Sheets[0].Cells[i, j].Text; c++; } GetL2(dr["L4"].ToString(), out L2); dr["AreaName"] = AreaName; dr["L1"] = L1; dr["S4"] = S4; dr["L2"] = L2; dr["S3"] = ""; dr["S5"] = i.ToString(); if (str != "") dt.Rows.Add(dr); } return dt; }
private DataTable GetExcel(string filepach) { string str; FarPoint.Win.Spread.FpSpread fpSpread1 = new FarPoint.Win.Spread.FpSpread(); try { fpSpread1.OpenExcel(filepach); } catch { string filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName(filepach); File.Copy(filepach, filepath1); fpSpread1.OpenExcel(filepath1); File.Delete(filepath1); } DataTable dt = new DataTable(); Hashtable h1 = new Hashtable(); int aa = 0; for (int k = 1; k <= fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; k++) { bool bl = false; GridColumn gc = this.ctrlSubstation_Info1.GridView.VisibleColumns[k - 1]; dt.Columns.Add(gc.FieldName); h1.Add(aa.ToString(), gc.FieldName); aa++; } int m = 3; for (int i = m; i < fpSpread1.Sheets[0].GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data); i++) { DataRow dr = dt.NewRow(); str = ""; for (int j = 0; j < fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; j++) { str = str + fpSpread1.Sheets[0].Cells[i, j].Text; dr[h1[j.ToString()].ToString()] = fpSpread1.Sheets[0].Cells[i, j].Text; } if (str != "") dt.Rows.Add(dr); } return dt; }
protected override void ss_CellClickEvent(object sender, FarPoint.Win.Spread.CellClickEventArgs e) { //base.ss_CellClickEvent(sender, e); FarPoint.Win.Spread.FpSpread oSpread = (FarPoint.Win.Spread.FpSpread)sender; if (oSpread.Name == "ss1") { if (e.Row >= ss1HaveRowCount) { // txt_p_row.Enabled = true; txt_p_row.Text = e.Row + 1 + ""; txt_slab_cnt.Text = e.Row - ss1HaveRowCount + 1 + ""; for (int i = 0; i < this.ss1_Sheet1.RowCount; i++) { //if (this.ss1_Sheet1.RowHeader.Cells[i, 0].Text != "") if (this.ss1_Sheet1.RowHeader.Cells[i, 0].Text == "入库") { Form_Ref(); this.ss1_Sheet1.ActiveRowIndex = e.Row; ssc_move_Click(ssc_move, new EventArgs()); break; } } ssc_move.Enabled = true; ssc_can.Enabled = true; txt_slab_cnt.Enabled = true; } else { ssc_move.Enabled = false; ssc_can.Enabled = false; txt_slab_cnt.Enabled = false; txt_p_row.Enabled = false; txt_slab_cnt.Text = ""; } // this.ss1.SetViewportTopRow(0, this.ss1_Sheet1.ActiveRowIndex); ////////////////////////////////20140408 // txt_slab_no.Text = this.ss1_Sheet1.Cells[e.Row, 1].Text; ///////////////////////////////////20140408 } else { if (e.Row >= ss2HaveRowCount) { // txt_p_row.Enabled = true; txt_p_row.Text = e.Row + 1 + ""; txt_slab_cnt.Text = e.Row - ss2HaveRowCount + 1 + ""; for (int i = 0; i < this.ss1_Sheet1.RowCount; i++) { if (this.ss1_Sheet1.RowHeader.Cells[i, 0].Text != "") { Form_Ref(); this.ss2_Sheet1.ActiveRowIndex = e.Row; ssc_move_Click(ssc_move, new EventArgs()); break; } } ssc_move.Enabled = true; ssc_can.Enabled = true; txt_slab_cnt.Enabled = true; } else { ssc_move.Enabled = false; ssc_can.Enabled = false; txt_slab_cnt.Enabled = false; txt_p_row.Enabled = false; txt_slab_cnt.Text = ""; } // this.ss1.SetViewportTopRow(0, this.ss2_Sheet1.ActiveRowIndex); } }
/// <summary> /// 设计器支持所需的方法 - 不要 /// 使用代码编辑器修改此方法的内容。 /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(ucCardManage)); this.panel1 = new Neusoft.FrameWork.WinForms.Controls.NeuPanel(); this.textBox1 = new Neusoft.FrameWork.WinForms.Controls.NeuTextBox(); this.label1 = new Neusoft.FrameWork.WinForms.Controls.NeuLabel(); this.panel2 = new Neusoft.FrameWork.WinForms.Controls.NeuPanel(); this.fpSpread1 = new FarPoint.Win.Spread.FpSpread(); this.fpSpread1_Sheet1 = new FarPoint.Win.Spread.SheetView(); this.panel1.SuspendLayout(); this.panel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1_Sheet1)).BeginInit(); this.SuspendLayout(); // // panel1 // this.panel1.Controls.Add(this.textBox1); this.panel1.Controls.Add(this.label1); this.panel1.Dock = System.Windows.Forms.DockStyle.Top; this.panel1.Location = new System.Drawing.Point(0, 57); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(1016, 39); this.panel1.TabIndex = 1; this.panel1.Visible = false; // // textBox1 // this.textBox1.Location = new System.Drawing.Point(80, 8); this.textBox1.Name = "textBox1"; this.textBox1.TabIndex = 1; this.textBox1.Text = ""; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(32, 8); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(29, 17); this.label1.TabIndex = 0; this.label1.Text = "查询"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // panel2 // this.panel2.Controls.Add(this.fpSpread1); this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; this.panel2.Location = new System.Drawing.Point(0, 96); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(1016, 645); this.panel2.TabIndex = 2; // // fpSpread1 // this.fpSpread1.Dock = System.Windows.Forms.DockStyle.Fill; this.fpSpread1.Location = new System.Drawing.Point(0, 0); this.fpSpread1.Name = "fpSpread1"; this.fpSpread1.Sheets.AddRange(new FarPoint.Win.Spread.SheetView[] { this.fpSpread1_Sheet1 }); this.fpSpread1.Size = new System.Drawing.Size(1016, 645); this.fpSpread1.TabIndex = 0; this.fpSpread1.CellDoubleClick += new FarPoint.Win.Spread.CellClickEventHandler(this.fpSpread1_CellDoubleClick); // // fpSpread1_Sheet1 // this.fpSpread1_Sheet1.Reset(); //this.fpSpread1_Sheet1.AutoSortColumns = ((FarPoint.Win.Spread.SheetView.SaveAutoSortColumns)(resources.GetObject("fpSpread1_Sheet1.AutoSortColumns"))); this.fpSpread1_Sheet1.OperationMode = FarPoint.Win.Spread.OperationMode.SingleSelect; this.fpSpread1_Sheet1.RowHeader.Columns.Default.Resizable = false; this.fpSpread1_Sheet1.SelectionPolicy = FarPoint.Win.Spread.Model.SelectionPolicy.Single; this.fpSpread1_Sheet1.SelectionUnit = FarPoint.Win.Spread.Model.SelectionUnit.Row; this.fpSpread1_Sheet1.SheetName = "Sheet1"; // // frmCardManage // this.ClientSize = new System.Drawing.Size(1016, 741); this.Controls.Add(this.panel2); this.Controls.Add(this.panel1); this.Name = "frmCardManage"; this.Text = "病案卡管理"; this.Load += new System.EventHandler(this.frmCardManage_Load); this.panel1.ResumeLayout(false); this.panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1_Sheet1)).EndInit(); this.ResumeLayout(false); }
/// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); FarPoint.Win.Spread.TipAppearance tipAppearance1 = new FarPoint.Win.Spread.TipAppearance(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmQueryMessage)); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.radioButton2 = new System.Windows.Forms.RadioButton(); this.radioButton1 = new System.Windows.Forms.RadioButton(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.dateTimePicker2 = new System.Windows.Forms.DateTimePicker(); this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker(); this.label1 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.comboBox1 = new Neusoft.FrameWork.WinForms.Controls.NeuComboBox(this.components); this.textBox1 = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); this.fpSpread1 = new FarPoint.Win.Spread.FpSpread(); this.fpSpread1_Sheet1 = new FarPoint.Win.Spread.SheetView(); this.toolBar1 = new System.Windows.Forms.ToolBar(); this.toolBarButton1 = new System.Windows.Forms.ToolBarButton(); this.toolBarButton2 = new System.Windows.Forms.ToolBarButton(); this.toolBarButton4 = new System.Windows.Forms.ToolBarButton(); this.toolBarButton3 = new System.Windows.Forms.ToolBarButton(); this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1_Sheet1)).BeginInit(); this.SuspendLayout(); // // groupBox1 // this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox1.Controls.Add(this.groupBox3); this.groupBox1.Controls.Add(this.radioButton2); this.groupBox1.Controls.Add(this.radioButton1); this.groupBox1.Controls.Add(this.groupBox2); this.groupBox1.Location = new System.Drawing.Point(8, 40); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(712, 115); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; // // groupBox3 // this.groupBox3.Location = new System.Drawing.Point(363, 18); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(333, 81); this.groupBox3.TabIndex = 10; this.groupBox3.TabStop = false; this.groupBox3.Text = "本人发通知查询"; // // radioButton2 // this.radioButton2.Location = new System.Drawing.Point(347, 22); this.radioButton2.Name = "radioButton2"; this.radioButton2.Size = new System.Drawing.Size(21, 24); this.radioButton2.TabIndex = 9; // // radioButton1 // this.radioButton1.Checked = true; this.radioButton1.Location = new System.Drawing.Point(8, 24); this.radioButton1.Name = "radioButton1"; this.radioButton1.Size = new System.Drawing.Size(13, 20); this.radioButton1.TabIndex = 8; this.radioButton1.TabStop = true; // // groupBox2 // this.groupBox2.Controls.Add(this.dateTimePicker2); this.groupBox2.Controls.Add(this.dateTimePicker1); this.groupBox2.Controls.Add(this.label1); this.groupBox2.Controls.Add(this.label3); this.groupBox2.Controls.Add(this.comboBox1); this.groupBox2.Controls.Add(this.textBox1); this.groupBox2.Location = new System.Drawing.Point(24, 19); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(306, 80); this.groupBox2.TabIndex = 7; this.groupBox2.TabStop = false; this.groupBox2.Text = "科室统计"; // // dateTimePicker2 // this.dateTimePicker2.CustomFormat = "yyyy-MM-dd 23:59:59"; this.dateTimePicker2.Format = System.Windows.Forms.DateTimePickerFormat.Custom; this.dateTimePicker2.Location = new System.Drawing.Point(200, 16); this.dateTimePicker2.Name = "dateTimePicker2"; this.dateTimePicker2.Size = new System.Drawing.Size(90, 21); this.dateTimePicker2.TabIndex = 2; // // dateTimePicker1 // this.dateTimePicker1.CustomFormat = "yyyy-MM-dd 00:00:00"; this.dateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Custom; this.dateTimePicker1.Location = new System.Drawing.Point(88, 16); this.dateTimePicker1.Name = "dateTimePicker1"; this.dateTimePicker1.Size = new System.Drawing.Size(88, 21); this.dateTimePicker1.TabIndex = 1; // // label1 // this.label1.Location = new System.Drawing.Point(8, 24); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(72, 16); this.label1.TabIndex = 0; this.label1.Text = "通知时间:"; // // label3 // this.label3.Location = new System.Drawing.Point(13, 47); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(72, 23); this.label3.TabIndex = 5; this.label3.Text = "接收科室:"; // // comboBox1 // this.comboBox1.ArrowBackColor = System.Drawing.Color.Silver; this.comboBox1.IsEnter2Tab = false; this.comboBox1.IsFlat = false; this.comboBox1.IsLike = true; this.comboBox1.Location = new System.Drawing.Point(94, 43); this.comboBox1.Name = "comboBox1"; this.comboBox1.PopForm = null; this.comboBox1.ShowCustomerList = false; this.comboBox1.ShowID = false; this.comboBox1.Size = new System.Drawing.Size(96, 20); this.comboBox1.Style = Neusoft.FrameWork.WinForms.Controls.StyleType.Fixed3D; this.comboBox1.TabIndex = 4; this.comboBox1.Tag = ""; this.comboBox1.ToolBarUse = false; this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); // // textBox1 // this.textBox1.BackColor = System.Drawing.SystemColors.Control; this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; this.textBox1.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.textBox1.Location = new System.Drawing.Point(182, 16); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(20, 23); this.textBox1.TabIndex = 9; this.textBox1.Text = "-"; // // label4 // this.label4.AutoSize = true; this.label4.ForeColor = System.Drawing.Color.Red; this.label4.Location = new System.Drawing.Point(16, 159); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(137, 12); this.label4.TabIndex = 6; this.label4.Text = "粉色代表没有处理的通知"; // // fpSpread1 // this.fpSpread1.About = "2.5.2007.2005"; this.fpSpread1.AccessibleDescription = "fpSpread1"; this.fpSpread1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.fpSpread1.Location = new System.Drawing.Point(8, 176); this.fpSpread1.Name = "fpSpread1"; this.fpSpread1.Sheets.AddRange(new FarPoint.Win.Spread.SheetView[] { this.fpSpread1_Sheet1 }); this.fpSpread1.Size = new System.Drawing.Size(704, 232); this.fpSpread1.TabIndex = 1; tipAppearance1.BackColor = System.Drawing.SystemColors.Info; tipAppearance1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); tipAppearance1.ForeColor = System.Drawing.SystemColors.InfoText; this.fpSpread1.TextTipAppearance = tipAppearance1; this.fpSpread1.CellDoubleClick += new FarPoint.Win.Spread.CellClickEventHandler(this.fpSpread1_CellDoubleClick); this.fpSpread1_Sheet1.Reset(); this.fpSpread1_Sheet1.SheetName = "Sheet1"; // Formulas and custom names must be loaded with R1C1 reference style this.fpSpread1_Sheet1.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.R1C1; this.fpSpread1_Sheet1.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.A1; // // toolBar1 // this.toolBar1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat; this.toolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] { this.toolBarButton1, this.toolBarButton2, this.toolBarButton4, this.toolBarButton3 }); this.toolBar1.DropDownArrows = true; this.toolBar1.ImageList = this.imageList1; this.toolBar1.Location = new System.Drawing.Point(0, 0); this.toolBar1.Name = "toolBar1"; this.toolBar1.ShowToolTips = true; this.toolBar1.Size = new System.Drawing.Size(720, 41); this.toolBar1.TabIndex = 2; this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick); // // toolBarButton1 // this.toolBarButton1.ImageIndex = 0; this.toolBarButton1.Name = "toolBarButton1"; this.toolBarButton1.Text = "查询"; // // toolBarButton2 // this.toolBarButton2.ImageIndex = 1; this.toolBarButton2.Name = "toolBarButton2"; this.toolBarButton2.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; // // toolBarButton4 // this.toolBarButton4.ImageIndex = 0; this.toolBarButton4.Name = "toolBarButton4"; this.toolBarButton4.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; // // toolBarButton3 // this.toolBarButton3.ImageIndex = 1; this.toolBarButton3.Name = "toolBarButton3"; this.toolBarButton3.Text = "退出"; // // imageList1 // this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); this.imageList1.TransparentColor = System.Drawing.Color.Transparent; this.imageList1.Images.SetKeyName(0, "退出.bmp"); this.imageList1.Images.SetKeyName(1, "查找.bmp"); // // frmQueryMessage // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.BackColor = System.Drawing.Color.White; this.ClientSize = new System.Drawing.Size(720, 422); this.Controls.Add(this.toolBar1); this.Controls.Add(this.fpSpread1); this.Controls.Add(this.groupBox1); this.Controls.Add(this.label4); this.Name = "frmQueryMessage"; this.Text = "查询通知信息"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.Load += new System.EventHandler(this.QueryMessage_Load); this.groupBox1.ResumeLayout(false); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1_Sheet1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); }
/// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器 /// 修改此方法的内容。 /// </summary> private void InitializeComponent() { FarPoint.Win.Spread.TipAppearance tipAppearance1 = new FarPoint.Win.Spread.TipAppearance(); this.fpSpread1 = new FarPoint.Win.Spread.FpSpread(); this.fpSpread1_Sheet1 = new FarPoint.Win.Spread.SheetView(); this.panel1 = new System.Windows.Forms.Panel(); this.splitter1 = new System.Windows.Forms.Splitter(); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1_Sheet1)).BeginInit(); this.SuspendLayout(); // // fpSpread1 // this.fpSpread1.About = "2.5.2007.2005"; this.fpSpread1.AccessibleDescription = ""; this.fpSpread1.BackColor = System.Drawing.Color.Transparent; this.fpSpread1.Dock = System.Windows.Forms.DockStyle.Fill; this.fpSpread1.Location = new System.Drawing.Point(203, 0); this.fpSpread1.Name = "fpSpread1"; this.fpSpread1.Sheets.AddRange(new FarPoint.Win.Spread.SheetView[] { this.fpSpread1_Sheet1 }); this.fpSpread1.Size = new System.Drawing.Size(389, 488); this.fpSpread1.TabIndex = 0; tipAppearance1.BackColor = System.Drawing.SystemColors.Info; tipAppearance1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); tipAppearance1.ForeColor = System.Drawing.SystemColors.InfoText; this.fpSpread1.TextTipAppearance = tipAppearance1; // // fpSpread1_Sheet1 // this.fpSpread1_Sheet1.Reset(); this.fpSpread1_Sheet1.SheetName = "Sheet1"; // Formulas and custom names must be loaded with R1C1 reference style this.fpSpread1_Sheet1.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.R1C1; this.fpSpread1_Sheet1.GrayAreaBackColor = System.Drawing.SystemColors.ActiveCaptionText; this.fpSpread1_Sheet1.OperationMode = FarPoint.Win.Spread.OperationMode.SingleSelect; this.fpSpread1_Sheet1.RowHeader.Columns.Get(0).Width = 39F; this.fpSpread1_Sheet1.SelectionPolicy = FarPoint.Win.Spread.Model.SelectionPolicy.Single; this.fpSpread1_Sheet1.SelectionUnit = FarPoint.Win.Spread.Model.SelectionUnit.Row; this.fpSpread1_Sheet1.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.A1; // // panel1 // this.panel1.Dock = System.Windows.Forms.DockStyle.Left; this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(200, 488); this.panel1.TabIndex = 1; // // splitter1 // this.splitter1.Location = new System.Drawing.Point(200, 0); this.splitter1.Name = "splitter1"; this.splitter1.Size = new System.Drawing.Size(3, 488); this.splitter1.TabIndex = 2; this.splitter1.TabStop = false; // // ucQCQuery // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.Controls.Add(this.fpSpread1); this.Controls.Add(this.splitter1); this.Controls.Add(this.panel1); this.Name = "ucQCQuery"; this.Size = new System.Drawing.Size(592, 488); this.Load += new System.EventHandler(this.ucQCQuery_Load); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1_Sheet1)).EndInit(); this.ResumeLayout(false); }
/// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmQueryPatient)); this.toolBar1 = new System.Windows.Forms.ToolBar(); this.toolBarButton4 = new System.Windows.Forms.ToolBarButton(); this.toolBarButton3 = new System.Windows.Forms.ToolBarButton(); this.toolBarButton1 = new System.Windows.Forms.ToolBarButton(); this.toolBarButton2 = new System.Windows.Forms.ToolBarButton(); this.imageList16 = new System.Windows.Forms.ImageList(this.components); this.panel1 = new System.Windows.Forms.Panel(); this.panel3 = new System.Windows.Forms.Panel(); this.fpSpread1 = new FarPoint.Win.Spread.FpSpread(); this.fpSpread1_Sheet1 = new FarPoint.Win.Spread.SheetView(); this.splitter1 = new System.Windows.Forms.Splitter(); this.panel2 = new System.Windows.Forms.Panel(); this.txtRefer4 = new System.Windows.Forms.ComboBox(); this.lblRefer4 = new System.Windows.Forms.Label(); this.txtRefer3 = new System.Windows.Forms.ComboBox(); this.txtRefer2 = new System.Windows.Forms.ComboBox(); this.txtRefer1 = new System.Windows.Forms.ComboBox(); this.cmbCondition = new System.Windows.Forms.ComboBox(); this.button1 = new System.Windows.Forms.Button(); this.lblRefer1 = new System.Windows.Forms.Label(); this.lblRefer3 = new System.Windows.Forms.Label(); this.lblRefer2 = new System.Windows.Forms.Label(); this.lblRefer1a = new System.Windows.Forms.Label(); this.panel1.SuspendLayout(); this.panel3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1_Sheet1)).BeginInit(); this.panel2.SuspendLayout(); this.SuspendLayout(); // // toolBar1 // this.toolBar1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat; this.toolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] { this.toolBarButton4, this.toolBarButton3, this.toolBarButton1, this.toolBarButton2 }); this.toolBar1.DropDownArrows = true; this.toolBar1.ImageList = this.imageList16; this.toolBar1.Location = new System.Drawing.Point(0, 0); this.toolBar1.Name = "toolBar1"; this.toolBar1.ShowToolTips = true; this.toolBar1.Size = new System.Drawing.Size(552, 41); this.toolBar1.TabIndex = 0; this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick); // // toolBarButton4 // this.toolBarButton4.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; // // toolBarButton3 // this.toolBarButton3.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; // // toolBarButton1 // this.toolBarButton1.ImageIndex = 4; this.toolBarButton1.Text = "查询"; // // toolBarButton2 // this.toolBarButton2.ImageIndex = 14; this.toolBarButton2.Text = "退出"; // // imageList16 // this.imageList16.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit; this.imageList16.ImageSize = new System.Drawing.Size(16, 16); this.imageList16.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList16.ImageStream"))); this.imageList16.TransparentColor = System.Drawing.Color.Transparent; // // panel1 // this.panel1.Controls.Add(this.panel3); this.panel1.Controls.Add(this.splitter1); this.panel1.Controls.Add(this.panel2); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(0, 41); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(552, 380); this.panel1.TabIndex = 1; // // panel3 // this.panel3.Controls.Add(this.fpSpread1); this.panel3.Dock = System.Windows.Forms.DockStyle.Fill; this.panel3.Location = new System.Drawing.Point(192, 0); this.panel3.Name = "panel3"; this.panel3.Size = new System.Drawing.Size(360, 380); this.panel3.TabIndex = 2; // // fpSpread1 // this.fpSpread1.Dock = System.Windows.Forms.DockStyle.Fill; this.fpSpread1.Location = new System.Drawing.Point(0, 0); this.fpSpread1.Name = "fpSpread1"; this.fpSpread1.Sheets.AddRange(new FarPoint.Win.Spread.SheetView[] { this.fpSpread1_Sheet1 }); this.fpSpread1.Size = new System.Drawing.Size(360, 380); this.fpSpread1.TabIndex = 0; this.fpSpread1.CellDoubleClick += new FarPoint.Win.Spread.CellClickEventHandler(this.fpSpread1_CellDoubleClick); // // fpSpread1_Sheet1 // this.fpSpread1_Sheet1.Reset(); this.fpSpread1_Sheet1.GrayAreaBackColor = System.Drawing.Color.White; this.fpSpread1_Sheet1.SheetName = "Sheet1"; // // splitter1 // this.splitter1.Location = new System.Drawing.Point(184, 0); this.splitter1.Name = "splitter1"; this.splitter1.Size = new System.Drawing.Size(8, 380); this.splitter1.TabIndex = 1; this.splitter1.TabStop = false; // // panel2 // this.panel2.Controls.Add(this.txtRefer4); this.panel2.Controls.Add(this.lblRefer4); this.panel2.Controls.Add(this.txtRefer3); this.panel2.Controls.Add(this.txtRefer2); this.panel2.Controls.Add(this.txtRefer1); this.panel2.Controls.Add(this.cmbCondition); this.panel2.Controls.Add(this.button1); this.panel2.Controls.Add(this.lblRefer1); this.panel2.Controls.Add(this.lblRefer3); this.panel2.Controls.Add(this.lblRefer2); this.panel2.Controls.Add(this.lblRefer1a); this.panel2.Dock = System.Windows.Forms.DockStyle.Left; this.panel2.Location = new System.Drawing.Point(0, 0); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(184, 380); this.panel2.TabIndex = 0; // // txtRefer4 // this.txtRefer4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.txtRefer4.Location = new System.Drawing.Point(53, 170); this.txtRefer4.Name = "txtRefer4"; this.txtRefer4.Size = new System.Drawing.Size(121, 20); this.txtRefer4.TabIndex = 14; this.txtRefer4.Text = "comboBox4"; // // lblRefer4 // this.lblRefer4.Location = new System.Drawing.Point(4, 175); this.lblRefer4.Name = "lblRefer4"; this.lblRefer4.Size = new System.Drawing.Size(40, 16); this.lblRefer4.TabIndex = 13; this.lblRefer4.Text = "label3"; // // txtRefer3 // this.txtRefer3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.txtRefer3.Location = new System.Drawing.Point(52, 135); this.txtRefer3.Name = "txtRefer3"; this.txtRefer3.Size = new System.Drawing.Size(121, 20); this.txtRefer3.TabIndex = 12; this.txtRefer3.Text = "comboBox4"; // // txtRefer2 // this.txtRefer2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.txtRefer2.Location = new System.Drawing.Point(52, 98); this.txtRefer2.Name = "txtRefer2"; this.txtRefer2.Size = new System.Drawing.Size(121, 20); this.txtRefer2.TabIndex = 11; this.txtRefer2.Text = "comboBox3"; // // txtRefer1 // this.txtRefer1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.txtRefer1.Location = new System.Drawing.Point(52, 61); this.txtRefer1.Name = "txtRefer1"; this.txtRefer1.Size = new System.Drawing.Size(121, 20); this.txtRefer1.TabIndex = 10; this.txtRefer1.Text = "comboBox2"; // // cmbCondition // this.cmbCondition.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.cmbCondition.Location = new System.Drawing.Point(52, 24); this.cmbCondition.Name = "cmbCondition"; this.cmbCondition.Size = new System.Drawing.Size(121, 20); this.cmbCondition.TabIndex = 9; this.cmbCondition.Text = "comboBox1"; this.cmbCondition.SelectedIndexChanged += new System.EventHandler(this.cmbCondition_SelectedIndexChanged); // // button1 // this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.button1.Location = new System.Drawing.Point(72, 226); this.button1.Name = "button1"; this.button1.TabIndex = 8; this.button1.Text = "查询"; this.button1.Click += new System.EventHandler(this.btnQuery_Click); // // lblRefer1 // this.lblRefer1.Location = new System.Drawing.Point(3, 64); this.lblRefer1.Name = "lblRefer1"; this.lblRefer1.Size = new System.Drawing.Size(40, 16); this.lblRefer1.TabIndex = 6; this.lblRefer1.Text = "label4"; // // lblRefer3 // this.lblRefer3.Location = new System.Drawing.Point(3, 140); this.lblRefer3.Name = "lblRefer3"; this.lblRefer3.Size = new System.Drawing.Size(40, 16); this.lblRefer3.TabIndex = 4; this.lblRefer3.Text = "label3"; // // lblRefer2 // this.lblRefer2.Location = new System.Drawing.Point(3, 102); this.lblRefer2.Name = "lblRefer2"; this.lblRefer2.Size = new System.Drawing.Size(40, 16); this.lblRefer2.TabIndex = 2; this.lblRefer2.Text = "label2"; // // lblRefer1a // this.lblRefer1a.Location = new System.Drawing.Point(3, 26); this.lblRefer1a.Name = "lblRefer1a"; this.lblRefer1a.Size = new System.Drawing.Size(40, 16); this.lblRefer1a.TabIndex = 0; this.lblRefer1a.Text = "条件"; // // frmQueryPatient // this.AcceptButton = this.button1; this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.ClientSize = new System.Drawing.Size(552, 421); this.Controls.Add(this.panel1); this.Controls.Add(this.toolBar1); this.Name = "frmQueryPatient"; this.Text = "患者查询"; this.Load += new System.EventHandler(this.frmQueryPatient_Load); this.panel1.ResumeLayout(false); this.panel3.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1_Sheet1)).EndInit(); this.panel2.ResumeLayout(false); this.ResumeLayout(false); }
public void PrintGrdMeeting(FarPoint.Win.Spread.FpSpread Grd) { string sql = "", lsCol = "", lsAccess = "", ls = "", lsAddress = "", lsMemName = "", lsMemName1 = ""; string lsCol3 = "", lsCol2 = "", lsCol1 = "", lsBreakPage = "", lsBreakPageTemp = "", col9 = ""; Int32 ii = 0, liSort = 0, breakPage = 0; Boolean lbFlag = false; lsAccess = lsIni.GetString("thahr30", "accessdatabase", "0"); sql = "Delete From rptreport"; OleDbConnection acc = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + lsAccess + ";"); acc.Open(); OleDbCommand accCom = new OleDbCommand(sql, acc); accCom.ExecuteNonQuery(); for (int i = 0; i <= Grd.Sheets[0].RowCount - 1; i++) { try { sql = Grd.Sheets[0].GetText(i, 0); lsMemName = Grd.Sheets[0].GetText(i, 2); lsCol1 = Grd.Sheets[0].GetText(i, 1); lsCol2 = Grd.Sheets[0].GetText(i, 4); lsCol3 = Grd.Sheets[0].GetText(i, 5); col9 = Grd.Sheets[0].GetText(i, 9); if (lsMemName.Length > 1) { lsBreakPage = lsMemName.Substring(0, 1); //if lsbr lsBreakPageTemp = lsBreakPage; breakPage++; //lsBreakPage += breakPage.ToString(); if (breakPage > 5) { breakPage = 0; } } if (lsMemName == "SIMA THANI HOTEL") { //lsBreakPage = ""; } lsMemName = lsMemName.Replace("'", "''"); lsCol1 = lsCol1.Replace("'", "''"); lsCol2 = lsCol2.Replace("'", "''"); lsCol3 = lsCol3.Replace("'", "''"); col9 = col9.Replace("'", "''"); liSort = i; //if (lsMemName != lsMemName1) //{ // lsMemName1 = lsMemName; // ii = 0; //} //else //{ // ii++; //} //lbFlag = Convert.ToBoolean(Grd.Sheets[0].GetValue(i, 0)); //if (lbFlag) //{ sql = "Insert Into rptreport(code, name, col1, " + "col2, col3, col4, 01, 02, col5) " + "Values('" + i.ToString() + "','" + lsMemName + "','" + lsCol1 + "','" + lsCol2 + "','" + lsCol3 + "','" + lsBreakPage + "'," + liSort + "," + breakPage + ",'" + col9 + "')"; OleDbCommand accCom2 = new OleDbCommand(sql, acc); accCom2.ExecuteNonQuery(); //} } catch (Exception e) { MessageBox.Show(ls + "\n" + " " + e.Message.ToString(), e.Source.ToString(), MessageBoxButtons.OK); } } sql = "Select count(*) as cnt, name From rptreport Group by name"; accCom.CommandText = sql; OleDbDataReader accRead; accRead = accCom.ExecuteReader(); if (accRead.HasRows) { while (accRead.Read()) { lsMemName = accRead["name"].ToString(); ii = Convert.ToInt32(accRead["cnt"]); if (ii < 5) { for (Int32 iii = 1; iii <= 5 - ii; iii++) { lsMemName = lsMemName.Replace("'", "''"); if (lsMemName.Length > 1) { lsBreakPage = lsMemName.Substring(0, 1); //if lsbr lsBreakPageTemp = Convert.ToString(10000 + iii); } liSort = 10000 + iii; sql = "Insert Into rptreport(code, name, col1, " + "col2, col3, col4, 01) " + "Values('" + lsBreakPageTemp + "','" + lsMemName + "','.','.','.','" + lsBreakPage + "'," + liSort + ")"; OleDbCommand accCom3 = new OleDbCommand(sql, acc); accCom3.ExecuteNonQuery(); } } } } accRead.Close(); acc.Close(); }
public void PrintGrdMeetingLabel(FarPoint.Win.Spread.FpSpread Grd, string aMeetingNameT, string aMeetingDescription, string aMeetingPlace) { string sql = "", lsCol = "", lsAccess = "", ls = "", lsAddress = "", lsMemName = "", lsMemName1 = ""; string lsCol3 = "", lsCol5 = "", lsCol2 = "", lsCol1 = "", lsMeetingNameT = "", lsMeetingDescription = "", lsMeetingPlace = ""; Int32 ii = 0; Boolean lbFlag = false; lsAccess = lsIni.GetString("thahr30", "accessdatabase", "0"); sql = "Delete From rptreport"; OleDbConnection acc = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + lsAccess + ";"); acc.Open(); OleDbConnection accselect = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + lsAccess + ";"); accselect.Open(); OleDbCommand accCom = new OleDbCommand(sql, acc); OleDbCommand accComselect = new OleDbCommand(sql, accselect); OleDbDataReader rs; accCom.ExecuteNonQuery(); lsMeetingNameT = aMeetingNameT.Replace("'", "''"); lsMeetingDescription = aMeetingDescription.Replace("'", "''"); lsMeetingPlace = aMeetingPlace.Replace("'", "''"); int NumberData = 0; string dd; for (int i = 0; i <= Grd.Sheets[0].RowCount - 1; i++) { try { sql = Grd.Sheets[0].GetText(i, 0); lsMemName = Grd.Sheets[0].GetText(i, 2); lsCol1 = Grd.Sheets[0].GetText(i, 1); lsCol2 = Grd.Sheets[0].GetText(i, 3); lsCol3 = Grd.Sheets[0].GetText(i, 4); lsCol5 = Grd.Sheets[0].GetText(i, 8); dd = Grd.Sheets[0].Cells[i, 8].Column.DataField.ToLower(); lsMemName = lsMemName.Replace("'", "''"); lsCol1 = lsCol1.Replace("'", "''"); lsCol2 = lsCol2.Replace("'", "''"); lsCol3 = lsCol3.Replace("'", "''"); if (lsMemName == "FIRST HOTEL") { sql = ""; } if ((lsCol5 == "1") || (lsCol5.ToLower() == "true")) { //sql = "Select name From rptreport Where name = '" + lsMemName + "' and col4 ='-'"; //accComselect.CommandText = sql; //rs = accComselect.ExecuteReader(); //if (rs.HasRows) //{ // //sql = "Insert Into rptreport(code, name, col4, " // // + "col5, col6, col7, col8, col9, col10) " // // + "Values('" + i.ToString() + "','" + lsMemName + "','" + lsCol1 // // + "','" + lsCol2 + "','" + lsCol3 + "','" + lsMeetingNameT + "','" + lsMeetingDescription + "','" + lsMeetingPlace + "','" + lsCol5 + "')"; // sql = "Update rptreport Set col4 = '" + lsCol1 + "', col5 = '"+lsCol2+"', " // +"col6 = '"+lsCol2+"', col7='"+lsMeetingNameT+"', col8='"+lsMeetingDescription+"', " // + "col9 = '" + lsMeetingPlace + "', col10='" + lsCol5 + "' Where name = '"+lsMemName+"' and col4 = '-'"; //} //else //{ // sql = "Insert Into rptreport(code, name, col1, " // + "col2, col3,col7, " // + "col8, col9, col10, col4) " // + "Values('" + i.ToString() + "','" + lsMemName + "','" + lsCol1 // + "','" + lsCol2 + "','" + lsCol3 + "','" + lsMeetingNameT + "','" // + lsMeetingDescription + "','" + lsMeetingPlace + "','" + lsCol5 + "','-')"; //} //rs.Close(); if ((NumberData % 2) != 0) { sql = "Update rptreport Set col4 = '" + lsCol1 + "', col5 = '" + lsMemName + "', " + "col6 = '" + lsCol2 + "', col7='" + lsMeetingNameT + "', col8='" + lsMeetingDescription + "', " + "col9 = '" + lsMeetingPlace + "', col10='" + lsCol5 + "' Where code = '" + (NumberData - 1) + "'"; } else { sql = "Insert Into rptreport(code, name, col1, " + "col2, col3,col7, " + "col8, col9, col10, col4) " + "Values('" + NumberData.ToString() + "','" + lsMemName + "','" + lsCol1 + "','" + lsCol2 + "','" + lsCol3 + "','" + lsMeetingNameT + "','" + lsMeetingDescription + "','" + lsMeetingPlace + "','" + lsCol5 + "','-')"; } NumberData++; OleDbCommand accCom2 = new OleDbCommand(sql, acc); accCom2.ExecuteNonQuery(); } } catch (Exception e) { MessageBox.Show(ls + "\n" + " " + e.Message.ToString(), e.Source.ToString(), MessageBoxButtons.OK); } } acc.Close(); }
public static void InitSpread(FarPoint.Win.Spread.FpSpread spdCtl, bool bRowHearder, bool bSort) { FarPoint.Win.Spread.SheetSkin spSkin; try { FarPoint.Win.Spread.DefaultSpreadSkins.GetAt(1).Apply(spdCtl); spSkin = new FarPoint.Win.Spread.SheetSkin("InitSkin", System.Drawing.Color.White, System.Drawing.Color.Empty, System.Drawing.Color.Empty, System.Drawing.Color.White, FarPoint.Win.Spread.GridLines.Both, System.Drawing.Color.FromArgb(108, 144, 188), System.Drawing.Color.White, System.Drawing.Color.FromArgb(192, 192, 255), System.Drawing.Color.White, System.Drawing.Color.Empty, System.Drawing.Color.White, //System.Drawing.Color.FromArgb(231, 231, 255), //System.Drawing.Color.FromArgb(247, 247, 222), true, true, false, true, bRowHearder); spdCtl.BorderStyle = BorderStyle.FixedSingle; spdCtl.BackColor = System.Drawing.Color.Silver; spdCtl.HorizontalScrollBarPolicy = FarPoint.Win.Spread.ScrollBarPolicy.AsNeeded; spdCtl.VerticalScrollBarPolicy = FarPoint.Win.Spread.ScrollBarPolicy.AsNeeded; spdCtl.MoveActiveOnFocus = true; spdCtl.ColumnSplitBoxAlignment = FarPoint.Win.Spread.SplitBoxAlignment.Leading; spdCtl.ColumnSplitBoxPolicy = FarPoint.Win.Spread.SplitBoxPolicy.AsNeeded; spdCtl.RowSplitBoxPolicy = FarPoint.Win.Spread.SplitBoxPolicy.Never; spdCtl.SetCursor(FarPoint.Win.Spread.CursorType.Normal, System.Windows.Forms.Cursors.Arrow); for (int i = 0; i < spdCtl.Sheets.Count; i++) { //"Verdana", "Tahoma", "Times New Roman", "돋움" Font myFonts = new Font("Tahoma", 8F, FontStyle.Regular); spSkin.Apply(spdCtl.Sheets[i]); spdCtl.Sheets[i].RowCount = 0; spdCtl.Sheets[i].OperationMode = FarPoint.Win.Spread.OperationMode.Normal; spdCtl.Sheets[i].Columns[-1].VerticalAlignment = FarPoint.Win.Spread.CellVerticalAlignment.Center; spdCtl.Sheets[i].ColumnHeader.DefaultStyle.Font = myFonts; spdCtl.Sheets[i].DefaultStyle.Font = myFonts; spdCtl.Sheets[i].DefaultStyle.VerticalAlignment = FarPoint.Win.Spread.CellVerticalAlignment.Center; // Auto sort setting. spdCtl.Sheets[i].SetColumnAllowAutoSort(0, spdCtl.Sheets[i].ColumnCount, bSort); spdCtl.Sheets[i].ColumnHeader.AutoSortIndex = 0; } } catch (Exception ex) { throw ex; } }
/// <summary> /// 设计器支持所需的方法 - 不要 /// 使用代码编辑器修改此方法的内容。 /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmReport)); FarPoint.Win.Spread.TipAppearance tipAppearance1 = new FarPoint.Win.Spread.TipAppearance(); this.barManager1 = new DevExpress.XtraBars.BarManager(); this.bar1 = new DevExpress.XtraBars.Bar(); this.barBtnSave = new DevExpress.XtraBars.BarButtonItem(); this.barBtnRefrehData = new DevExpress.XtraBars.BarButtonItem(); this.barButtonItem1 = new DevExpress.XtraBars.BarButtonItem(); this.barBtnDiaoChu = new DevExpress.XtraBars.BarButtonItem(); this.barBtnClose = new DevExpress.XtraBars.BarButtonItem(); this.barDockControlTop = new DevExpress.XtraBars.BarDockControl(); this.barDockControlBottom = new DevExpress.XtraBars.BarDockControl(); this.barDockControlLeft = new DevExpress.XtraBars.BarDockControl(); this.barDockControlRight = new DevExpress.XtraBars.BarDockControl(); this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.barCheckItem1 = new DevExpress.XtraBars.BarCheckItem(); this.fpSpread1 = new FarPoint.Win.Spread.FpSpread(); ((System.ComponentModel.ISupportInitialize)(this.barManager1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1)).BeginInit(); this.SuspendLayout(); // // barManager1 // this.barManager1.Bars.AddRange(new DevExpress.XtraBars.Bar[] { this.bar1}); this.barManager1.DockControls.Add(this.barDockControlTop); this.barManager1.DockControls.Add(this.barDockControlBottom); this.barManager1.DockControls.Add(this.barDockControlLeft); this.barManager1.DockControls.Add(this.barDockControlRight); this.barManager1.Form = this; this.barManager1.Images = this.imageList1; this.barManager1.Items.AddRange(new DevExpress.XtraBars.BarItem[] { this.barBtnSave, this.barCheckItem1, this.barBtnRefrehData, this.barBtnDiaoChu, this.barBtnClose, this.barButtonItem1}); this.barManager1.MainMenu = this.bar1; this.barManager1.MaxItemId = 6; // // bar1 // this.bar1.BarName = "Custom 1"; this.bar1.DockCol = 0; this.bar1.DockRow = 0; this.bar1.DockStyle = DevExpress.XtraBars.BarDockStyle.Top; this.bar1.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] { new DevExpress.XtraBars.LinkPersistInfo(DevExpress.XtraBars.BarLinkUserDefines.PaintStyle, this.barBtnSave, DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph), new DevExpress.XtraBars.LinkPersistInfo(DevExpress.XtraBars.BarLinkUserDefines.PaintStyle, this.barBtnRefrehData, DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph), new DevExpress.XtraBars.LinkPersistInfo(this.barButtonItem1), new DevExpress.XtraBars.LinkPersistInfo(DevExpress.XtraBars.BarLinkUserDefines.PaintStyle, this.barBtnDiaoChu, DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph), new DevExpress.XtraBars.LinkPersistInfo(DevExpress.XtraBars.BarLinkUserDefines.PaintStyle, this.barBtnClose, DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph)}); this.bar1.OptionsBar.MultiLine = true; this.bar1.OptionsBar.UseWholeRow = true; this.bar1.Text = "Custom 1"; // // barBtnSave // this.barBtnSave.Caption = "保存"; this.barBtnSave.Id = 0; this.barBtnSave.ImageIndex = 0; this.barBtnSave.Name = "barBtnSave"; this.barBtnSave.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.barBtnSave_ItemClick); // // barBtnRefrehData // this.barBtnRefrehData.Caption = "更新数据"; this.barBtnRefrehData.Id = 2; this.barBtnRefrehData.ImageIndex = 14; this.barBtnRefrehData.Name = "barBtnRefrehData"; this.barBtnRefrehData.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.barBtnRefrehData_ItemClick); // // barButtonItem1 // this.barButtonItem1.Caption = "统计"; this.barButtonItem1.Id = 5; this.barButtonItem1.ImageIndex = 1; this.barButtonItem1.Name = "barButtonItem1"; this.barButtonItem1.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph; this.barButtonItem1.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barButtonItem1.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.barButtonItem1_ItemClick); // // barBtnDiaoChu // this.barBtnDiaoChu.Caption = "导出"; this.barBtnDiaoChu.Id = 3; this.barBtnDiaoChu.ImageIndex = 5; this.barBtnDiaoChu.Name = "barBtnDiaoChu"; this.barBtnDiaoChu.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.barBtnDiaoChu_ItemClick); // // barBtnClose // this.barBtnClose.Caption = "关闭"; this.barBtnClose.Id = 4; this.barBtnClose.ImageIndex = 7; this.barBtnClose.Name = "barBtnClose"; this.barBtnClose.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.barBtnClose_ItemClick); // // imageList1 // this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); this.imageList1.TransparentColor = System.Drawing.Color.Transparent; this.imageList1.Images.SetKeyName(0, "保存.ico"); this.imageList1.Images.SetKeyName(1, "布局.ico"); this.imageList1.Images.SetKeyName(2, "查询.ico"); this.imageList1.Images.SetKeyName(3, "打回重新编.ico"); this.imageList1.Images.SetKeyName(4, "打印.ico"); this.imageList1.Images.SetKeyName(5, "发送.ico"); this.imageList1.Images.SetKeyName(6, "工具.ico"); this.imageList1.Images.SetKeyName(7, "关闭1.ico"); this.imageList1.Images.SetKeyName(8, "关闭.ico"); this.imageList1.Images.SetKeyName(9, "角色.ico"); this.imageList1.Images.SetKeyName(10, "删除.ico"); this.imageList1.Images.SetKeyName(11, "审核.ico"); this.imageList1.Images.SetKeyName(12, "审批.ico"); this.imageList1.Images.SetKeyName(13, "授权.ico"); this.imageList1.Images.SetKeyName(14, "刷新.ico"); this.imageList1.Images.SetKeyName(15, "添加同级.ico"); this.imageList1.Images.SetKeyName(16, "添加下级.ico"); this.imageList1.Images.SetKeyName(17, "新建.ico"); this.imageList1.Images.SetKeyName(18, "修改.ico"); this.imageList1.Images.SetKeyName(19, "作废.ico"); // // barCheckItem1 // this.barCheckItem1.Id = 1; this.barCheckItem1.Name = "barCheckItem1"; // // fpSpread1 // this.fpSpread1.AccessibleDescription = "fpSpread1"; this.fpSpread1.BackColor = System.Drawing.SystemColors.Control; this.fpSpread1.Location = new System.Drawing.Point(0, 30); this.fpSpread1.Name = "fpSpread1"; this.fpSpread1.Size = new System.Drawing.Size(612, 446); this.fpSpread1.TabIndex = 4; tipAppearance1.BackColor = System.Drawing.SystemColors.Info; tipAppearance1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); tipAppearance1.ForeColor = System.Drawing.SystemColors.InfoText; this.fpSpread1.TextTipAppearance = tipAppearance1; this.fpSpread1.SheetTabClick += new FarPoint.Win.Spread.SheetTabClickEventHandler(this.fpSpread1_SheetTabClick); this.fpSpread1.ActiveSheetIndex = -1; // // FrmReport // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(612, 473); this.Controls.Add(this.fpSpread1); this.Controls.Add(this.barDockControlLeft); this.Controls.Add(this.barDockControlRight); this.Controls.Add(this.barDockControlBottom); this.Controls.Add(this.barDockControlTop); this.Name = "FrmReport"; this.Text = "FrmReport"; this.Load += new System.EventHandler(this.FrmGYDWGH_Load); ((System.ComponentModel.ISupportInitialize)(this.barManager1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1)).EndInit(); this.ResumeLayout(false); }
/// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器 /// 修改此方法的内容。 /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); FarPoint.Win.Spread.TipAppearance tipAppearance1 = new FarPoint.Win.Spread.TipAppearance(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ucQCInfo)); this.panel1 = new System.Windows.Forms.Panel(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabPage2 = new System.Windows.Forms.TabPage(); this.fpSpread1 = new FarPoint.Win.Spread.FpSpread(); this.fpSpread1_Sheet1 = new FarPoint.Win.Spread.SheetView(); this.toolBar1 = new System.Windows.Forms.ToolBar(); this.toolBarButton1 = new System.Windows.Forms.ToolBarButton(); this.toolBarButton2 = new System.Windows.Forms.ToolBarButton(); this.tbAdd = new System.Windows.Forms.ToolBarButton(); this.tbDel = new System.Windows.Forms.ToolBarButton(); this.tbSave = new System.Windows.Forms.ToolBarButton(); this.imageList32 = new System.Windows.Forms.ImageList(this.components); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); this.tabPage2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1_Sheet1)).BeginInit(); this.SuspendLayout(); // // panel1 // this.panel1.AutoScroll = true; this.panel1.BackColor = System.Drawing.Color.Honeydew; this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(480, 383); this.panel1.TabIndex = 0; // // tabControl1 // this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Controls.Add(this.tabPage2); this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.tabControl1.Location = new System.Drawing.Point(0, 0); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; this.tabControl1.Size = new System.Drawing.Size(488, 408); this.tabControl1.TabIndex = 1; // // tabPage1 // this.tabPage1.Controls.Add(this.panel1); this.tabPage1.Location = new System.Drawing.Point(4, 21); this.tabPage1.Name = "tabPage1"; this.tabPage1.Size = new System.Drawing.Size(480, 383); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "信息"; // // tabPage2 // this.tabPage2.Controls.Add(this.fpSpread1); this.tabPage2.Controls.Add(this.toolBar1); this.tabPage2.Location = new System.Drawing.Point(4, 21); this.tabPage2.Name = "tabPage2"; this.tabPage2.Size = new System.Drawing.Size(480, 383); this.tabPage2.TabIndex = 1; this.tabPage2.Text = "事件"; // // fpSpread1 // this.fpSpread1.About = "2.5.2007.2005"; this.fpSpread1.AccessibleDescription = ""; this.fpSpread1.Dock = System.Windows.Forms.DockStyle.Fill; this.fpSpread1.EditModePermanent = true; this.fpSpread1.HorizontalScrollBarPolicy = FarPoint.Win.Spread.ScrollBarPolicy.Never; this.fpSpread1.Location = new System.Drawing.Point(0, 36); this.fpSpread1.Name = "fpSpread1"; this.fpSpread1.Sheets.AddRange(new FarPoint.Win.Spread.SheetView[] { this.fpSpread1_Sheet1 }); this.fpSpread1.Size = new System.Drawing.Size(480, 347); this.fpSpread1.TabIndex = 0; tipAppearance1.BackColor = System.Drawing.SystemColors.Info; tipAppearance1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); tipAppearance1.ForeColor = System.Drawing.SystemColors.InfoText; this.fpSpread1.TextTipAppearance = tipAppearance1; this.fpSpread1.VerticalScrollBarPolicy = FarPoint.Win.Spread.ScrollBarPolicy.AsNeeded; // // fpSpread1_Sheet1 // this.fpSpread1_Sheet1.Reset(); this.fpSpread1_Sheet1.SheetName = "Sheet1"; // Formulas and custom names must be loaded with R1C1 reference style this.fpSpread1_Sheet1.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.R1C1; this.fpSpread1_Sheet1.ColumnCount = 3; this.fpSpread1_Sheet1.RowCount = 5; this.fpSpread1_Sheet1.ColumnHeader.Cells.Get(0, 0).Value = "名称"; this.fpSpread1_Sheet1.ColumnHeader.Cells.Get(0, 1).Value = "数值"; this.fpSpread1_Sheet1.ColumnHeader.Cells.Get(0, 2).Value = "备注"; this.fpSpread1_Sheet1.Columns.Get(0).Label = "名称"; this.fpSpread1_Sheet1.Columns.Get(0).Width = 135F; this.fpSpread1_Sheet1.Columns.Get(1).Label = "数值"; this.fpSpread1_Sheet1.Columns.Get(1).Width = 135F; this.fpSpread1_Sheet1.Columns.Get(2).Label = "备注"; this.fpSpread1_Sheet1.Columns.Get(2).Width = 135F; this.fpSpread1_Sheet1.RowHeader.Columns.Default.Resizable = false; this.fpSpread1_Sheet1.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.A1; // // toolBar1 // this.toolBar1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat; this.toolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] { this.toolBarButton1, this.toolBarButton2, this.tbAdd, this.tbDel, this.tbSave }); this.toolBar1.ButtonSize = new System.Drawing.Size(16, 16); this.toolBar1.DropDownArrows = true; this.toolBar1.ImageList = this.imageList32; this.toolBar1.Location = new System.Drawing.Point(0, 0); this.toolBar1.Name = "toolBar1"; this.toolBar1.ShowToolTips = true; this.toolBar1.Size = new System.Drawing.Size(480, 36); this.toolBar1.TabIndex = 1; this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick); // // toolBarButton1 // this.toolBarButton1.Name = "toolBarButton1"; this.toolBarButton1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; // // toolBarButton2 // this.toolBarButton2.Name = "toolBarButton2"; this.toolBarButton2.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; // // tbAdd // this.tbAdd.ImageIndex = 0; this.tbAdd.Name = "tbAdd"; this.tbAdd.Style = System.Windows.Forms.ToolBarButtonStyle.ToggleButton; this.tbAdd.ToolTipText = "添加"; this.tbAdd.Visible = false; // // tbDel // this.tbDel.ImageIndex = 1; this.tbDel.Name = "tbDel"; this.tbDel.ToolTipText = "删除"; this.tbDel.Visible = false; // // tbSave // this.tbSave.ImageIndex = 5; this.tbSave.Name = "tbSave"; this.tbSave.ToolTipText = "保存"; // // imageList32 // this.imageList32.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList32.ImageStream"))); this.imageList32.TransparentColor = System.Drawing.Color.Transparent; this.imageList32.Images.SetKeyName(0, ""); this.imageList32.Images.SetKeyName(1, ""); this.imageList32.Images.SetKeyName(2, ""); this.imageList32.Images.SetKeyName(3, ""); this.imageList32.Images.SetKeyName(4, ""); this.imageList32.Images.SetKeyName(5, ""); this.imageList32.Images.SetKeyName(6, ""); this.imageList32.Images.SetKeyName(7, ""); this.imageList32.Images.SetKeyName(8, ""); this.imageList32.Images.SetKeyName(9, ""); this.imageList32.Images.SetKeyName(10, ""); this.imageList32.Images.SetKeyName(11, ""); this.imageList32.Images.SetKeyName(12, ""); this.imageList32.Images.SetKeyName(13, ""); this.imageList32.Images.SetKeyName(14, ""); this.imageList32.Images.SetKeyName(15, ""); this.imageList32.Images.SetKeyName(16, ""); this.imageList32.Images.SetKeyName(17, ""); this.imageList32.Images.SetKeyName(18, ""); this.imageList32.Images.SetKeyName(19, ""); this.imageList32.Images.SetKeyName(20, ""); this.imageList32.Images.SetKeyName(21, ""); this.imageList32.Images.SetKeyName(22, ""); this.imageList32.Images.SetKeyName(23, ""); this.imageList32.Images.SetKeyName(24, ""); this.imageList32.Images.SetKeyName(25, ""); this.imageList32.Images.SetKeyName(26, ""); this.imageList32.Images.SetKeyName(27, ""); this.imageList32.Images.SetKeyName(28, ""); this.imageList32.Images.SetKeyName(29, ""); this.imageList32.Images.SetKeyName(30, ""); this.imageList32.Images.SetKeyName(31, ""); this.imageList32.Images.SetKeyName(32, ""); this.imageList32.Images.SetKeyName(33, ""); this.imageList32.Images.SetKeyName(34, ""); this.imageList32.Images.SetKeyName(35, ""); this.imageList32.Images.SetKeyName(36, ""); this.imageList32.Images.SetKeyName(37, ""); // // ucQCInfo // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.Controls.Add(this.tabControl1); this.Name = "ucQCInfo"; this.Size = new System.Drawing.Size(488, 408); this.Load += new System.EventHandler(this.ucQCInfo_Load); this.tabControl1.ResumeLayout(false); this.tabPage1.ResumeLayout(false); this.tabPage2.ResumeLayout(false); this.tabPage2.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1_Sheet1)).EndInit(); this.ResumeLayout(false); }
private DataTable GetExcel(string filepach) { string str; FarPoint.Win.Spread.FpSpread fpSpread1 = new FarPoint.Win.Spread.FpSpread(); try { fpSpread1.OpenExcel(filepach); } catch { string filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName(filepach); File.Copy(filepach, filepath1); fpSpread1.OpenExcel(filepath1); File.Delete(filepath1); } DataTable dt = new DataTable(); Hashtable h1 = new Hashtable(); int aa = 0; string[] col = new string[14]{"S3", "AreaName", "Title", "L1", "L2", "L3", "L4","L5", "L9","L10","S1","S2","S4","S5" }; IList<string> filedList = new List<string>(); IList<string> capList = new List<string>(); for (int i = 0; i < ctrlSubstation_Info1.GridView.Bands.Count; i++) { if (ctrlSubstation_Info1.GridView.Bands[i].Children.Count > 0) { for (int j = 0; j < ctrlSubstation_Info1.GridView.Bands[i].Children.Count; j++) { capList.Add(ctrlSubstation_Info1.GridView.Bands[i].Children[j].Caption); filedList.Add(ctrlSubstation_Info1.GridView.Bands[i].Children[j].Columns[0].FieldName); } continue; } capList.Add(ctrlSubstation_Info1.GridView.Bands[i].Caption); filedList.Add(ctrlSubstation_Info1.GridView.Bands[i].Columns[0].FieldName); } int[] colnum = new int[7] {0,2,6,8,9,7,11 };//�������� int c = 0; //for (int k = 1; k <= fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; k++) //{ // bool bl = false; // GridColumn gc = this.ctrlSubstation_Info1.GridView.VisibleColumns[k - 1]; // dt.Columns.Add(gc.FieldName); // h1.Add(aa.ToString(), gc.FieldName); // aa++; //} IList<string> fie = new List<string>(); int cn=0; int gong = 65; int m = 1; string L1 = ""; string S4 = ""; string L2 = ""; string AreaName = ""; string temStr=""; for (int j = 0; j < fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; j++) { if(capList.Contains(fpSpread1.Sheets[0].Cells[0, j].Text)) fie.Add(filedList[capList.IndexOf(fpSpread1.Sheets[0].Cells[0, j].Text)]); if (fpSpread1.Sheets[0].Cells[0, j].Text == "" && m==1) { fie.Add("L13"); fie.Add("L14"); fie.Add("S6"); m = 2; } } for (int k = 0; k < fie.Count; k++) { dt.Columns.Add(fie[k]); } for (int i = m; i <= fpSpread1.Sheets[0].GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data); i++) { DataRow dr = dt.NewRow(); str = ""; for (int j = 0; j < fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; j++) { dr[fie[j]] = fpSpread1.Sheets[0].Cells[i, j].Text; try { if (fie[j] == "S6") { if (dr[fie[j]].ToString() == "") dr[fie[j]] = string.Format("{0:f1}",double.Parse(dr["L14"].ToString())*100 / double.Parse(dr["L13"].ToString())); } if (fie[j] == "L10") { if (dr[fie[j]].ToString() == "") dr[fie[j]] = string.Format("{0:f1}",double.Parse(dr["L9"].ToString())*100 / double.Parse(dr["L2"].ToString())); } } catch { } } // GetL2(dr["L4"].ToString(), out L2); // dr["AreaName"] = AreaName; dr["L1"] = L1; dr["S4"] = S4; dr["L2"] = L2; dr["S3"] = ""; dr["S5"] = i.ToString(); // if (str != "") dt.Rows.Add(dr); } return dt; }
public void Render_Grillas(string Tipo, FarPoint.Win.Spread.FpSpread vaspri, DataTable dtn_render, int Canres) { // --Renderizado vaspri.ActiveSheet.ColumnHeader.Rows.Get(0).Height = 30; var celltext = new FarPoint.Win.Spread.CellType.TextCellType(); celltext.ReadOnly = true; var cellnumber = new FarPoint.Win.Spread.CellType.NumberCellType(); cellnumber.ReadOnly = true; cellnumber.Separator = ","; cellnumber.ShowSeparator = true; cellnumber.DecimalPlaces = 2; cellnumber.NegativeRed = true; var cellfecha = new FarPoint.Win.Spread.CellType.DateTimeCellType(); cellfecha.ReadOnly = true; cellfecha.DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.ShortDate; cellnumber.MaximumValue = 99999999999999.00; for (int c = 0; c <= vaspri.ActiveSheet.ColumnCount - Canres; c++) { if (Strings.Left(dtn_render.Rows[0][c].ToString().Trim(), 1) == "S") { vaspri.ActiveSheet.ColumnHeader.Columns.Get(c).BackColor = Color.Khaki; vaspri.ActiveSheet.Columns[c].CellType = celltext; vaspri.ActiveSheet.Columns[c].Width = float.Parse(Strings.Right(dtn_render.Rows[0][c].ToString().Trim(), dtn_render.Rows[0][c].ToString().Trim().Length - 9)); } else if (Strings.Left(dtn_render.Rows[0][c].ToString().Trim(), 1) == "N") { vaspri.ActiveSheet.ColumnHeader.Columns.Get(c).BackColor = Color.AliceBlue; vaspri.ActiveSheet.Columns[c].CellType = cellnumber; vaspri.ActiveSheet.Columns[c].Width = float.Parse(Strings.Right(dtn_render.Rows[0][c].ToString().Trim(), dtn_render.Rows[0][c].ToString().Trim().Length - 9)); } else { vaspri.ActiveSheet.ColumnHeader.Columns.Get(c).BackColor = Color.Khaki; vaspri.ActiveSheet.Columns[c].CellType = cellfecha; vaspri.ActiveSheet.Columns[c].Width = float.Parse(Strings.Right(dtn_render.Rows[0][c].ToString().Trim(), dtn_render.Rows[0][c].ToString().Trim().Length - 9)); } if (Strings.Mid(dtn_render.Rows[0][c].ToString().Trim(), dtn_render.Rows[0][c].ToString().Trim().IndexOf("-") + 2, 1) == "1") { vaspri.ActiveSheet.Columns[c].AllowAutoFilter = true; } else { vaspri.ActiveSheet.Columns[c].AllowAutoFilter = false; } //vaspri.ActiveSheet.Columns[c].AllowAutoFilter = Strings.Mid(dtn_render.Rows[0][c].ToString().Trim(), dtn_render.Rows[0][c].ToString().Trim().IndexOf("-") + 2, 1); if (Strings.Mid(dtn_render.Rows[0][c].ToString().Trim(), dtn_render.Rows[0][c].ToString().Trim().IndexOf("%") + 2, 1) == "1") { vaspri.ActiveSheet.Columns[c].AllowAutoSort = true; } else { vaspri.ActiveSheet.Columns[c].AllowAutoSort = false; } //vaspri.ActiveSheet.Columns[c].AllowAutoSort = Strings.Mid(dtn_render.Rows[0][c].ToString().Trim(), dtn_render.Rows[0][c].ToString().Trim().IndexOf("%") + 2, 1); if (Strings.Mid(dtn_render.Rows[0][c].ToString().Trim(), dtn_render.Rows[0][c].ToString().Trim().IndexOf("/") + 2, 1) == "1") { vaspri.ActiveSheet.Columns[c].MergePolicy = FarPoint.Win.Spread.Model.MergePolicy.Always; } else { vaspri.ActiveSheet.Columns[c].MergePolicy = FarPoint.Win.Spread.Model.MergePolicy.None; } if (Strings.Mid(dtn_render.Rows[0][c].ToString().Trim(), dtn_render.Rows[0][c].ToString().Trim().IndexOf("@") + 2, 1) == "1") { vaspri.ActiveSheet.Columns[c].Visible = true; } else { vaspri.ActiveSheet.Columns[c].Visible = false; } } for (int cc = 0, loopTo1 = vaspri.ActiveSheet.ColumnCount - 1; cc <= loopTo1; cc++) { for (int f = 0, loopTo2 = vaspri.ActiveSheet.RowCount - 1; f <= loopTo2; f++) { if (vaspri.ActiveSheet.Cells[f, cc].Text.ToString().Trim() == "Total:") { vaspri.ActiveSheet.Rows[f].BackColor = Color.Khaki; } } } if (dtn_render.Rows.Count > 0) { if (dtn_render.Rows[0][dtn_render.Columns.Count - 1].ToString().Trim() != "") { vaspri.ActiveSheet.RowCount = vaspri.ActiveSheet.RowCount + 1; vaspri.ActiveSheet.Cells[vaspri.ActiveSheet.RowCount - 1, 0].CellType = celltext; vaspri.ActiveSheet.AddSpanCell(vaspri.ActiveSheet.RowCount - 1, 0, 1, vaspri.ActiveSheet.Columns.Count); vaspri.ActiveSheet.Cells[vaspri.ActiveSheet.RowCount - 1, 0].Text = dtn_render.Rows[0][dtn_render.Columns.Count - 1].ToString().Trim(); // vsp_general_ventas.ActiveSheet.Rows(vsp_general_ventas.ActiveSheet.RowCount - 1).BackColor = Color.LightGreen vaspri.ActiveSheet.Rows[vaspri.ActiveSheet.Rows.Count - 1].Font = new Font("Tahoma", 12, FontStyle.Bold); vaspri.ActiveSheet.Rows[vaspri.ActiveSheet.Rows.Count - 1].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center; vaspri.ActiveSheet.MoveRow(vaspri.ActiveSheet.RowCount - 1, 0, true); vaspri.ActiveSheet.FrozenRowCount = 1; if (Strings.Left(dtn_render.Rows[0][dtn_render.Columns.Count - 1].ToString().Trim(), 1) == "*") { vaspri.ActiveSheet.FrozenTrailingRowCount = 1; } } } }
public static void InitSpread(FarPoint.Win.Spread.FpSpread spdCtl, bool bRowHearder) { InitSpread(spdCtl, bRowHearder, true); }
/// <summary> /// 设计器支持所需的方法 - 不要 /// 使用代码编辑器修改此方法的内容。 /// </summary> private void InitializeComponent() { FarPoint.Win.Spread.CellType.TextCellType textCellType1 = new FarPoint.Win.Spread.CellType.TextCellType(); FarPoint.Win.Spread.CellType.TextCellType textCellType2 = new FarPoint.Win.Spread.CellType.TextCellType(); FarPoint.Win.Spread.CellType.TextCellType textCellType3 = new FarPoint.Win.Spread.CellType.TextCellType(); FarPoint.Win.Spread.CellType.TextCellType textCellType4 = new FarPoint.Win.Spread.CellType.TextCellType(); FarPoint.Win.Spread.CellType.TextCellType textCellType5 = new FarPoint.Win.Spread.CellType.TextCellType(); FarPoint.Win.Spread.CellType.TextCellType textCellType6 = new FarPoint.Win.Spread.CellType.TextCellType(); FarPoint.Win.Spread.CellType.TextCellType textCellType7 = new FarPoint.Win.Spread.CellType.TextCellType(); FarPoint.Win.Spread.CellType.TextCellType textCellType8 = new FarPoint.Win.Spread.CellType.TextCellType(); this.fpSpread1 = new FarPoint.Win.Spread.FpSpread(); this.fpSpread1_Sheet1 = new FarPoint.Win.Spread.SheetView(); this.lbTitle = new Neusoft.FrameWork.WinForms.Controls.NeuLabel(); this.lbDate = new Neusoft.FrameWork.WinForms.Controls.NeuLabel(); this.panelList = new Neusoft.FrameWork.WinForms.Controls.NeuPanel(); this.groupBox1 = new Neusoft.FrameWork.WinForms.Controls.NeuGroupBox(); this.lbType = new Neusoft.FrameWork.WinForms.Controls.PopUpListBox(); this.label1 = new Neusoft.FrameWork.WinForms.Controls.NeuLabel(); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1_Sheet1)).BeginInit(); this.panelList.SuspendLayout(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // fpSpread1 // this.fpSpread1.AllowDragDrop = true; this.fpSpread1.AllowDrop = true; this.fpSpread1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.fpSpread1.BackColor = System.Drawing.SystemColors.Window; this.fpSpread1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.fpSpread1.ButtonDrawMode = FarPoint.Win.Spread.ButtonDrawModes.CurrentCell; this.fpSpread1.EditModePermanent = true; this.fpSpread1.EditModeReplace = true; this.fpSpread1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134))); this.fpSpread1.HorizontalScrollBarPolicy = FarPoint.Win.Spread.ScrollBarPolicy.AsNeeded; this.fpSpread1.Location = new System.Drawing.Point(8, 52); this.fpSpread1.Name = "fpSpread1"; this.fpSpread1.Sheets.AddRange(new FarPoint.Win.Spread.SheetView[] { this.fpSpread1_Sheet1 }); this.fpSpread1.Size = new System.Drawing.Size(642, 372); this.fpSpread1.TabIndex = 0; this.fpSpread1.TextTipPolicy = FarPoint.Win.Spread.TextTipPolicy.Fixed; this.fpSpread1.VerticalScrollBarPolicy = FarPoint.Win.Spread.ScrollBarPolicy.AsNeeded; this.fpSpread1.DragOver += new System.Windows.Forms.DragEventHandler(this.fpSpread1_DragOver); this.fpSpread1.EditModeOn += new System.EventHandler(this.fpSpread1_EditModeOn); this.fpSpread1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.fpSpread1_MouseMove); this.fpSpread1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.fpSpread1_MouseDown); this.fpSpread1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.fpSpread1_MouseUp); this.fpSpread1.EditModeOff += new System.EventHandler(this.fpSpread1_EditModeOff); this.fpSpread1.DragDrop += new System.Windows.Forms.DragEventHandler(this.fpSpread1_DragDrop); this.fpSpread1.CellClick += new FarPoint.Win.Spread.CellClickEventHandler(this.fpSpread1_CellClick); this.fpSpread1.EditChange += new FarPoint.Win.Spread.EditorNotifyEventHandler(this.fpSpread1_EditChange); // // fpSpread1_Sheet1 // this.fpSpread1_Sheet1.Reset(); this.fpSpread1_Sheet1.ColumnCount = 10; this.fpSpread1_Sheet1.RowCount = 0; this.fpSpread1_Sheet1.RowHeader.ColumnCount = 0; this.fpSpread1_Sheet1.ActiveSkin = new FarPoint.Win.Spread.SheetSkin("CustomSkin2", System.Drawing.SystemColors.Window, System.Drawing.Color.Empty, System.Drawing.Color.Empty, System.Drawing.SystemColors.WindowText, FarPoint.Win.Spread.GridLines.Both, System.Drawing.Color.White, System.Drawing.Color.Empty, System.Drawing.Color.Empty, System.Drawing.Color.Empty, System.Drawing.Color.Empty, System.Drawing.Color.Empty, true, false, false, true, false); this.fpSpread1_Sheet1.ColumnHeader.Cells.Get(0, 0).Text = "序号"; this.fpSpread1_Sheet1.ColumnHeader.Cells.Get(0, 1).Text = "姓名"; this.fpSpread1_Sheet1.ColumnHeader.DefaultStyle.BackColor = System.Drawing.Color.White; this.fpSpread1_Sheet1.ColumnHeader.DefaultStyle.Parent = "HeaderDefault"; this.fpSpread1_Sheet1.Columns.Get(0).Label = "序号"; this.fpSpread1_Sheet1.Columns.Get(0).Width = 42F; this.fpSpread1_Sheet1.Columns.Get(1).CellType = textCellType1; this.fpSpread1_Sheet1.Columns.Get(1).HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.General; this.fpSpread1_Sheet1.Columns.Get(1).Label = "姓名"; this.fpSpread1_Sheet1.Columns.Get(1).Width = 98F; this.fpSpread1_Sheet1.Columns.Get(2).CellType = textCellType2; this.fpSpread1_Sheet1.Columns.Get(2).HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center; this.fpSpread1_Sheet1.Columns.Get(2).Width = 85F; this.fpSpread1_Sheet1.Columns.Get(3).CellType = textCellType3; this.fpSpread1_Sheet1.Columns.Get(3).HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center; this.fpSpread1_Sheet1.Columns.Get(3).Width = 85F; this.fpSpread1_Sheet1.Columns.Get(4).CellType = textCellType4; this.fpSpread1_Sheet1.Columns.Get(4).HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center; this.fpSpread1_Sheet1.Columns.Get(4).Width = 85F; this.fpSpread1_Sheet1.Columns.Get(5).CellType = textCellType5; this.fpSpread1_Sheet1.Columns.Get(5).HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center; this.fpSpread1_Sheet1.Columns.Get(5).Width = 85F; this.fpSpread1_Sheet1.Columns.Get(6).CellType = textCellType6; this.fpSpread1_Sheet1.Columns.Get(6).HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center; this.fpSpread1_Sheet1.Columns.Get(6).Width = 85F; this.fpSpread1_Sheet1.Columns.Get(7).CellType = textCellType7; this.fpSpread1_Sheet1.Columns.Get(7).HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center; this.fpSpread1_Sheet1.Columns.Get(7).Width = 85F; this.fpSpread1_Sheet1.Columns.Get(8).CellType = textCellType8; this.fpSpread1_Sheet1.Columns.Get(8).HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center; this.fpSpread1_Sheet1.Columns.Get(8).Width = 85F; this.fpSpread1_Sheet1.Columns.Get(9).Visible = false; this.fpSpread1_Sheet1.RowHeader.Columns.Default.Resizable = false; this.fpSpread1_Sheet1.RowHeader.DefaultStyle.BackColor = System.Drawing.Color.White; this.fpSpread1_Sheet1.RowHeader.DefaultStyle.Parent = "HeaderDefault"; this.fpSpread1_Sheet1.RowHeader.Visible = false; this.fpSpread1_Sheet1.SheetCornerStyle.BackColor = System.Drawing.Color.White; this.fpSpread1_Sheet1.SheetCornerStyle.Parent = "HeaderDefault"; this.fpSpread1_Sheet1.SheetName = "Sheet1"; // // lbTitle // this.lbTitle.Font = new System.Drawing.Font("黑体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134))); this.lbTitle.Location = new System.Drawing.Point(230, 13); this.lbTitle.Name = "lbTitle"; this.lbTitle.Size = new System.Drawing.Size(238, 26); this.lbTitle.TabIndex = 0; this.lbTitle.Text = "科室排班表"; this.lbTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // lbDate // this.lbDate.Location = new System.Drawing.Point(472, 28); this.lbDate.Name = "lbDate"; this.lbDate.Size = new System.Drawing.Size(176, 19); this.lbDate.TabIndex = 1; this.lbDate.Text = "排班时间:"; // // panelList // this.panelList.BackColor = System.Drawing.SystemColors.Control; this.panelList.Controls.Add(this.groupBox1); this.panelList.Location = new System.Drawing.Point(334, 169); this.panelList.Name = "panelList"; this.panelList.Size = new System.Drawing.Size(184, 230); this.panelList.TabIndex = 2; // // groupBox1 // this.groupBox1.BackColor = System.Drawing.Color.Silver; this.groupBox1.Controls.Add(this.lbType); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBox1.Font = new System.Drawing.Font("宋体", 1F); this.groupBox1.Location = new System.Drawing.Point(0, 0); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(184, 230); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; // // lbType // this.lbType.BackColor = System.Drawing.Color.Silver; this.lbType.BorderStyle = System.Windows.Forms.BorderStyle.None; this.lbType.Cursor = System.Windows.Forms.Cursors.Hand; this.lbType.Font = new System.Drawing.Font("宋体", 11F); this.lbType.HorizontalScrollbar = true; this.lbType.InputCode = 0; this.lbType.IsShowID = true; this.lbType.ItemHeight = 15; this.lbType.Location = new System.Drawing.Point(5, 22); this.lbType.Name = "lbType"; this.lbType.SelectNone = false; this.lbType.Size = new System.Drawing.Size(174, 195); this.lbType.TabIndex = 1; // // label1 // this.label1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.label1.Location = new System.Drawing.Point(4, 21); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(176, 205); this.label1.TabIndex = 0; // // ucTabular // this.BackColor = System.Drawing.SystemColors.Window; this.Controls.Add(this.panelList); this.Controls.Add(this.lbDate); this.Controls.Add(this.lbTitle); this.Controls.Add(this.fpSpread1); this.Name = "ucTabular"; this.Size = new System.Drawing.Size(658, 431); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1_Sheet1)).EndInit(); this.panelList.ResumeLayout(false); this.groupBox1.ResumeLayout(false); this.ResumeLayout(false); }
private DataTable GetExcel(string filepach) { string str; FarPoint.Win.Spread.FpSpread fpSpread1 = new FarPoint.Win.Spread.FpSpread(); try { fpSpread1.OpenExcel(filepach); } catch { string filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName(filepach); File.Copy(filepach, filepath1); fpSpread1.OpenExcel(filepath1); File.Delete(filepath1); } DataTable dt = new DataTable(); //for (int k = 1; k < fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; k++) //{ // //dt.Columns.Add("col" + k.ToString()); //} for (int k = 0; k <=fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) ; k++) { foreach (TreeListColumn tlc in this.treeList1.Columns) { if (tlc.Caption == fpSpread1.Sheets[0].Cells[3, k].Text && (tlc.FieldName == "RongLiang" || tlc.FieldName == "ChangDu")) { dt.Columns.Add(tlc.FieldName); } else if (tlc.Caption == fpSpread1.Sheets[0].Cells[3, k].Text && tlc.FieldName.IndexOf("年") >= 0) { dt.Columns.Add(tlc.FieldName); } else if (tlc.Caption == fpSpread1.Sheets[0].Cells[2, k].Text) { dt.Columns.Add(tlc.FieldName); } } ////TreeListColumn gc = this.treeList1.Columns[k]; ////if (gc.VisibleIndex != -1) //// dt.Columns.Add(gc.FieldName); } for (int i =4; i < fpSpread1.Sheets[0].GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data); i++) { DataRow dr = dt.NewRow(); str = ""; for (int j = 0; j < fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; j++) { str = str + fpSpread1.Sheets[0].Cells[i, j].Text; dr[j] = fpSpread1.Sheets[0].Cells[i, j].Text; } if (str != "") dt.Rows.Add(dr); } return dt; }
private DataTable GetExcel(string filepach) { string str; FarPoint.Win.Spread.FpSpread fpSpread1 = new FarPoint.Win.Spread.FpSpread(); try { fpSpread1.OpenExcel(filepach); } catch { string filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName(filepach); File.Copy(filepach, filepath1); fpSpread1.OpenExcel(filepath1); File.Delete(filepath1); } DataTable dt = new DataTable(); Hashtable h1 = new Hashtable(); int aa = 0; for (int k = 0; k <= fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; k++) { bool bl = false; GridColumn gc = this.ctrlSubstation_Info_LangFang1.GridView.VisibleColumns[k - 1]; //dt.Columns.Add(gc.FieldName); //h1.Add(aa.ToString(), gc.FieldName); //aa++; foreach (GridColumn tlc in this.ctrlSubstation_Info_LangFang1.GridView.Columns) { if (tlc.Caption == fpSpread1.Sheets[0].Cells[2, k].Text && (tlc.FieldName == "L23" || tlc.FieldName == "L13" || tlc.FieldName == "L14" || tlc.FieldName == "L15" || tlc.FieldName == "L16" || tlc.FieldName == "L17" || tlc.FieldName == "L18" || tlc.FieldName == "L19" || tlc.FieldName == "L20" || tlc.FieldName == "L7" || tlc.FieldName == "L8" || tlc.FieldName == "L11" || tlc.FieldName == "L12")) { //if (fpSpread1.Sheets[0].Cells[1, k].Text=="500"||fpSpread1.Sheets[0].Cells[1, k].Text=="220"||fpSpread1.Sheets[0].Cells[1, k].Text=="110"||fpSpread1.Sheets[0].Cells[1, k].Text=="35"||fpSpread1.Sheets[0].Cells[1, k].Text=="6"||fpSpread1.Sheets[0].Cells[1, k].Text=="10") { dt.Columns.Add(tlc.FieldName); //h1.Add(aa.ToString(), tlc.FieldName); if (!h1.Contains(tlc.Caption)) { h1.Add(tlc.Caption, tlc.FieldName); } //aa++; } } //else if (tlc.Caption == fpSpread1.Sheets[0].Cells[2, k].Text && tlc.FieldName.IndexOf("年") >= 0) //{ // dt.Columns.Add(tlc.FieldName); //} else if (tlc.Caption == fpSpread1.Sheets[0].Cells[0, k].Text) { dt.Columns.Add(tlc.FieldName); h1.Add(tlc.Caption, tlc.FieldName); //h1.Add(aa.ToString(), tlc.FieldName); //aa++; } } } this.ctrlSubstation_Info_LangFang1.GridView.SaveLayoutToXml(@"C:\Documents and Settings\Administrator\桌面\aauuyy.xml"); int m = 1; for (int i = m; i < fpSpread1.Sheets[0].GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; i++) { DataRow dr = dt.NewRow(); str = ""; for (int j = 0; j < fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; j++) { try { str = str + fpSpread1.Sheets[0].Cells[i, j].Text; //dr[h1[j.ToString()].ToString()] = fpSpread1.Sheets[0].Cells[i, j].Text; //dr[j] = fpSpread1.Sheets[0].Cells[i, j].Text; if (h1[fpSpread1.Sheets[0].Cells[2, j].Text] != null) { dr[h1[fpSpread1.Sheets[0].Cells[2, j].Text].ToString()] = fpSpread1.Sheets[0].Cells[i, j].Text; } } catch { } } if (str != "") { dt.Rows.Add(dr); } } return(dt); }
private DataTable GetExcel(string filepach) { FarPoint.Win.Spread.FpSpread fpSpread1 = new FarPoint.Win.Spread.FpSpread(); try { fpSpread1.OpenExcel(filepach); } catch { string filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName(filepach); File.Copy(filepach, filepath1); fpSpread1.OpenExcel(filepath1); File.Delete(filepath1); } DataTable dt = new DataTable(); Hashtable h1 = new Hashtable(); int aa = 0; IList<string> filedList = new List<string>(); IList<string> capList = new List<string>(); for (int i = 0; i < treeList1.Columns.Count; i++) { if (treeList1.Columns[i].VisibleIndex < 0) { if (treeList1.Columns[i].FieldName == "ParentID") capList.Add("父ID"); else { capList.Add(treeList1.Columns[i].FieldName); } } else { if (treeList1.Columns[i].FieldName != "Title") capList.Add(treeList1.Columns[i].Caption); else { capList.Add("项目"); } } filedList.Add(treeList1.Columns[i].FieldName); } if ( !capList.Contains("父ID")) { capList.Add("父ID"); filedList.Add("ParentID"); } int c = 0; IList<string> fie = new List<string>(); int cn = 0; int gong = 65; int m = 3; string L1 = ""; string S4 = ""; string L2 = ""; string AreaName = ""; string temStr = ""; for (int j = 0; j < fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; j++) { if (capList.Contains(fpSpread1.Sheets[0].Cells[2, j].Text)) fie.Add(filedList[capList.IndexOf(fpSpread1.Sheets[0].Cells[2, j].Text)]); } for (int k = 0; k < fie.Count; k++) { dt.Columns.Add(fie[k]); } for (int i = m; i < fpSpread1.Sheets[0].GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data); i++) { DataRow dr = dt.NewRow(); for (int j = 0, fiej = 0; fiej < fie.Count && j < fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; j++) { // dr[fie[j]] = fpSpread1.Sheets[0].Cells[i, j].Text.Trim(); if (capList.IndexOf(fpSpread1.Sheets[0].Cells[2, j].Text) < 0) { // fiej = j - 1; continue; } // if (fie.Contains(filedList[capList.IndexOf(fpSpread1.Sheets[0].Cells[2, j].Text)])) // dr[fie[fie.IndexOf(filedList[capList.IndexOf(fpSpread1.Sheets[0].Cells[2, j].Text)])]] = fpSpread1.Sheets[0].Cells[i, j].Text.Trim(); dr[fie[fiej]] = fpSpread1.Sheets[0].Cells[i, j].Text.Trim(); fiej++; } // GetL2(dr["L4"].ToString(), out L2); // dr["AreaName"] = AreaName; dr["L1"] = L1; dr["S4"] = S4; dr["L2"] = L2; dr["S3"] = ""; dr["S5"] = i.ToString(); // if (str != "") dt.Rows.Add(dr); } return dt; }
/// <summary> /// 加载数据同时保存数据到指定位置 /// </summary> /// <param name="obj"></param> private void AddData(FarPoint.Win.Spread.FpSpread obj) { wait = new WaitDialogForm("", "正在加载数据, 请稍候..."); try { //打开Excel表格 //清空工作表 fpSpread1.Sheets.Clear(); obj.OpenExcel(System.Windows.Forms.Application.StartupPath + "\\xls\\投资估算.xls"); PF.SpreadRemoveEmptyCells(obj); //this.AddCellChanged(); //this.barEditItem2.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; //S4_2_1.AddBarEditItems(this.barEditItem2, this.barEditItem1, this); } catch (System.Exception e) { //如果打开出错则重新生成并保存 LoadData(); //判断文件夹是否存在,不存在则创建 if (!Directory.Exists(System.Windows.Forms.Application.StartupPath + "\\xls")) { Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath + "\\xls"); } //保存EXcel文件 obj.SaveExcel(System.Windows.Forms.Application.StartupPath + "\\xls\\投资估算.xls", FarPoint.Excel.ExcelSaveFlags.NoFlagsSet); // 定义要使用的Excel 组件接口 // 定义Application 对象,此对象表示整个Excel 程序 Microsoft.Office.Interop.Excel.Application excelApp = null; // 定义Workbook对象,此对象代表工作薄 Microsoft.Office.Interop.Excel.Workbook workBook; // 定义Worksheet 对象,此对象表示Execel 中的一张工作表 Microsoft.Office.Interop.Excel.Worksheet ws = null; Microsoft.Office.Interop.Excel.Range range = null; excelApp = new Microsoft.Office.Interop.Excel.Application(); string filename = System.Windows.Forms.Application.StartupPath + "\\xls\\投资估算.xls"; workBook = excelApp.Workbooks.Open(filename, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value); for (int i = 1; i <= workBook.Worksheets.Count; i++) { ws = (Microsoft.Office.Interop.Excel.Worksheet)workBook.Worksheets[i]; //取消保护工作表 ws.Unprotect(Missing.Value); //有数据的行数 int row = ws.UsedRange.Rows.Count; //有数据的列数 int col = ws.UsedRange.Columns.Count; //创建一个区域 range = ws.get_Range(ws.Cells[1, 1], ws.Cells[row, col]); //设区域内的单元格自动换行 range.WrapText = true; //保护工作表 ws.Protect(Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value); } //保存工作簿 workBook.Save(); //关闭工作簿 excelApp.Workbooks.Close(); } wait.Close(); }
/// <summary> /// 设计器支持所需的方法 - 不要 /// 使用代码编辑器修改此方法的内容。 /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); FarPoint.Win.Spread.TipAppearance tipAppearance1 = new FarPoint.Win.Spread.TipAppearance(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmPDWXZ)); this.fpSpread1 = new FarPoint.Win.Spread.FpSpread(); this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.barManager1 = new DevExpress.XtraBars.BarManager(); this.bar1 = new DevExpress.XtraBars.Bar(); this.barBtnSave = new DevExpress.XtraBars.BarButtonItem(); this.barBtnRefreshData = new DevExpress.XtraBars.BarButtonItem(); this.barBtnDaochuExcel = new DevExpress.XtraBars.BarButtonItem(); this.barBtnClose = new DevExpress.XtraBars.BarButtonItem(); this.barStaticItem1 = new DevExpress.XtraBars.BarStaticItem(); this.BcobYear = new DevExpress.XtraBars.BarEditItem(); this.repositoryItemComboBox1 = new DevExpress.XtraEditors.Repository.RepositoryItemComboBox(); this.barDockControlTop = new DevExpress.XtraBars.BarDockControl(); this.barDockControlBottom = new DevExpress.XtraBars.BarDockControl(); this.barDockControlLeft = new DevExpress.XtraBars.BarDockControl(); this.barDockControlRight = new DevExpress.XtraBars.BarDockControl(); this.repositoryItemTextEdit1 = new DevExpress.XtraEditors.Repository.RepositoryItemTextEdit(); this.repositoryItemComboBox2 = new DevExpress.XtraEditors.Repository.RepositoryItemComboBox(); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.barManager1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.repositoryItemComboBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.repositoryItemTextEdit1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.repositoryItemComboBox2)).BeginInit(); this.SuspendLayout(); // // fpSpread1 // this.fpSpread1.AccessibleDescription = "fpSpread1"; this.fpSpread1.Location = new System.Drawing.Point(0, 28); this.fpSpread1.Name = "fpSpread1"; this.fpSpread1.Size = new System.Drawing.Size(612, 446); this.fpSpread1.TabIndex = 9; tipAppearance1.BackColor = System.Drawing.SystemColors.Info; tipAppearance1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); tipAppearance1.ForeColor = System.Drawing.SystemColors.InfoText; this.fpSpread1.TextTipAppearance = tipAppearance1; this.fpSpread1.ActiveSheetIndex = -1; // // imageList1 // this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); this.imageList1.TransparentColor = System.Drawing.Color.Transparent; this.imageList1.Images.SetKeyName(0, "保存.ico"); this.imageList1.Images.SetKeyName(1, "布局.ico"); this.imageList1.Images.SetKeyName(2, "查询.ico"); this.imageList1.Images.SetKeyName(3, "打回重新编.ico"); this.imageList1.Images.SetKeyName(4, "打印.ico"); this.imageList1.Images.SetKeyName(5, "发送.ico"); this.imageList1.Images.SetKeyName(6, "工具.ico"); this.imageList1.Images.SetKeyName(7, "关闭1.ico"); this.imageList1.Images.SetKeyName(8, "关闭.ico"); this.imageList1.Images.SetKeyName(9, "角色.ico"); this.imageList1.Images.SetKeyName(10, "删除.ico"); this.imageList1.Images.SetKeyName(11, "审核.ico"); this.imageList1.Images.SetKeyName(12, "审批.ico"); this.imageList1.Images.SetKeyName(13, "授权.ico"); this.imageList1.Images.SetKeyName(14, "刷新.ico"); this.imageList1.Images.SetKeyName(15, "添加同级.ico"); this.imageList1.Images.SetKeyName(16, "添加下级.ico"); this.imageList1.Images.SetKeyName(17, "新建.ico"); this.imageList1.Images.SetKeyName(18, "修改.ico"); this.imageList1.Images.SetKeyName(19, "作废.ico"); // // barManager1 // this.barManager1.Bars.AddRange(new DevExpress.XtraBars.Bar[] { this.bar1}); this.barManager1.DockControls.Add(this.barDockControlTop); this.barManager1.DockControls.Add(this.barDockControlBottom); this.barManager1.DockControls.Add(this.barDockControlLeft); this.barManager1.DockControls.Add(this.barDockControlRight); this.barManager1.Form = this; this.barManager1.Images = this.imageList1; this.barManager1.Items.AddRange(new DevExpress.XtraBars.BarItem[] { this.barBtnSave, this.barBtnRefreshData, this.barBtnDaochuExcel, this.barBtnClose, this.BcobYear, this.barStaticItem1}); this.barManager1.MainMenu = this.bar1; this.barManager1.MaxItemId = 9; this.barManager1.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] { this.repositoryItemTextEdit1, this.repositoryItemComboBox1, this.repositoryItemComboBox2}); // // bar1 // this.bar1.BarName = "Custom 1"; this.bar1.DockCol = 0; this.bar1.DockRow = 0; this.bar1.DockStyle = DevExpress.XtraBars.BarDockStyle.Top; this.bar1.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] { new DevExpress.XtraBars.LinkPersistInfo(DevExpress.XtraBars.BarLinkUserDefines.PaintStyle, this.barBtnSave, DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph), new DevExpress.XtraBars.LinkPersistInfo(DevExpress.XtraBars.BarLinkUserDefines.PaintStyle, this.barBtnRefreshData, DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph), new DevExpress.XtraBars.LinkPersistInfo(DevExpress.XtraBars.BarLinkUserDefines.PaintStyle, this.barBtnDaochuExcel, DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph), new DevExpress.XtraBars.LinkPersistInfo(DevExpress.XtraBars.BarLinkUserDefines.PaintStyle, this.barBtnClose, DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph), new DevExpress.XtraBars.LinkPersistInfo(DevExpress.XtraBars.BarLinkUserDefines.PaintStyle, this.barStaticItem1, "", true, false, true, 0, null, DevExpress.XtraBars.BarItemPaintStyle.Caption), new DevExpress.XtraBars.LinkPersistInfo(DevExpress.XtraBars.BarLinkUserDefines.Width, this.BcobYear, "", false, true, true, 73)}); this.bar1.OptionsBar.MultiLine = true; this.bar1.OptionsBar.UseWholeRow = true; this.bar1.Text = "Custom 1"; // // barBtnSave // this.barBtnSave.Caption = "保存"; this.barBtnSave.Id = 0; this.barBtnSave.ImageIndex = 0; this.barBtnSave.Name = "barBtnSave"; this.barBtnSave.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.barBtnSave_ItemClick); // // barBtnRefreshData // this.barBtnRefreshData.Caption = "更新数据"; this.barBtnRefreshData.Id = 1; this.barBtnRefreshData.ImageIndex = 14; this.barBtnRefreshData.Name = "barBtnRefreshData"; this.barBtnRefreshData.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.barBtnRefreshData_ItemClick); // // barBtnDaochuExcel // this.barBtnDaochuExcel.Caption = "导出"; this.barBtnDaochuExcel.Id = 2; this.barBtnDaochuExcel.ImageIndex = 5; this.barBtnDaochuExcel.Name = "barBtnDaochuExcel"; this.barBtnDaochuExcel.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.barBtnDaochuExcel_ItemClick); // // barBtnClose // this.barBtnClose.Caption = "关闭"; this.barBtnClose.Id = 3; this.barBtnClose.ImageIndex = 7; this.barBtnClose.Name = "barBtnClose"; this.barBtnClose.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.barBtnClose_ItemClick); // // barStaticItem1 // this.barStaticItem1.Border = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; this.barStaticItem1.Caption = "现状年份:"; this.barStaticItem1.Id = 7; this.barStaticItem1.Name = "barStaticItem1"; this.barStaticItem1.TextAlignment = System.Drawing.StringAlignment.Near; // // BcobYear // this.BcobYear.Caption = "XZyear"; this.BcobYear.Edit = this.repositoryItemComboBox1; this.BcobYear.Id = 5; this.BcobYear.Name = "BcobYear"; this.BcobYear.EditValueChanged += new System.EventHandler(this.BcobYear_EditValueChanged); // // repositoryItemComboBox1 // this.repositoryItemComboBox1.AutoHeight = false; this.repositoryItemComboBox1.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); this.repositoryItemComboBox1.Name = "repositoryItemComboBox1"; // // repositoryItemTextEdit1 // this.repositoryItemTextEdit1.AutoHeight = false; this.repositoryItemTextEdit1.Name = "repositoryItemTextEdit1"; // // repositoryItemComboBox2 // this.repositoryItemComboBox2.AutoHeight = false; this.repositoryItemComboBox2.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); this.repositoryItemComboBox2.Name = "repositoryItemComboBox2"; // // FrmPDWXZ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(612, 473); this.Controls.Add(this.fpSpread1); this.Controls.Add(this.barDockControlLeft); this.Controls.Add(this.barDockControlRight); this.Controls.Add(this.barDockControlBottom); this.Controls.Add(this.barDockControlTop); this.Name = "FrmPDWXZ"; this.Text = "FrmPDWXZ"; this.Load += new System.EventHandler(this.FrmPDWXZ_Load); ((System.ComponentModel.ISupportInitialize)(this.fpSpread1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.barManager1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.repositoryItemComboBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.repositoryItemTextEdit1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.repositoryItemComboBox2)).EndInit(); this.ResumeLayout(false); }
private void Sheet_AddData(FarPoint.Win.Spread.FpSpread fpspread, FarPoint.Win.Spread.SheetView obj_sheet, int year, string ProjID, List <string[]> SxXjName, IList <double> obj_DY_List) { //其中平均单条线路配变装接容量(MVA/条) 取表3-14的数据计算,所以要选判断电压等级是否一致 string dyflag = ""; //查找表3-14市辖供电区的开始行号 int SXrow = fc.Sheet_Find_Value(fpspread.Sheets[22], 0, "1"); if (SXrow != -1) { //查3-14的电压等级数 int sheet314dysum = fpspread.Sheets[22].Cells[SXrow, 0].RowSpan; if (sheet314dysum == obj_DY_List.Count) { for (int i = 0; i < sheet314dysum; i++) { //看电压内容是否相同 if (fpspread.Sheets[22].Cells[SXrow + i, 2].Value.ToString() != obj_DY_List[i].ToString()) { dyflag = "不同"; } } } else { //如果电压等级不相同,则标识不同 dyflag = "不同"; } } //添加数据 //公用还是专用 string GorZ = ""; //条件 string XLtiaojian = ""; int startrow = 3; int length = obj_DY_List.Count; if (obj_DY_List.Count > 0) { for (int i = 0; i < SxXjName.Count; i++) { //合计部分不用计算 if (SxXjName[i][2].ToString() != "合计") { for (int j = 0; j < obj_DY_List.Count; j++) { //固定两次循环,一次计算公用,一次计算专用 for (int k = 0; k <= 1; k++) { if (k == 0) { GorZ = "公用"; //主干公用线路长度 //电缆线路长度(此处用来计算线路总长度) XLtiaojian = " OperationYear!='' and year(cast(OperationYear as datetime))<=" + year + " and ProjectID='" + ProjID + "' and Type='05' and LineType2='" + GorZ + "' and DQ='" + SxXjName[i][2] + "' and RateVolt=" + obj_DY_List[j].ToString(); double ZGDLlength = 0; if (Services.BaseService.GetObject("SelectPSPDEV_SUMLength2", XLtiaojian) != null) { ZGDLlength = (double)Services.BaseService.GetObject("SelectPSPDEV_SUMLength2", XLtiaojian); } //架空线路长度(此处用来计算线路总长度) double ZGJKXLlength = 0; if (Services.BaseService.GetObject("SelectPSPDEV_SUMLineLength", XLtiaojian) != null) { ZGJKXLlength = (double)Services.BaseService.GetObject("SelectPSPDEV_SUMLineLength", XLtiaojian); } obj_sheet.SetValue(startrow + i * length + j, 10, ZGDLlength + ZGJKXLlength); //主干长度>4km条数(条) XLtiaojian = " OperationYear!='' and year(cast(OperationYear as datetime))<=" + year + " and ProjectID='" + ProjID + "' and Type='05' and LineType2='" + GorZ + "' and (LineLength+Length2)>4 and DQ='" + SxXjName[i][2] + "' and RateVolt=" + obj_DY_List[j].ToString(); int ZGXLsum1 = 0; if (Services.BaseService.GetObject("SelectPSPDEV_CountAll", XLtiaojian) != null) { ZGXLsum1 = (int)Services.BaseService.GetObject("SelectPSPDEV_CountAll", XLtiaojian); } obj_sheet.SetValue(startrow + i * length + j, 12, ZGXLsum1); //主干长度>10km条数(条) XLtiaojian = " OperationYear!='' and year(cast(OperationYear as datetime))<=" + year + " and ProjectID='" + ProjID + "' and Type='05' and LineType2='" + GorZ + "' and (LineLength+Length2)>10 and DQ='" + SxXjName[i][2] + "' and RateVolt=" + obj_DY_List[j].ToString(); int ZGXLsum2 = 0; if (Services.BaseService.GetObject("SelectPSPDEV_CountAll", XLtiaojian) != null) { ZGXLsum2 = (int)Services.BaseService.GetObject("SelectPSPDEV_CountAll", XLtiaojian); } obj_sheet.SetValue(startrow + i * length + j, 13, ZGXLsum2); //架空线绝缘导线长度(km) XLtiaojian = " OperationYear!='' and year(cast(OperationYear as datetime))<=" + year + " and ProjectID='" + ProjID + "' and Type='05' and LineType2='" + GorZ + "' and DQ='" + SxXjName[i][2] + "' and RateVolt=" + obj_DY_List[j].ToString(); double JKJYlength = 0; if (Services.BaseService.GetObject("SelectPSPDEV_SUMNum1", XLtiaojian) != null) { JKJYlength = (double)Services.BaseService.GetObject("SelectPSPDEV_SUMNum1", XLtiaojian); } obj_sheet.SetValue(startrow + i * length + j, 18, JKJYlength); } else { GorZ = "专用"; } //线路条数 XLtiaojian = " OperationYear!='' and year(cast(OperationYear as datetime))<=" + year + " and ProjectID='" + ProjID + "' and Type='05' and LineType2='" + GorZ + "' and DQ='" + SxXjName[i][2] + "' and RateVolt=" + obj_DY_List[j].ToString(); int XLsum = 0; if (Services.BaseService.GetObject("SelectPSPDEV_CountAll", XLtiaojian) != null) { XLsum = (int)Services.BaseService.GetObject("SelectPSPDEV_CountAll", XLtiaojian); } obj_sheet.SetValue(startrow + i * length + j, 3 + k, XLsum); //电缆线路长度 double DLXLlength = 0; if (Services.BaseService.GetObject("SelectPSPDEV_SUMLength2", XLtiaojian) != null) { DLXLlength = (double)Services.BaseService.GetObject("SelectPSPDEV_SUMLength2", XLtiaojian); } obj_sheet.SetValue(startrow + i * length + j, 7 + k, DLXLlength); //架空线路长度(此处用来计算线路总长度) double JKXLlength = 0; if (Services.BaseService.GetObject("SelectPSPDEV_SUMLineLength", XLtiaojian) != null) { JKXLlength = (double)Services.BaseService.GetObject("SelectPSPDEV_SUMLineLength", XLtiaojian); } obj_sheet.SetValue(startrow + i * length + j, 5 + k, DLXLlength + JKXLlength); //平均单条线路配变装接容量(MVA/条) 取表3-14的数据计算,先查看 dyflag的值; //如果电压不同,提示出错,否则写入公式 if (dyflag == "不同") { obj_sheet.SetValue(startrow + i * length + j, 14 + k, "公式错误"); } else { string sheet314name = fpspread.Sheets[22].SheetName; FarPoint.Win.Spread.CellType.NumberCellType newcelltype = new FarPoint.Win.Spread.CellType.NumberCellType(); //结果保留两位小数 newcelltype.DecimalPlaces = 2; obj_sheet.Cells[startrow + i * length + j, 14 + k].CellType = newcelltype; obj_sheet.Cells[startrow + i * length + j, 14 + k].Formula = "'" + sheet314name + "'!R" + (startrow + i * length + j + 1) + "C" + (5 + 2 * k) + "/R" + (startrow + i * length + j + 1) + "C" + (4 + k); } //线路配变装接容量>12MVA线路条数(条) XLtiaojian = " OperationYear!='' and year(cast(OperationYear as datetime))<=" + year + " and ProjectID='" + ProjID + "' and Type='05' and LineType2='" + GorZ + "' and DQ='" + SxXjName[i][2] + "' and Burthen*RateVolt>12 and RateVolt=" + obj_DY_List[j].ToString(); int RLXLsum = 0; if (Services.BaseService.GetObject("SelectPSPDEV_CountAll", XLtiaojian) != null) { RLXLsum = (int)Services.BaseService.GetObject("SelectPSPDEV_CountAll", XLtiaojian); } obj_sheet.SetValue(startrow + i * length + j, 16 + k, RLXLsum); } } } else { //县级合计部分公式 if (i == 1) { fc.Sheet_WriteFormula_RowSum(obj_sheet, startrow + (i + 1) * length, 3, 4, length, startrow + i * length, 3, 18); } //全地区合计部分公式 else { fc.Sheet_WriteFormula_RowSum(obj_sheet, startrow, 3, 2, length, startrow + i * length, 3, 18); } } } } }
private DataTable GetExcel(string filepach) { string str; FarPoint.Win.Spread.FpSpread fpSpread1 = new FarPoint.Win.Spread.FpSpread(); try { fpSpread1.OpenExcel(filepach); } catch { string filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName(filepach); File.Copy(filepach, filepath1); fpSpread1.OpenExcel(filepath1); File.Delete(filepath1); } DataTable dt = new DataTable(); Hashtable h1 = new Hashtable(); for (int k = 0; k < fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; k++) { //dt.Columns.Add("col" + k.ToString()); //string aa = fpSpread1.Sheets[0].Cells[0, k].Value.ToString(); //dt.Columns.Add(aa); foreach (TreeListColumn tlc in this.treeList1.Columns) { if (tlc.Caption == fpSpread1.Sheets[0].Cells[2, k].Text) { if (!h1.Contains(tlc.Caption)) { dt.Columns.Add(tlc.Caption); h1.Add(tlc.Caption, tlc.FieldName); } //aa++; } } } for (int i =3; i < fpSpread1.Sheets[0].GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data); i++) { DataRow dr = dt.NewRow(); str = ""; for (int j = 0; j < fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; j++) { str = str + fpSpread1.Sheets[0].Cells[i, j].Text; if (h1[fpSpread1.Sheets[0].Cells[2, j].Text]!=null) dr[fpSpread1.Sheets[0].Cells[2, j].Text] = fpSpread1.Sheets[0].Cells[i, j].Text; // dr[j] = fpSpread1.Sheets[0].Cells[i, j].Text; } if (str != "") dt.Rows.Add(dr); } return dt; }
public void Build(FarPoint.Win.Spread.FpSpread fpspread, FarPoint.Win.Spread.SheetView obj_sheet, int year, string ProjID, List <string[]> SxXjName) { //线路电压等级根据实际情况查询(中压 6 <= 电压<=20) string XLDianYatiaojian = " Type='05' and OperationYear!='' and year(cast(OperationYear as datetime))<=" + year + " and ProjectID='" + ProjID + "' and (LineType2='公用' or LineType2='专用') and RateVolt between 6 and 20 group by RateVolt order by RateVolt"; IList <double> DY_list = Services.BaseService.GetList <double>("SelectPSPDEV_RateVolt", XLDianYatiaojian); int xlsum = DY_list.Count; //表标题行数 int startrow = 3; //列标题每项行数 int dylength = xlsum; //表格共 行21 列 rowcount = startrow + 7 * dylength; colcount = 21; //工作表第一行的标题 title = "表3‑15 " + year + "年铜陵市中压配电线路统计"; //工作表名 sheetname = "表3-15"; //设定工作表行列值及标题和表名 fc.Sheet_RowCol_Title_Name(obj_sheet, rowcount, colcount, title, sheetname); //设定表格线 fc.Sheet_GridandCenter(obj_sheet); //设定行列模式,以便写公式使用 fc.Sheet_Referen_R1C1(obj_sheet); //设定表格列宽度 obj_sheet.Columns[0].Width = 60; obj_sheet.Columns[1].Width = 60; obj_sheet.Columns[2].Width = 60; obj_sheet.Columns[3].Width = 60; obj_sheet.Columns[4].Width = 60; obj_sheet.Columns[5].Width = 60; obj_sheet.Columns[6].Width = 60; obj_sheet.Columns[7].Width = 60; obj_sheet.Columns[8].Width = 60; obj_sheet.Columns[9].Width = 120; obj_sheet.Columns[10].Width = 60; obj_sheet.Columns[11].Width = 120; obj_sheet.Columns[12].Width = 90; obj_sheet.Columns[13].Width = 90; obj_sheet.Columns[14].Width = 60; obj_sheet.Columns[15].Width = 60; obj_sheet.Columns[16].Width = 60; obj_sheet.Columns[17].Width = 60; obj_sheet.Columns[18].Width = 90; obj_sheet.Columns[19].Width = 80; obj_sheet.Columns[20].Width = 60; //设定表格行高度 obj_sheet.Rows[1].Height = 40; obj_sheet.Rows[2].Height = 20; //写标题行列内容 Sheet_AddItem(obj_sheet, SxXjName, DY_list); //写入数据 Sheet_AddData(fpspread, obj_sheet, year, ProjID, SxXjName, DY_list); //写入公式 fc.Sheet_WriteFormula_OneCol_Anotercol_nopercent(obj_sheet, 3, 3, 5, 9, 7 * dylength, 2); fc.Sheet_WriteFormula_OneCol_Anotercol_nopercent(obj_sheet, 3, 3, 10, 11, 7 * dylength, 2); fc.Sheet_WriteFormula_OneCol_Twocol_Threecol_percent(obj_sheet, 3, 18, 5, 7, 19, 7 * dylength); fc.Sheet_WriteFormula_OneCol_Anotercol_percent(obj_sheet, 3, 5, 7, 20, 7 * dylength); //锁定表格 fc.Sheet_Locked(obj_sheet); }
private DataTable GetExcel(string filepach) { string str; FarPoint.Win.Spread.FpSpread fpSpread1 = new FarPoint.Win.Spread.FpSpread(); try { fpSpread1.OpenExcel(filepach); } catch { string filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName(filepach); File.Copy(filepach, filepath1); fpSpread1.OpenExcel(filepath1); File.Delete(filepath1); } DataTable dt = new DataTable(); Hashtable h1 = new Hashtable(); int aa = 0; string[] col = new string[14]{"S20", "AreaName", "Title", "L1", "L2", "L3", "L4","L5", "L9","L10","S1","S2","S4","S5" }; IList<string> filedList = new List<string>(); IList<string> capList = new List<string>(); for (int i = 0; i < ctrlSubstation_Info1.GridView.Columns.Count; i++) { capList.Add(ctrlSubstation_Info1.GridView.Columns[i].Caption); filedList.Add(ctrlSubstation_Info1.GridView.Columns[i].FieldName); } int[] colnum = new int[7] {0,2,6,8,9,7,11 };//�������� int c = 0; //for (int k = 1; k <= fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; k++) //{ // bool bl = false; // GridColumn gc = this.ctrlSubstation_Info1.GridView.VisibleColumns[k - 1]; // dt.Columns.Add(gc.FieldName); // h1.Add(aa.ToString(), gc.FieldName); // aa++; IList<string> fie = new List<string>(); IList<int> yxzl = new List<int>();//��Ч���Ǽ��� int m = 1; for (int j = 0; j < fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; j++) { if (capList.Contains(fpSpread1.Sheets[0].Cells[0, j].Text)) { fie.Add(filedList[capList.IndexOf(fpSpread1.Sheets[0].Cells[0, j].Text)]); yxzl.Add(j); } } for (int k = 0; k < fie.Count; k++) { dt.Columns.Add(fie[k]); } for (int i = m; i <= fpSpread1.Sheets[0].GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data); i++) { DataRow dr = dt.NewRow(); // for (int j = 0; j < fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; j++) int n = 0; foreach (int j in yxzl) { dr[fie[n]] = fpSpread1.Sheets[0].Cells[i, j].Text; n++; } dt.Rows.Add(dr); } // GetL2(dr["L4"].ToString(), out L2); // dr["AreaName"] = AreaName; dr["L1"] = L1; dr["S4"] = S4; dr["L2"] = L2; dr["S3"] = ""; dr["S5"] = i.ToString(); // if (str != "") return dt; }
public static string GF_ColNameFind(FarPoint.Win.Spread.FpSpread ss, int iCol) { return(ss.ActiveSheet.Columns[iCol].Label); }
private DataTable GetExcel(string filepach) { string str; FarPoint.Win.Spread.FpSpread fpSpread1 = new FarPoint.Win.Spread.FpSpread(); try { fpSpread1.OpenExcel(filepach); } catch { string filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName(filepach); File.Copy(filepach, filepath1); fpSpread1.OpenExcel(filepath1); File.Delete(filepath1); } DataTable dt = new DataTable(); Hashtable h1 = new Hashtable(); int aa = 0; for (int k = 0; k <= fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; k++) { bool bl = false; GridColumn gc = this.ctrlSubstation_Info_LangFang1.GridView.VisibleColumns[k - 1]; //dt.Columns.Add(gc.FieldName); //h1.Add(aa.ToString(), gc.FieldName); //aa++; foreach (GridColumn tlc in this.ctrlSubstation_Info_LangFang1.GridView.Columns) { if (tlc.Caption == fpSpread1.Sheets[0].Cells[2, k].Text && (tlc.FieldName == "L23" || tlc.FieldName == "L13" || tlc.FieldName == "L14" || tlc.FieldName == "L15" || tlc.FieldName == "L16" || tlc.FieldName == "L17" || tlc.FieldName == "L18" || tlc.FieldName == "L19" || tlc.FieldName == "L20" || tlc.FieldName == "L7" || tlc.FieldName == "L8" || tlc.FieldName == "L11" || tlc.FieldName == "L12")) { //if (fpSpread1.Sheets[0].Cells[1, k].Text=="500"||fpSpread1.Sheets[0].Cells[1, k].Text=="220"||fpSpread1.Sheets[0].Cells[1, k].Text=="110"||fpSpread1.Sheets[0].Cells[1, k].Text=="35"||fpSpread1.Sheets[0].Cells[1, k].Text=="6"||fpSpread1.Sheets[0].Cells[1, k].Text=="10") { dt.Columns.Add(tlc.FieldName); //h1.Add(aa.ToString(), tlc.FieldName); if (!h1.Contains(tlc.Caption)) h1.Add(tlc.Caption, tlc.FieldName); //aa++; } } //else if (tlc.Caption == fpSpread1.Sheets[0].Cells[2, k].Text && tlc.FieldName.IndexOf("��") >= 0) //{ // dt.Columns.Add(tlc.FieldName); //} else if (tlc.Caption == fpSpread1.Sheets[0].Cells[0, k].Text) { dt.Columns.Add(tlc.FieldName); h1.Add(tlc.Caption, tlc.FieldName); //h1.Add(aa.ToString(), tlc.FieldName); //aa++; } } } this.ctrlSubstation_Info_LangFang1.GridView.SaveLayoutToXml(@"C:\Documents and Settings\Administrator\����\aauuyy.xml"); int m = 1; for (int i = m; i < fpSpread1.Sheets[0].GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; i++) { DataRow dr = dt.NewRow(); str = ""; for (int j = 0; j < fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; j++) { try { str = str + fpSpread1.Sheets[0].Cells[i, j].Text; //dr[h1[j.ToString()].ToString()] = fpSpread1.Sheets[0].Cells[i, j].Text; //dr[j] = fpSpread1.Sheets[0].Cells[i, j].Text; if (h1[fpSpread1.Sheets[0].Cells[2, j].Text] != null) dr[h1[fpSpread1.Sheets[0].Cells[2, j].Text].ToString()] = fpSpread1.Sheets[0].Cells[i, j].Text; } catch { } } if (str != "") dt.Rows.Add(dr); } return dt; }
private DataTable GetExcel(string filepach) { string str; FarPoint.Win.Spread.FpSpread fpSpread1 = new FarPoint.Win.Spread.FpSpread(); try { fpSpread1.OpenExcel(filepach); } catch { string filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName(filepach); File.Copy(filepach, filepath1); fpSpread1.OpenExcel(filepath1); File.Delete(filepath1); } DataTable dt = new DataTable(); Hashtable h1 = new Hashtable(); int aa = 0; //for (int k = 1; k <= fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; k++) //{ // bool bl = false; // GridColumn gc = this.ctrlProject_Sum1.GridView.VisibleColumns[k - 1]; // dt.Columns.Add(gc.FieldName); // h1.Add(aa.ToString(), gc.FieldName); // aa++; //} { dt.Columns.Add("PQName"); h1.Add("0", "PQName"); dt.Columns.Add("PQtype"); h1.Add("1", "PQtype"); dt.Columns.Add("SubName"); h1.Add("2", "SubName"); dt.Columns.Add("LineName"); h1.Add("3", "LineName"); dt.Columns.Add("LineType"); h1.Add("4", "LineType"); dt.Columns.Add("LineLength"); h1.Add("5", "LineLength"); dt.Columns.Add("Num1"); h1.Add("6", "Num1"); dt.Columns.Add("Num2"); h1.Add("7", "Num2"); dt.Columns.Add("Num3"); h1.Add("8", "Num3"); dt.Columns.Add("Num4"); h1.Add("9", "Num4"); dt.Columns.Add("Num5"); h1.Add("10", "Num5"); dt.Columns.Add("Num6"); h1.Add("11", "Num6"); dt.Columns.Add("WG1"); h1.Add("12", "WG1"); dt.Columns.Add("Num7"); h1.Add("13", "Num7"); dt.Columns.Add("Num8"); h1.Add("14", "Num8"); dt.Columns.Add("WG2"); h1.Add("15", "WG2"); dt.Columns.Add("LineSX"); h1.Add("16", "LineSX"); dt.Columns.Add("col1"); h1.Add("17", "col1"); dt.Columns.Add("KBS"); h1.Add("18", "KBS"); dt.Columns.Add("KG"); h1.Add("19", "KG"); dt.Columns.Add("JXMS"); h1.Add("20", "JXMS"); dt.Columns.Add("LLXMC"); h1.Add("21", "LLXMC"); dt.Columns.Add("MaxFH"); h1.Add("22", "MaxFH"); dt.Columns.Add("SafeFH"); h1.Add("23", "SafeFH"); dt.Columns.Add("FZL"); h1.Add("24", "FZL"); } int m = 1; for (int i = m; i < fpSpread1.Sheets[0].GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; i++) { DataRow dr = dt.NewRow(); str = ""; for (int j = 0; j < fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; j++) { str = str + fpSpread1.Sheets[0].Cells[3 + i, j].Text; dr[h1[j.ToString()].ToString()] = fpSpread1.Sheets[0].Cells[3 + i, j].Text; } if (str != "") { if (fpSpread1.Sheets[0].Cells[3 + i, 22].Text != "" && fpSpread1.Sheets[0].Cells[3 + i, 23].Text != "") { dr[24] = (Convert.ToDecimal(fpSpread1.Sheets[0].Cells[3 + i, 22].Text) / Convert.ToDecimal(fpSpread1.Sheets[0].Cells[3 + i, 23].Text)*100).ToString("##.##"); } dt.Rows.Add(dr); } } return dt; }
private DataTable GetExcel(string filepach) { string str; FarPoint.Win.Spread.FpSpread fpSpread1 = new FarPoint.Win.Spread.FpSpread(); try { fpSpread1.OpenExcel(filepach); } catch { string filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName(filepach); File.Copy(filepach, filepath1); fpSpread1.OpenExcel(filepath1); File.Delete(filepath1); } DataTable dt = new DataTable(); for (int k = 1; k <= fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; k++) { // dt.Columns.Add("col" + k.ToString()); GridColumn gc = this.ctrlPSP_PowerSubstationInfo1.GridView.VisibleColumns[k - 1]; dt.Columns.Add(gc.FieldName); } for (int i = 3; i < fpSpread1.Sheets[0].GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data) ; i++) { DataRow dr = dt.NewRow(); str = ""; for (int j = 0; j < fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; j++) { str = str + fpSpread1.Sheets[0].Cells[i, j].Text; dr[j] = fpSpread1.Sheets[0].Cells[i, j].Text; } if (str != "") dt.Rows.Add(dr); } return dt; }
/// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmEasyChoose)); FarPoint.Win.Spread.TipAppearance tipAppearance1 = new FarPoint.Win.Spread.TipAppearance(); this.txtQueryCode = new Neusoft.FrameWork.WinForms.Controls.NeuTextBox(); this.fpData = new FarPoint.Win.Spread.FpSpread(); this.fpData_Sheet1 = new FarPoint.Win.Spread.SheetView(); this.btnOK = new Neusoft.FrameWork.WinForms.Controls.NeuButton(); this.btnCancel = new Neusoft.FrameWork.WinForms.Controls.NeuButton(); this.chbMisty = new Neusoft.FrameWork.WinForms.Controls.NeuCheckBox(); ((System.ComponentModel.ISupportInitialize)(this.fpData)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.fpData_Sheet1)).BeginInit(); this.SuspendLayout(); // // txtQueryCode // this.txtQueryCode.AccessibleDescription = null; this.txtQueryCode.AccessibleName = null; resources.ApplyResources(this.txtQueryCode, "txtQueryCode"); this.txtQueryCode.BackgroundImage = null; this.txtQueryCode.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; this.txtQueryCode.Font = null; this.txtQueryCode.IsEnter2Tab = false; this.txtQueryCode.Name = "txtQueryCode"; this.txtQueryCode.Style = Neusoft.FrameWork.WinForms.Controls.StyleType.VS2003; this.txtQueryCode.TextChanged += new System.EventHandler(this.txtQueryCode_TextChanged); this.txtQueryCode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtQueryCode_KeyDown); this.txtQueryCode.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtQueryCode_KeyPress); // // fpData // this.fpData.About = "3.0.2004.2005"; resources.ApplyResources(this.fpData, "fpData"); this.fpData.AccessibleName = null; this.fpData.BackColor = System.Drawing.SystemColors.Control; this.fpData.BackgroundImage = null; this.fpData.Font = null; this.fpData.HorizontalScrollBarPolicy = FarPoint.Win.Spread.ScrollBarPolicy.AsNeeded; this.fpData.Name = "fpData"; this.fpData.Sheets.AddRange(new FarPoint.Win.Spread.SheetView[] { this.fpData_Sheet1 }); tipAppearance1.BackColor = System.Drawing.SystemColors.Info; tipAppearance1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); tipAppearance1.ForeColor = System.Drawing.SystemColors.InfoText; this.fpData.TextTipAppearance = tipAppearance1; this.fpData.VerticalScrollBarPolicy = FarPoint.Win.Spread.ScrollBarPolicy.AsNeeded; this.fpData.CellDoubleClick += new FarPoint.Win.Spread.CellClickEventHandler(this.fpData_CellDoubleClick); this.fpData.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.fpData_KeyPress); // // fpData_Sheet1 // this.fpData_Sheet1.Reset(); this.fpData_Sheet1.SheetName = "Sheet1"; // Formulas and custom names must be loaded with R1C1 reference style this.fpData_Sheet1.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.R1C1; this.fpData_Sheet1.ColumnCount = 6; this.fpData_Sheet1.ColumnHeader.Cells.Get(0, 0).Value = "编码"; this.fpData_Sheet1.ColumnHeader.Cells.Get(0, 1).Value = "名称"; this.fpData_Sheet1.ColumnHeader.Cells.Get(0, 2).Value = "其他"; this.fpData_Sheet1.ColumnHeader.Cells.Get(0, 3).Value = "拼音码"; this.fpData_Sheet1.ColumnHeader.Cells.Get(0, 4).Value = "五笔码"; this.fpData_Sheet1.ColumnHeader.Cells.Get(0, 5).Value = "自定义码"; this.fpData_Sheet1.ColumnHeader.Rows.Get(0).Height = 24F; this.fpData_Sheet1.Columns.Get(0).AllowAutoSort = true; this.fpData_Sheet1.Columns.Get(0).Label = "编码"; this.fpData_Sheet1.Columns.Get(0).Locked = true; this.fpData_Sheet1.Columns.Get(0).Width = 79F; this.fpData_Sheet1.Columns.Get(1).Label = "名称"; this.fpData_Sheet1.Columns.Get(1).Locked = true; this.fpData_Sheet1.Columns.Get(1).Width = 148F; this.fpData_Sheet1.Columns.Get(2).Label = "其他"; this.fpData_Sheet1.Columns.Get(2).Locked = true; this.fpData_Sheet1.Columns.Get(2).Width = 64F; this.fpData_Sheet1.Columns.Get(3).Label = "拼音码"; this.fpData_Sheet1.Columns.Get(3).Locked = true; this.fpData_Sheet1.Columns.Get(3).Width = 84F; this.fpData_Sheet1.Columns.Get(4).Label = "五笔码"; this.fpData_Sheet1.Columns.Get(4).Locked = true; this.fpData_Sheet1.Columns.Get(4).Width = 76F; this.fpData_Sheet1.Columns.Get(5).Label = "自定义码"; this.fpData_Sheet1.Columns.Get(5).Locked = true; this.fpData_Sheet1.Columns.Get(5).Width = 92F; this.fpData_Sheet1.DataAutoHeadings = false; this.fpData_Sheet1.DataAutoSizeColumns = false; this.fpData_Sheet1.GrayAreaBackColor = System.Drawing.Color.Honeydew; this.fpData_Sheet1.OperationMode = FarPoint.Win.Spread.OperationMode.RowMode; this.fpData_Sheet1.RowHeader.Columns.Default.Resizable = false; this.fpData_Sheet1.RowHeader.Columns.Get(0).AllowAutoSort = true; this.fpData_Sheet1.RowHeader.Columns.Get(0).Width = 21F; this.fpData_Sheet1.SelectionForeColor = System.Drawing.Color.White; this.fpData_Sheet1.SheetCornerStyle.Locked = false; this.fpData_Sheet1.SheetCornerStyle.Parent = "HeaderDefault"; this.fpData_Sheet1.SheetCornerStyle.VerticalAlignment = FarPoint.Win.Spread.CellVerticalAlignment.Top; this.fpData_Sheet1.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.A1; // // btnOK // this.btnOK.AccessibleDescription = null; this.btnOK.AccessibleName = null; resources.ApplyResources(this.btnOK, "btnOK"); this.btnOK.BackgroundImage = null; this.btnOK.Font = null; this.btnOK.Name = "btnOK"; this.btnOK.Style = Neusoft.FrameWork.WinForms.Controls.StyleType.VS2003; this.btnOK.Type = Neusoft.FrameWork.WinForms.Controls.General.ButtonType.None; this.btnOK.Click += new System.EventHandler(this.btnOK_Click); // // btnCancel // this.btnCancel.AccessibleDescription = null; this.btnCancel.AccessibleName = null; resources.ApplyResources(this.btnCancel, "btnCancel"); this.btnCancel.BackgroundImage = null; this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnCancel.Font = null; this.btnCancel.Name = "btnCancel"; this.btnCancel.Style = Neusoft.FrameWork.WinForms.Controls.StyleType.VS2003; this.btnCancel.Type = Neusoft.FrameWork.WinForms.Controls.General.ButtonType.None; this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); // // chbMisty // this.chbMisty.AccessibleDescription = null; this.chbMisty.AccessibleName = null; resources.ApplyResources(this.chbMisty, "chbMisty"); this.chbMisty.BackgroundImage = null; this.chbMisty.Checked = true; this.chbMisty.CheckState = System.Windows.Forms.CheckState.Checked; this.chbMisty.Font = null; this.chbMisty.Name = "chbMisty"; this.chbMisty.Style = Neusoft.FrameWork.WinForms.Controls.StyleType.VS2003; this.chbMisty.CheckedChanged += new System.EventHandler(this.chbMisty_CheckedChanged_2); // // frmEasyChoose // this.AcceptButton = this.btnOK; this.AccessibleDescription = null; this.AccessibleName = null; resources.ApplyResources(this, "$this"); this.BackgroundImage = null; this.CancelButton = this.btnCancel; this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnOK); this.Controls.Add(this.fpData); this.Controls.Add(this.txtQueryCode); this.Controls.Add(this.chbMisty); this.Font = null; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = null; this.KeyPreview = true; this.Name = "frmEasyChoose"; this.Activated += new System.EventHandler(this.frmEasyChoose_Activated); this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.frmEasyChoose_FormClosed); ((System.ComponentModel.ISupportInitialize)(this.fpData)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.fpData_Sheet1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); }
private DataTable GetExcel(string filepach) { //string str; //FarPoint.Win.Spread.FpSpread fpSpread1 = new FarPoint.Win.Spread.FpSpread(); //try //{ // fpSpread1.OpenExcel(filepach); //} //catch //{ // string filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName(filepach); // File.Copy(filepach, filepath1); // fpSpread1.OpenExcel(filepath1); // File.Delete(filepath1); //} //DataTable dt = new DataTable(); //Hashtable h1 = new Hashtable(); //int aa = 0; //string[] col = new string[7] { "S2", "Title", "L1","L4", "L5","S4","S5" }; //int[] colnum = new int[4] { 0, 1, 3, 4 };//�������� //int c = 0; ////for (int k = 1; k <= fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; k++) ////{ //// bool bl = false; //// GridColumn gc = this.ctrlSubstation_Info1.GridView.VisibleColumns[k - 1]; //// dt.Columns.Add(gc.FieldName); //// h1.Add(aa.ToString(), gc.FieldName); //// aa++; ////} //for (int k = 0; k < col.Length; k++) //{ // dt.Columns.Add(col[k]); //} //string[] cnNum = new string[9] { "һ", "��", "��", "��", "��","��","��","��","��"}; //int cn = 0; //int gong = 65; //int m = 2; //string L1 = ""; //string S4 = ""; //string L2 = ""; //string AreaName = ""; //string temStr = ""; //// string L //if (fpSpread1.Sheets[0].Cells[1, 0].Text != "���" && fpSpread1.Sheets[0].Cells[1, 0].Text != "") // m = 1; //for (int i = m; i <= fpSpread1.Sheets[0].GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data); i++) //{ // c = 0; // if (fpSpread1.Sheets[0].Cells[i, 0].Text.IndexOf(cnNum[cn])!=-1) // { // GetL1S4(fpSpread1.Sheets[0].Cells[i, 1].Text, out L1, out S4); // // AreaName = ""; // // gong = 65; // cn++; // continue; // } // //else if ((temStr = fpSpread1.Sheets[0].Cells[i, 0].Text.Replace(" ", "")) == Convert.ToChar(gong).ToString().ToLower()) // //{ // // AreaName = fpSpread1.Sheets[0].Cells[i, 1].Text; // // gong++; // // continue; // //} // DataRow dr = dt.NewRow(); // str = ""; // for (int j = 0; j < fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; j++) // { // str = str + fpSpread1.Sheets[0].Cells[i, j].Text; // dr[col[colnum[c]]] = fpSpread1.Sheets[0].Cells[i, j].Text; // c++; // } // // GetL2(dr["L4"].ToString(), out L2); // dr["L1"] = L1; dr["S4"] = S4; dr["S2"] = ""; dr["S5"] = i.ToString(); // if (str != "") // dt.Rows.Add(dr); //} //return dt; string str; FarPoint.Win.Spread.FpSpread fpSpread1 = new FarPoint.Win.Spread.FpSpread(); try { fpSpread1.OpenExcel(filepach); } catch { string filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName(filepach); File.Copy(filepach, filepath1); fpSpread1.OpenExcel(filepath1); File.Delete(filepath1); } DataTable dt = new DataTable(); Hashtable h1 = new Hashtable(); int aa = 0; IList<string> filedList = new List<string>(); IList<string> capList = new List<string>(); for (int i = 0; i < ctrlLine_Info1.GridView.Bands.Count; i++) { if (ctrlLine_Info1.GridView.Bands[i].Children.Count > 0) { for (int j = 0; j < ctrlLine_Info1.GridView.Bands[i].Children.Count; j++) { capList.Add(ctrlLine_Info1.GridView.Bands[i].Children[j].Caption); filedList.Add(ctrlLine_Info1.GridView.Bands[i].Children[j].Columns[0].FieldName); } continue; } capList.Add(ctrlLine_Info1.GridView.Bands[i].Caption); filedList.Add(ctrlLine_Info1.GridView.Bands[i].Columns[0].FieldName); } int[] colnum = new int[7] { 0, 2, 6, 8, 9, 7, 11 };//�������� int c = 0; //for (int k = 1; k <= fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; k++) //{ // bool bl = false; // GridColumn gc = this.ctrlSubstation_Info1.GridView.VisibleColumns[k - 1]; // dt.Columns.Add(gc.FieldName); // h1.Add(aa.ToString(), gc.FieldName); // aa++; //} IList<string> fie = new List<string>(); int cn = 0; int gong = 65; int m = 1; string L1 = ""; string S4 = ""; string L2 = ""; string AreaName = ""; string temStr = ""; for (int j = 0; j < fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; j++) { if (capList.Contains(fpSpread1.Sheets[0].Cells[0, j].Text)) fie.Add(filedList[capList.IndexOf(fpSpread1.Sheets[0].Cells[0, j].Text)]); } for (int k = 0; k < fie.Count; k++) { dt.Columns.Add(fie[k]); } for (int i = m; i <= fpSpread1.Sheets[0].GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data); i++) { DataRow dr = dt.NewRow(); str = ""; for (int j = 0; j < fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; j++) { dr[fie[j]] = fpSpread1.Sheets[0].Cells[i, j].Text; } dt.Rows.Add(dr); } return dt; }
private void setSpread(FarPoint.Win.Spread.FpSpread oSpread) { oSpread.ActiveSheet.RowCount = 60; }
private DataTable GetExcel(string filepach) { string str; FarPoint.Win.Spread.FpSpread fpSpread1 = new FarPoint.Win.Spread.FpSpread(); try { fpSpread1.OpenExcel(filepach); } catch { string filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName(filepach); File.Copy(filepach, filepath1); fpSpread1.OpenExcel(filepath1); File.Delete(filepath1); } DataTable dt = new DataTable(); for (int k = 0; k <= fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; k++) { dt.Columns.Add(fpSpread1.Sheets[0].Cells[0, k].Text); } for (int i =1; i < fpSpread1.Sheets[0].GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; i++) { DataRow dr = dt.NewRow(); str = ""; for (int j = 0; j < fpSpread1.Sheets[0].GetLastNonEmptyColumn(FarPoint.Win.Spread.NonEmptyItemFlag.Data) + 1; j++) { str = str + fpSpread1.Sheets[0].Cells[i, j].Text; dr[j] = fpSpread1.Sheets[0].Cells[i, j].Text; } if (str != "") dt.Rows.Add(dr); } return dt; }
/// <summary> /// /// </summary> /// <param name="spdCtl">Spread: object </param> /// public static void InitSpread(FarPoint.Win.Spread.FpSpread spdCtl) { InitSpread(spdCtl, false); }