public Table AddTable(string title, string[] headers, string bookmark = null, string caption = "Table ") { // Add a caption for the table if (!string.IsNullOrEmpty(title)) { Paragraph p3 = DocHelper.CreateTableCaption( tableCount++, title, bookmark, caption); this.documentBody.AppendChild(p3); } Table t = DocHelper.CreateTable( DocHelper.CreateTableHeader(headers)); this.documentBody.Append(t); this.documentBody.Append( new Paragraph( new ParagraphProperties( new ParagraphStyleId() { Val = Properties.Settings.Default.BlankLinkText }))); // Blank line added for spacing to next para return(t); }
private void AddValueSetDetailTable(ValueSet valueSet, DateTime bindingDate) { string valueSetIdentifier = valueSet.GetIdentifier(this.igTypePlugin); string bookmarkId = this.GetValueSetBookmark(valueSet); List <ValueSetMember> members = valueSet.GetActiveMembers(bindingDate); if (members == null || members.Count == 0) { return; } TableCell headingCell = new TableCell( new TableCellProperties() { GridSpan = new GridSpan() { Val = 4 } }, new Paragraph( new ParagraphProperties(new ParagraphStyleId() { Val = Properties.Settings.Default.TableContentStyle }), DocHelper.CreateRun( string.Format("Value Set: {0} {1}", valueSet.Name, valueSet.GetIdentifier(igTypePlugin))))); if (!string.IsNullOrEmpty(valueSet.Description)) { headingCell.Append( new Paragraph( new ParagraphProperties(new ParagraphStyleId() { Val = Properties.Settings.Default.TableContentStyle }), DocHelper.CreateRun(valueSet.Description))); } if (!string.IsNullOrEmpty(valueSet.Source)) { headingCell.Append( new Paragraph( new ParagraphProperties(new ParagraphStyleId() { Val = Properties.Settings.Default.TableContentStyle }), DocHelper.CreateRun("Value Set Source: "), this.hyperlinkTracker.CreateUrlHyperlink(this.mainPart, valueSet.Source, valueSet.Source, Properties.Settings.Default.LinkStyle))); } TableRow headerRow = DocHelper.CreateTableHeader("Code", "Code System", "Code System OID", "Print Name"); List <TableCell> headerCells = headerRow.ChildElements.OfType <TableCell>().ToList(); headerCells[0].ChildElements.OfType <TableCellProperties>().First().TableCellWidth = new TableCellWidth() { Width = "1560" }; headerCells[1].ChildElements.OfType <TableCellProperties>().First().TableCellWidth = new TableCellWidth() { Width = "3000" }; headerCells[2].ChildElements.OfType <TableCellProperties>().First().TableCellWidth = new TableCellWidth() { Width = "3000" }; headerCells[3].ChildElements.OfType <TableCellProperties>().First().TableCellWidth = new TableCellWidth() { Width = "2520" }; Table t = DocHelper.CreateTable( new TableRow(headingCell), headerRow); int maximumMembers = this.defaultMaxMembers; if (this.valueSetMaximumMembers != null && this.valueSetMaximumMembers.ContainsKey(valueSetIdentifier)) { maximumMembers = this.valueSetMaximumMembers[valueSetIdentifier]; } int count = 0; foreach (ValueSetMember currentMember in members) { if (count >= maximumMembers) { break; } TableRow memberRow = new TableRow( new TableCell( new TableCellProperties() { TableCellWidth = new TableCellWidth() { Width = "1170" } }, new Paragraph( new ParagraphProperties( new ParagraphStyleId() { Val = Properties.Settings.Default.TableContentStyle }), DocHelper.CreateRun(currentMember.Code))), new TableCell( new TableCellProperties() { TableCellWidth = new TableCellWidth() { Width = "3195" } }, new Paragraph( new ParagraphProperties( new ParagraphStyleId() { Val = Properties.Settings.Default.TableContentStyle }), DocHelper.CreateRun(currentMember.CodeSystem.Name))), new TableCell( new TableCellProperties() { TableCellWidth = new TableCellWidth() { Width = "3195" } }, new Paragraph( new ParagraphProperties( new ParagraphStyleId() { Val = Properties.Settings.Default.TableContentStyle }), DocHelper.CreateRun(currentMember.CodeSystem.Oid))), new TableCell( new TableCellProperties() { TableCellWidth = new TableCellWidth() { Width = "2520" } }, new Paragraph( new ParagraphProperties( new ParagraphStyleId() { Val = Properties.Settings.Default.TableContentStyle }), DocHelper.CreateRun(currentMember.DisplayName))) ); t.Append(memberRow); count++; } if (count <= members.Count - 1 || valueSet.IsIncomplete) { TableRow moreMembersRow = new TableRow( new TableCell( new TableCellProperties() { GridSpan = new GridSpan() { Val = 4 } }, new Paragraph( new ParagraphProperties( new ParagraphStyleId() { Val = Properties.Settings.Default.TableContentStyle }), DocHelper.CreateRun("...")))); t.Append(moreMembersRow); } this.tables.AddTable(valueSet.Name, t, bookmarkId); }