#pragma warning disable CS1574 // XML comment has cref attribute 'aceReportException' that could not be resolved
        /// <summary>
        /// Appends the macro simple table.
        /// </summary>
        /// <param name="script">The script.</param>
        /// <param name="source">The source.</param>
        /// <param name="throwException">if set to <c>true</c> [throw exception].</param>
        /// <returns></returns>
        /// <exception cref="imbSCI.Cores.core.exceptions.aceReportException">Can't append table with 0 columns, 0 rows and without title - null - Macro: DataTable block failed</exception>
        public static DataTable AppendMacroSimpleTable(this ITextAppendContentExtended script, DataTable source, bool throwException = true, macroOptions options = macroOptions.common)
#pragma warning restore CS1574 // XML comment has cref attribute 'aceReportException' that could not be resolved
        {
            if (!source.validateTable())
            {
                if (throwException)
                {
                    throw new aceReportException("Can't append table with 0 columns, 0 rows and without title. Macro: DataTable block failed");
                }
                return(null);
            }

            if (options.HasFlag(macroOptions.wrapp))
            {
                script.open(nameof(bootstrap_containers.panel), source.GetTitle(), source.GetDescription());
            }
            else
            {
                script.AppendHeading(source.GetTitle(), 3);
                script.AppendLine(source.GetDescription());
            }
            script.AppendTable(source);

            if (options.HasFlag(macroOptions.wrapp))
            {
                script.close();
            }

            if (options.HasFlag(macroOptions.legend))
            {
                AppendMacroLegend(script, source);
            }

            DataTable output = source;

            if (output.validateTable() && options.HasFlag(macroOptions.download))
            {
                //script.AppendTable(output, true);
                //script.AppendParagraph(output.GetDescription());

                script.open(nameof(bootstrap_containers.buttongroup), "", "");

                if (doAllowExcelAttachments)
                {
                    script.Attachment(source, dataTableExportEnum.excel, "Download Excel", bootstrap_color.primary, bootstrap_size.xs);
                }

                script.close();
            }
            else
            {
                script.AppendLabel("Empty data table", true, bootstrap_style.style_warning);
            }

            return(source);
        }
        /// <summary>
        /// Shows first <c>rowLimit</c> and provides exported versions
        /// </summary>
        /// <param name="script">The script.</param>
        /// <param name="source">The source.</param>
        /// <param name="title">The title.</param>
        /// <param name="rowLimit">The row limit.</param>
        /// <returns></returns>
        public static void AppendMacroRecordLogFileBlock(this ITextAppendContentExtended script, ILogBuilder loger, string title, int lastLines = 20, macroOptions options = macroOptions.common)
        {
            string description = "";

            List <string> lines = loger.ContentToString().breakLines(true);
            int           ln    = Math.Min(lines.Count(), lastLines);

            if (ln == 0)
            {
                return;
            }

            lines.Reverse();

            //if (lines.Count < ln)
            //{
            //    description = "Log content from `" + loger.outputPath + "` with (" + ln + ") lines.";
            //}
            //else
            //{
            //    description = "Excerpt from log `" + loger.outputPath + "` limited to last (" + ln + ") lines. Total log count:" +  lines.Count + "). For complete content open one of files below.";
            //}

            if (options.HasFlag(macroOptions.wrapp))
            {
                script.open(nameof(bootstrap_containers.well), title, description);
            }
            else
            {
                script.AppendHeading(title, 4);
            }

            script.AppendLine("Log contains [" + lines.Count() + "] lines - the last [" + ln + "] is included below.");

            DataTable dr = lines.buildDataTable(imbStringCollectionExtensions.buildDataTableOptions.addCounterColumn | imbStringCollectionExtensions.buildDataTableOptions.extractExceptions, "Log");

            if (dr.validateTable())
            {
                DataTable output = dr.GetLimited(ln);

                output.SetDescription(description);

                script.AppendTable(output);

                script.AppendHorizontalLine();

                script.open(nameof(bootstrap_containers.buttontoolbar), "Format options", "");

                script.open(nameof(bootstrap_containers.buttongroup), "Data", "");

                script.Attachment(dr, dataTableExportEnum.csv, "CSV", bootstrap_color.info, bootstrap_size.sm);
                script.Attachment(dr, dataTableExportEnum.excel, "Excel", bootstrap_color.primary, bootstrap_size.sm);
                script.Attachment(dr, dataTableExportEnum.json, "JSON", bootstrap_color.info, bootstrap_size.sm);

                script.close();

                script.open(nameof(bootstrap_containers.buttongroup), "Text", "");

                script.Attachment(loger.ContentToString(), title.getFilename(".md"), "Markdown", bootstrap_color.gray, bootstrap_size.sm);

                script.close();

                script.close();
            }
            else
            {
                script.AppendLabel("The log is empty", true, bootstrap_color.warning);
            }

            if (options.HasFlag(macroOptions.wrapp))
            {
                script.close();
            }
            else
            {
                script.AppendLine(description);
            }
        }
        /// <summary>
        /// Shows first <c>rowLimit</c> and provides exported versions
        /// </summary>
        /// <param name="script">The script.</param>
        /// <param name="source">The source.</param>
        /// <param name="title">The title.</param>
        /// <param name="rowLimit">The row limit. -1 to disable row limit, 0 to use default</param>
        /// <returns></returns>
        public static DataTable AppendMacroDataTableBlock(this ITextAppendContentExtended script, DataTable source, string title = "", int rowLimit = -1, macroOptions options = macroOptions.common)
        {
            if (rowLimit == -1)
            {
                rowLimit = int.MaxValue;
            }
            if (rowLimit == 0)
            {
                rowLimit = defaultRowLimit;
            }
            int    rc          = Math.Min(source.Rows.Count, rowLimit);
            string description = "";

            if (source.Rows.Count < rowLimit)
            {
                description = "DataTable: `" + source.GetTitle() + "` with (" + source.Rows.Count + ") rows.";
            }
            else
            {
                description = "Excerpt from datatable: `" + source.GetTitle() + "` limited to (" + rc + ") rows. Total row count:" + source.Rows.Count + "). For complete content open exported file.";
            }

            if (options.HasFlag(macroOptions.wrapp))
            {
                script.open("well", source.GetTitle(title), "");
            }
            else
            {
                script.AppendHeading(source.GetTitle(), 3);
            }

            DataTable output = source.GetLimited(rc);

            if (output.validateTable())
            {
                script.AppendTable(output, true);
                //script.AppendParagraph(output.GetDescription());

                /*
                 *
                 */
            }
            else
            {
                script.AppendLabel("Empty data table", true, bootstrap_style.style_warning);
            }

            script.AppendLine(source.GetDescription());
            script.AppendLine(description);
            if (options.HasFlag(macroOptions.wrapp))
            {
                script.close();
            }

            if (options.HasFlag(macroOptions.legend))
            {
                AppendMacroLegend(script, source);
            }

            if (options.HasFlag(macroOptions.download))
            {
                script.open(nameof(bootstrap_containers.buttongroup), "", "");

                script.Attachment(source, dataTableExportEnum.csv, "CSV", bootstrap_color.sucess, bootstrap_size.sm);
                if (doAllowExcelAttachments)
                {
                    script.Attachment(source, dataTableExportEnum.excel, "Excel", bootstrap_color.primary, bootstrap_size.sm);
                }
                if (doAllowJSONAttachments)
                {
                    script.Attachment(source, dataTableExportEnum.json, "JSON", bootstrap_color.info, bootstrap_size.sm);
                }

                script.close();
            }

            script.AppendHorizontalLine();

            return(output);
        }