Exemplo n.º 1
0
        /// <summary>
        /// Load's a <see cref="ReportModel"></see> from File using the
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns><see cref="ReportModel"></see></returns>
        public static ReportModel LoadReportModel(string fileName)
        {
            if (String.IsNullOrEmpty(fileName))
            {
                throw new ArgumentNullException("fileName");
            }
            XmlDocument doc = new XmlDocument();

            try {
                doc.Load(fileName);
            } catch (XmlException) {
                // TODO: display user-friendly message
                throw;
            } catch (IOException) {
                // TODO: display user-friendly message
                throw;
            }

            BaseItemLoader loader = new BaseItemLoader();
            object         root   = loader.Load(doc.DocumentElement);

            ReportModel model = root as ReportModel;

            if (model != null)
            {
                model.ReportSettings.FileName = fileName;
                FilePathConverter.AdjustReportName(model);
            }
            else
            {
                IllegalFileFormatException e = new IllegalFileFormatException();
                throw e;
            }
            return(model);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Load's a <see cref="ReportModel"></see> from File using the
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns><see cref="ReportModel"></see></returns>
        public static ReportModel LoadReportModel(string fileName)
        {
            if (String.IsNullOrEmpty(fileName))
            {
                throw new ArgumentNullException("fileName");
            }
            var doc = new XmlDocument();

            doc.Load(fileName);
            ReportModel model = LoadModel(doc);

            model.ReportSettings.FileName = fileName;
            FilePathConverter.AdjustReportName(model);
            return(model);
        }