Пример #1
0
        /// <summary>
        /// Parse the document in order to proceed to the alimentation of all blocks into the given container.
        /// </summary>
        /// <param name="container">Container to build.</param>
        public virtual void ParseDocument(OpenXmlPartContainer container)
        {
            IList <BlockItem> blocks = GetBlocks(container);

            foreach (BlockItem block in blocks)
            {
                BlockConfiguration config = GetBlockConfiguration(block);
                try
                {
                    if (TextBlock.IsMatching(config.Type))
                    {
                        TextBlock.BuildContent(ReportData, container, block, config.Name, config.Options);
                    }
                    else if (TableBlock.IsMatching(config.Type))
                    {
                        TableBlock.BuildContent(ReportData, container, block, config.Name, config.Options);
                    }
                    else if (GraphBlock.IsMatching(config.Type))
                    {
                        GraphBlock.BuildContent(ReportData, Package, block, config.Name, config.Options);
                    }
                    else
                    {
                        LogHelper.Instance.LogWarnFormat("Block type '{0}' not found.", config.Type);
                    }
                }
                catch (Exception exception)
                {
                    string logMessage = $"Exception thrown during document parsing (BlockType : {(null != config ? config.Type : string.Empty)}, BlockName : {(null != config ? config.Name : string.Empty)})";
                    LogHelper.Instance.LogError(logMessage, exception);
                }
            }
        }