Ejemplo n.º 1
0
        private void SaveBookToXmlDoc(string xmlPath, bool isSaveAsNewFile)
        {
            //If the xmlPath is still null --> exception
            if (string.IsNullOrEmpty(xmlPath))
            {
                throw new Exception("The provided xmlFileLocation to save was null/empty.");
            }

            //Get xmlHelper, create new when necessary
            if (isSaveAsNewFile || _xmlHelper == null)
            {
                _xmlHelper = new XmlExportHelper(xmlPath);
            }

            //Create sheetList,, retrieve the lbItems
            var sheets = new List <BookInput>();

            foreach (var bi in lbSheets.Items)
            {
                sheets.Add(bi as BookInput);
            }

            //Save current Book
            _xmlHelper.SaveBookToXml(txtBookNr.Text, sheets);
        }
Ejemplo n.º 2
0
        //Ctor
        public frmExcelExport(List <int> bookNrs, XmlExportHelper xmlHelper)
        {
            //Init component
            InitializeComponent();

            //Set private vars and props
            BookNrs    = bookNrs;
            _xmlHelper = xmlHelper;

            //Init comboboxes
            foreach (var bookNr in BookNrs)
            {
                cboStart.Items.Add(bookNr);
                cboEnd.Items.Add(bookNr);
            }
        }
Ejemplo n.º 3
0
        private void InitXmlHelper()
        {
            //Prepare for saving
            var xmlPath = PrepareForSavingToXml(false);

            //If the xmlPath is still null --> exception
            if (string.IsNullOrEmpty(xmlPath))
            {
                throw new Exception("The provided xmlFileLocation to save was null/empty.");
            }

            //Get xmlHelper, create new when necessary
            if (_xmlHelper == null)
            {
                _xmlHelper = new XmlExportHelper(xmlPath);
            }

            //Get number of books in xml
            sslStatusLabelNumberOfBooks.Text = string.Format("Aantal boekjes in xml: {0} | ", _xmlHelper.NumberOfBooks);

            //Set xmlFilepath in statusbar
            sslXmlFilePath.Text = string.Format("Locatie XML file: {0}", xmlPath);
        }