Ejemplo n.º 1
0
        // The sheets of the workbook are:
        // Sheet number 1: INPUTS
        // Sheet number 2: OUTPUTS
        // Sheet number 3: Cover
        // Sheet number 4: Amendment Record
        // Sheet number 5: Reference documents
        // Sheet number 6: Introduction
        // Sheet number 7: ETCS DMI inputs => to import
        // Sheet number 8: ETCS DMI outputs => to import
        // Sheet number 9: INPUT ITEMS
        // Sheet number 10: OUTPUT ITEMS
        // Sheet number 11: ANALYSIS


        /// <summary>
        ///     Launches import of the excel file in the background task
        /// </summary>
        /// <param name="arg"></param>
        public override void ExecuteWork()
        {
            if (TheDictionary != null)
            {
                Application application = new Application();
                if (application != null)
                {
                    Workbook workbook = application.Workbooks.Open(FileName);
                    if (workbook.Sheets.Count == 11)
                    {
                        Specification newSpecification = (Specification)acceptor.getFactory().createSpecification();
                        newSpecification.Name = "Start Stop Conditions";
                        TheDictionary.appendSpecifications(newSpecification);

                        Chapter newChapter = (Chapter)acceptor.getFactory().createChapter();
                        newChapter.setId("1 - DMI inputs");
                        newSpecification.appendChapters(newChapter);
                        Worksheet aWorksheet = workbook.Sheets[7] as Worksheet;
                        importParagraphs(newChapter, "1", aWorksheet);

                        newChapter = (Chapter)acceptor.getFactory().createChapter();
                        newChapter.setId("2 - DMI outputs");
                        newSpecification.appendChapters(newChapter);
                        aWorksheet = workbook.Sheets[8] as Worksheet;
                        importParagraphs(newChapter, "2", aWorksheet);
                    }
                    workbook.Close(false);
                }

                application.Quit();
            }
        }
Ejemplo n.º 2
0
 public void AddChapterHandler(object sender, EventArgs args)
 {
     DataDictionary.Specification.Chapter chapter = (DataDictionary.Specification.Chapter)DataDictionary.Generated.acceptor.getFactory().createChapter();
     chapter.setId("" + (Item.countChapters() + 1));
     AddChapter(chapter);
 }