Esempio n. 1
0
        private static string createTable(DataView data, ITeXConverter converter, ITeXBuilderRepository builderRepository, bool hasNotes, string header, Dictionary <string, char> tableNotes, int spaceNeeded = 6, string caption = null, string label = null)
        {
            var tex = new StringBuilder();

            //if the available space is less than 6 lines the table starts on next page to avoid page breaks for with no lines.
            tex.Append(Helper.Needspace(Helper.BaseLineSkip(spaceNeeded)));
            tex.Append(Helper.Begin(Helper.Environments.center));
            tex.Append(arrayStretch(ARRAY_STRETCH));

            if (hasNotes)
            {
                tex.Append(Helper.Begin(Helper.Environments.ThreePartTable));
            }

            tex.Append(Helper.Begin(Helper.Environments.longtabu));
            tex.AppendFormat(" to {0}\\linewidth", TABLE_WIDTH);
            tex.Append(createColumnDesign(data));

            //Create header
            tex.Append(header);

            // rows
            tex.Append(createRows(data, tableNotes, converter, builderRepository));
            tex.Append(HLine());

            if (caption != null)
            {
                tex.Append(Helper.Caption(caption));
                tex.Append(Helper.Label(label));
                tex.Append(Helper.LineBreak());
            }

            tex.Append(Helper.End(Helper.Environments.longtabu));

            if (caption == null)
            {
                //the longtable package always increases the table counter. If no caption is set that is not wanted.
                tex.Append(decreaseTableCounter());
            }

            if (hasNotes)
            {
                tex.Append(TableWriter.tableNotes(tableNotes, converter));
                tex.Append(Helper.End(Helper.Environments.ThreePartTable));
            }

            tex.Append(Helper.End(Helper.Environments.center));
            return(tex.ToString());
        }
Esempio n. 2
0
        private static string longTableHeader(DataView data, Dictionary <string, char> tableNotes, ITeXConverter converter)
        {
            const string END_HEAD       = "\\endhead\n";
            const string END_FIRST_HEAD = "\\endfirsthead\n";
            const string END_FOOT       = "\\endfoot\n";
            const string END_LAST_FOOT  = "\\endlastfoot\n";

            var header       = TableWriter.header(data, tableNotes, converter);
            var shownColumns = data.Table.Columns.Cast <DataColumn>().Count(col => !col.IsHidden());

            var tex = new StringBuilder();

            //table header for all continued pages
            tex.Append(HLine());
            tex.Append(multiFirstColumn(shownColumns, ColumnAlignments.l, "\\small\\sl continued from previous page"));
            tex.Append(Helper.LineBreak());
            tex.Append(HLine());
            tex.Append(header);
            tex.Append(HLine());
            tex.Append(END_HEAD);

            //table header
            tex.Append(HLine());
            tex.Append(header);
            tex.Append(HLine());
            tex.Append(END_FIRST_HEAD);

            //table tail
            tex.Append(HLine());
            tex.Append(multiFirstColumn(shownColumns, ColumnAlignments.r, "\\small\\sl continued on next page"));
            tex.Append(Helper.LineBreak());
            tex.Append(HLine());
            tex.Append(END_FOOT);

            //table last tail
            tex.Append(END_LAST_FOOT);

            return(tex.ToString());
        }