bug
lu
11 小时以前 c351f3bdcb7d13d66e66f5b7394417e85fcf1ecc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
using DevExpress.Spreadsheet;
using DevExpress.XtraEditors;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace Gs.DevApp.UserControl
{
    public partial class CopyXls : DevExpress.XtraEditors.XtraForm
    {
        private string orderType;
        private string orderGuid;
        private static readonly string filePath = AppContext.BaseDirectory + "xlsCopy.xls";
 
        public CopyXls(string orgId, string _orderGuid, string _orderType)
        {
            InitializeComponent();
            this.Text = "正在复制:" + _orderType;
            this.orderType = _orderType;
            this.orderGuid = _orderGuid;
            this.spreadsheetControl1.DocumentLoaded += new EventHandler(spreadsheetControl1_DocumentLoaded);
            if (!string.IsNullOrEmpty(filePath))
            {
                if (File.Exists(filePath))
                {
                    IWorkbook workbook = spreadsheetControl1.Document;
                    workbook.LoadDocument(filePath);
                }
                else
                {
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("找不到xlsCopy.xls文件,请联系管理员!");
                }
            }
        }
 
        /// <summary>
        /// 文档变化后,实现对新文件名称的显示
        /// </summary>
        void spreadsheetControl1_DocumentLoaded(object sender, EventArgs e)
        {
            string fileName = Path.GetFileName(this.spreadsheetControl1.Document.Path);
            if (String.IsNullOrEmpty(fileName))
            {
                Text = "请选择文件";
            }
            else
            {
                Text = fileName;
            }
        }
 
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            spreadsheetControl1.SaveDocument();
        }
    }
}