public void AddTitle(String title, int fontSize) { HtmlTableRow row = _titleTable.AddRow(new object[] { title }, null, fontSize * 2); bool headerCell; HtmlTableCell cell = row.Cell(0, out headerCell); cell.FontSize = fontSize; //ReportForm.AddTitles(title, fontSize); }
//ReportViewerHandler_new _rh; /* * public void setReportDialog(String rdlcFile, String DataSetName = "DataSet1") * { * _rh = new ReportViewerHandler_new(components, this, DockStyle.Fill, "rv", DataSetName, rdlcFile); * _rh.getReportVeiwer().Print += new CancelEventHandler(ReportViewer_Print); * } * * * void ReportViewer_Print(object sender, CancelEventArgs e) * { * System.Drawing.Printing.PrintDocument pdoc = new System.Drawing.Printing.PrintDocument(); * } * * private void ReportDialog_Load(object sender, EventArgs e) * { * * //this.ReportViewer.RefreshReport(); * _rh.getReportVeiwer().RefreshReport(); * } */ public void AddFields(int pageWidth, ICollection <object> Names, ICollection <int> columnWidths, ICollection <String> TitleTexts = null, ICollection <Type> types = null) { this.Width = 500; //float rate = 40.0f; //float wid = pageWidth / rate; _table = _report.AddTable(columnWidths); int totalWidth = 0; foreach (int wid in columnWidths) { totalWidth += wid; } _titleTable.Widths = new int[] { totalWidth }; _headerTable.Widths = new int[] { totalWidth - 200, 100, 100 }; _table.BorderWidth = 1; _table.BorderColor = Color.Black; HtmlTableRow header = _table.AddRow(Names); header.BackColor = Color.Green; header.Height = 50; }
protected static async Task <string> ParseElementAsync(IParseManager parseManager, ListInfo listInfo, List <KeyValuePair <int, Dictionary <string, object> > > dataSource) { var pageInfo = parseManager.PageInfo; if (dataSource == null || dataSource.Count == 0) { return(string.Empty); } var builder = new StringBuilder(); if (listInfo.Layout == Layout.None) { if (!string.IsNullOrEmpty(listInfo.HeaderTemplate)) { builder.Append(listInfo.HeaderTemplate); } var isAlternative = false; var isSeparator = false; if (!string.IsNullOrEmpty(listInfo.AlternatingItemTemplate)) { isAlternative = true; } if (!string.IsNullOrEmpty(listInfo.SeparatorTemplate)) { isSeparator = true; } for (var i = 0; i < dataSource.Count; i++) { var dict = dataSource[i]; pageInfo.SqlItems.Push(dict); var templateString = isAlternative && i % 2 == 1 ? listInfo.AlternatingItemTemplate : listInfo.ItemTemplate; builder.Append(await TemplateUtility.GetSqlContentsTemplateStringAsync(templateString, listInfo.SelectedItems, listInfo.SelectedValues, string.Empty, parseManager, ParseType.SqlContent)); if (isSeparator && i != dataSource.Count - 1) { builder.Append(listInfo.SeparatorTemplate); } } if (!string.IsNullOrEmpty(listInfo.FooterTemplate)) { builder.Append(listInfo.FooterTemplate); } } else { var isAlternative = !string.IsNullOrEmpty(listInfo.AlternatingItemTemplate); var tableAttributes = listInfo.GetTableAttributes(); var cellAttributes = listInfo.GetCellAttributes(); using (var table = new HtmlTable(builder, tableAttributes)) { if (!string.IsNullOrEmpty(listInfo.HeaderTemplate)) { table.StartHead(); using (var tHead = table.AddRow()) { tHead.AddCell(listInfo.HeaderTemplate, cellAttributes); } table.EndHead(); } table.StartBody(); var columns = listInfo.Columns <= 1 ? 1 : listInfo.Columns; var itemIndex = 0; while (true) { using var tr = table.AddRow(); for (var cell = 1; cell <= columns; cell++) { var cellHtml = string.Empty; if (itemIndex < dataSource.Count) { var dict = dataSource[itemIndex]; pageInfo.SqlItems.Push(dict); var templateString = isAlternative && itemIndex % 2 == 1 ? listInfo.AlternatingItemTemplate : listInfo.ItemTemplate; cellHtml = await TemplateUtility.GetSqlContentsTemplateStringAsync(templateString, listInfo.SelectedItems, listInfo.SelectedValues, string.Empty, parseManager, ParseType.SqlContent); } tr.AddCell(cellHtml, cellAttributes); itemIndex++; } if (itemIndex >= dataSource.Count) { break; } } table.EndBody(); if (!string.IsNullOrEmpty(listInfo.FooterTemplate)) { table.StartFoot(); using (var tFoot = table.AddRow()) { tFoot.AddCell(listInfo.FooterTemplate, cellAttributes); } table.EndFoot(); } } } return(builder.ToString()); }
private static async Task <string> ParseImplAsync(IParseManager parseManager, ListInfo listInfo) { var pageInfo = parseManager.PageInfo; var type = listInfo.Others.Get(Type); if (string.IsNullOrEmpty(type)) { type = nameof(Content.ImageUrl); } var valueList = new List <string>(); var content = await parseManager.GetContentAsync(); if (content != null) { if (!string.IsNullOrEmpty(content.Get <string>(type))) { valueList.Add(content.Get <string>(type)); } var countName = ColumnsManager.GetCountName(type); var total = content.Get <int>(countName); for (var i = 1; i <= total; i++) { var extendName = ColumnsManager.GetExtendName(type, i); var extend = content.Get <string>(extendName); valueList.Add(extend); } //var extendAttributeName = ColumnsManager.GetExtendAttributeName(type); //var extendValues = content.Get<string>(extendAttributeName); //if (!string.IsNullOrEmpty(extendValues)) //{ // foreach (var extendValue in ListUtils.GetStringList(extendValues)) // { // valueList.Add(extendValue); // } //} if (listInfo.StartNum > 1 || listInfo.TotalNum > 0) { if (listInfo.StartNum > 1) { var count = listInfo.StartNum - 1; if (count > valueList.Count) { count = valueList.Count; } valueList.RemoveRange(0, count); } if (listInfo.TotalNum > 0) { if (listInfo.TotalNum < valueList.Count) { valueList.RemoveRange(listInfo.TotalNum, valueList.Count - listInfo.TotalNum); } } } } if (valueList.Count == 0) { return(string.Empty); } var eachList = new List <KeyValuePair <int, object> >(); var index = 0; foreach (string value in valueList) { eachList.Add(new KeyValuePair <int, object>(index++, value)); } var builder = new StringBuilder(); if (listInfo.Layout == Layout.None) { if (!string.IsNullOrEmpty(listInfo.HeaderTemplate)) { builder.Append(listInfo.HeaderTemplate); } var isAlternative = false; var isSeparator = false; if (!string.IsNullOrEmpty(listInfo.AlternatingItemTemplate)) { isAlternative = true; } if (!string.IsNullOrEmpty(listInfo.SeparatorTemplate)) { isSeparator = true; } for (var i = 0; i < eachList.Count; i++) { var each = eachList[i]; pageInfo.EachItems.Push(each); var templateString = isAlternative && i % 2 == 1 ? listInfo.AlternatingItemTemplate : listInfo.ItemTemplate; builder.Append(await TemplateUtility.GetEachsTemplateStringAsync(templateString, listInfo.SelectedItems, listInfo.SelectedValues, string.Empty, parseManager, ParseType.Each)); if (isSeparator && i != eachList.Count - 1) { builder.Append(listInfo.SeparatorTemplate); } } if (!string.IsNullOrEmpty(listInfo.FooterTemplate)) { builder.Append(listInfo.FooterTemplate); } } else { var isAlternative = !string.IsNullOrEmpty(listInfo.AlternatingItemTemplate); var tableAttributes = listInfo.GetTableAttributes(); var cellAttributes = listInfo.GetCellAttributes(); using var table = new HtmlTable(builder, tableAttributes); if (!string.IsNullOrEmpty(listInfo.HeaderTemplate)) { table.StartHead(); using (var tHead = table.AddRow()) { tHead.AddCell(listInfo.HeaderTemplate, cellAttributes); } table.EndHead(); } table.StartBody(); var columns = listInfo.Columns <= 1 ? 1 : listInfo.Columns; var itemIndex = 0; while (true) { using var tr = table.AddRow(); for (var cell = 1; cell <= columns; cell++) { var cellHtml = string.Empty; if (itemIndex < eachList.Count) { var each = eachList[itemIndex]; pageInfo.EachItems.Push(each); var templateString = isAlternative && itemIndex % 2 == 1 ? listInfo.AlternatingItemTemplate : listInfo.ItemTemplate; cellHtml = await TemplateUtility.GetEachsTemplateStringAsync(templateString, listInfo.SelectedItems, listInfo.SelectedValues, string.Empty, parseManager, ParseType.Each); } tr.AddCell(cellHtml, cellAttributes); itemIndex++; } if (itemIndex >= eachList.Count) { break; } } table.EndBody(); if (!string.IsNullOrEmpty(listInfo.FooterTemplate)) { table.StartFoot(); using (var tFoot = table.AddRow()) { tFoot.AddCell(listInfo.FooterTemplate, cellAttributes); } table.EndFoot(); } } return(builder.ToString()); }
public void AddARow(object[] items, Dictionary <int, String> colors = null) { HtmlTableRow row = _table.AddRow(items); }
public void AddInfo(String name, String info) { _headerTable.AddRow(new string[] { "", name, info }, null, 40); }
private static async Task <string> ParseElementAsync(IParseManager parseManager, ListInfo listInfo, List <KeyValuePair <int, Site> > sites) { var pageInfo = parseManager.PageInfo; var contextInfo = parseManager.ContextInfo; if (sites == null || sites.Count == 0) { return(string.Empty); } var builder = new StringBuilder(); if (listInfo.Layout == Layout.None) { if (!string.IsNullOrEmpty(listInfo.HeaderTemplate)) { builder.Append(listInfo.HeaderTemplate); } var isAlternative = false; var isSeparator = false; if (!string.IsNullOrEmpty(listInfo.AlternatingItemTemplate)) { isAlternative = true; } if (!string.IsNullOrEmpty(listInfo.SeparatorTemplate)) { isSeparator = true; } for (var i = 0; i < sites.Count; i++) { var site = sites[i]; pageInfo.SiteItems.Push(site); var templateString = isAlternative ? listInfo.AlternatingItemTemplate : listInfo.ItemTemplate; var parsedString = await TemplateUtility.GetSitesTemplateStringAsync(templateString, string.Empty, parseManager, ParseType.Site); builder.Append(parsedString); if (isSeparator && i != sites.Count - 1) { builder.Append(listInfo.SeparatorTemplate); } } if (!string.IsNullOrEmpty(listInfo.FooterTemplate)) { builder.Append(listInfo.FooterTemplate); } } else { var isAlternative = !string.IsNullOrEmpty(listInfo.AlternatingItemTemplate); var tableAttributes = listInfo.GetTableAttributes(); var cellAttributes = listInfo.GetCellAttributes(); using var table = new HtmlTable(builder, tableAttributes); if (!string.IsNullOrEmpty(listInfo.HeaderTemplate)) { table.StartHead(); using (var tHead = table.AddRow()) { tHead.AddCell(listInfo.HeaderTemplate, cellAttributes); } table.EndHead(); } table.StartBody(); var columns = listInfo.Columns <= 1 ? 1 : listInfo.Columns; var itemIndex = 0; while (true) { using var tr = table.AddRow(null); for (var cell = 1; cell <= columns; cell++) { var cellHtml = string.Empty; if (itemIndex < sites.Count) { var site = sites[itemIndex]; pageInfo.SiteItems.Push(site); var templateString = isAlternative ? listInfo.AlternatingItemTemplate : listInfo.ItemTemplate; cellHtml = await TemplateUtility.GetSitesTemplateStringAsync(templateString, string.Empty, parseManager, ParseType.Site); } tr.AddCell(cellHtml, cellAttributes); itemIndex++; } if (itemIndex >= sites.Count) { break; } } table.EndBody(); if (!string.IsNullOrEmpty(listInfo.FooterTemplate)) { table.StartFoot(); using (var tFoot = table.AddRow()) { tFoot.AddCell(listInfo.FooterTemplate, cellAttributes); } table.EndFoot(); } } return(builder.ToString()); }