Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (this.openFileDialog.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                int    row      = 3;
                string tempFile = System.IO.Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
                                                         Definition.TemplateName);

                using (ExcelHelp xls = new ExcelHelp(tempFile))
                {
                    xls.BeginUpdate();
                    Excel.Worksheet sheet     = xls.WorkBook.Sheets[Definition.SheetName];
                    string[]        fileNames = this.openFileDialog.FileNames;
                    var             assmFiles = fileNames.OrderBy(x => System.IO.Path.GetFileName(x));
                    foreach (string fileName in assmFiles)
                    {
                        xmldoc         = GetXmlDocument(fileName);
                        textBox1.Text += fileName + "を抽出しています..." + System.Environment.NewLine;
                        Application.DoEvents();
                        row = ReflectAssembly(xls, sheet, fileName, row);
                    }
                    xls.EndUpdate();

                    if (this.saveFileDialog1.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                    {
                        xls.Save(this.saveFileDialog1.FileName);
                    }
                }
            }
        }