using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; using DevExpress.XtraEditors; using Uninpho.Tools.components.MTLFF; using System.IO; using DevExpress.Spreadsheet; using Uninpho.DBOperation.Operation; namespace Uninpho.Tools.components.XXXW { public partial class XXXWListFrom : DevExpress.XtraEditors.XtraForm { public XXXWListFrom() { InitializeComponent(); } int maxrow = 0;//已修改数据的最大行数 /// /// 取消 /// private void simpleButton3_Click(object sender, EventArgs e) { File.Delete(ExcelTools.filenameall); this.Close(); } private void XXXWListFrom_Load(object sender, EventArgs e) { DataAnalysis.DACommon.DirectoryInit(Application.StartupPath + "\\xxxw_temp"); DataAnalysis.DACommon.FileCopy(Application.StartupPath + "\\xxxwdemo.xlsx", ExcelTools.filenameall); sheetControl01.LoadDocument(ExcelTools.filenameall, DevExpress.Spreadsheet.DocumentFormat.Xlsx); } private void sheetControl01_CellValueChanged(object sender, DevExpress.XtraSpreadsheet.SpreadsheetCellEventArgs e) { if (e.Value.ToString() != "" || e.Value.ToString() != null) { if (maxrow < e.RowIndex) { maxrow = e.RowIndex; } } } private void saveBtn_Click(object sender, EventArgs e) { sheetControl01.SaveDocument(); string uid = XXXWCommon.NewPageSave2PG(maxrow+1); var nowdata = DataAnalysisToPG.getfilexxxwL(); ExcelTools.gridControl03.DataSource = nowdata; for (int i = 0; i < nowdata.Count; i++) { if (ExcelTools.gridView03.GetRowCellValue(i, "Id").ToString() == uid) { ExcelTools.gridView03.SelectRow(i); } } XtraMessageBox.Show("保存完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } }