private NTable CreateTable() { NTable table = new NTable(); int rowCount = 3; int colCount = 3; // first create the columns for (int i = 0; i < colCount; i++) { table.Columns.Add(new NTableColumn()); } // then add rows with cells count matching the number of columns for (int row = 0; row < rowCount; row++) { NTableRow tableRow = new NTableRow(); table.Rows.Add(tableRow); for (int col = 0; col < colCount; col++) { NTableCell tableCell = new NTableCell(); tableRow.Cells.Add(tableCell); tableCell.Margins = new NMargins(4); tableCell.Border = NBorder.CreateFilledBorder(NColor.Black); tableCell.BorderThickness = new NMargins(1); NParagraph paragraph = new NParagraph("This is table cell [" + row.ToString() + ", " + col.ToString() + "]"); tableCell.Blocks.Add(paragraph); } } return(table); }
/// <summary> /// Adds a total row to the shopping cart /// </summary> void AddTotalRow() { NTableRow totalRow = m_CartTable.Rows.CreateNewRow(); NTableCell totalCell = totalRow.Cells[0]; totalCell.Blocks.Clear(); totalCell.ColSpan = 3; totalCell.Blocks.Add(new NParagraph("Grand Total:")); m_CartTable.Rows.Add(totalRow); }
/// <summary> /// Called when a row must be deleted from the shopping cart /// </summary> /// <param name="arg"></param> void OnDeleteRowButtonClick(NEventArgs arg) { NTableRow tableRow = (NTableRow)arg.TargetNode.GetFirstAncestor(NTableRow.NTableRowSchema); m_CartTable.Rows.Remove(tableRow); if (m_CartTable.Rows.Count == 2) { m_CartTable.Rows.RemoveAt(m_CartTable.Rows.Count - 1); m_CartTable = null; AddEmptyShoppingCartText(); } UpdateTotals(); }
private NTableBlock CreateTableBlock(string description) { NTableBlock tableBlock = new NTableBlock(4, 3, NBorder.CreateFilledBorder(NColor.Black), new NMargins(1)); NTableBlockContent tableBlockContent = tableBlock.Content; NTableCell tableCell = tableBlock.Content.Rows[0].Cells[0]; tableCell.ColSpan = int.MaxValue; tableCell.Blocks.Clear(); NParagraph par = new NParagraph(description); par.FontStyleBold = true; tableCell.Blocks.Add(par); for (int rowIndex = 1; rowIndex < tableBlockContent.Rows.Count; rowIndex++) { NTableRow row = tableBlockContent.Rows[rowIndex]; for (int colIndex = 0; colIndex < tableBlockContent.Columns.Count; colIndex++) { NTableCell cell = row.Cells[colIndex]; cell.Blocks.Clear(); cell.Blocks.Add(new NParagraph("This is table cell [" + rowIndex.ToString() + ", " + colIndex.ToString() + "]")); } } NTableCellIterator iter = new NTableCellIterator(tableBlockContent); while (iter.MoveNext()) { iter.Current.VerticalAlignment = ENVAlign.Center; iter.Current.HorizontalAlignment = ENAlign.Center; } // make sure all columns are percentage based double percent = 100 / tableBlockContent.Columns.Count; for (int i = 0; i < tableBlockContent.Columns.Count; i++) { tableBlockContent.Columns[i].PreferredWidth = new Nevron.Nov.NMultiLength(Nevron.Nov.ENMultiLengthUnit.Percentage, percent); } return(tableBlock); }
/// <summary> /// Updates the total values in the shopping cart /// </summary> void UpdateTotals() { if (m_CartTable == null || m_CartTable.Columns.Count != 5) { return; } double grandTotal = 0; // sum all book info price * quantity for (int i = 0; i < m_CartTable.Rows.Count; i++) { NTableRow row = m_CartTable.Rows[i]; NBookInfo bookInfo = row.Tag as NBookInfo; if (bookInfo != null) { NVFlowBlockCollection <Nevron.Nov.Text.NBlock> blocks = row.Cells[1].Blocks; NComboBox combo = (NComboBox)blocks.GetFirstDescendant(new NInstanceOfSchemaFilter(NComboBox.NComboBoxSchema)); if (combo != null) { double total = (combo.SelectedIndex + 1) * bookInfo.Price; row.Cells[3].Blocks.Clear(); row.Cells[3].Blocks.Add(new NParagraph(total.ToString())); grandTotal += total; } } } NTableCell grandTotalCell = m_CartTable.Rows[m_CartTable.Rows.Count - 1].Cells[3]; grandTotalCell.Blocks.Clear(); grandTotalCell.Blocks.Add(new NParagraph(grandTotal.ToString())); }
/// <summary> /// Adds a book row to the shopping cart /// </summary> void AddBookRow() { NBookInfo bookInfo = m_Books[m_CurrentBookIndex]; NTableRow bookRow = new NTableRow(); bookRow.Tag = bookInfo; NTableCell nameCell = new NTableCell(); nameCell.Blocks.Add(new NParagraph(bookInfo.Name)); bookRow.Cells.Add(nameCell); NTableCell quantityCell = new NTableCell(); quantityCell.Blocks.Add(CreateWidgetParagraph(CreateQuantityCombo())); bookRow.Cells.Add(quantityCell); NTableCell priceCell = new NTableCell(); priceCell.Blocks.Add(new NParagraph(bookInfo.Price.ToString())); bookRow.Cells.Add(priceCell); NTableCell totalCell = new NTableCell(); totalCell.Blocks.Add(new NParagraph()); bookRow.Cells.Add(totalCell); NTableCell deleteCell = new NTableCell(); NButton deleteRowButton = new NButton("Delete"); deleteRowButton.Click += new Function <NEventArgs>(OnDeleteRowButtonClick); deleteCell.Blocks.Add(CreateWidgetParagraph(deleteRowButton)); bookRow.Cells.Add(deleteCell); m_CartTable.Rows.Insert(m_CartTable.Rows.Count - 1, bookRow); }
protected override void PopulateRichText() { { NSection headerSection = new NSection(); m_RichText.Content.Sections.Add(headerSection); headerSection.Blocks.Add(CreateTitleParagraph("Welcome to our annual report\nFurther information on Sample Group can be found at:\n www.samplegroup.com")); headerSection.Blocks.Add(CreateContentParagraph("Sample Group is a diversified international market infrastructure and capital markets business sitting at the heart of the world’s financial community.")); headerSection.Blocks.Add(CreateContentParagraph("The Group operates a broad range of international equity, bond and derivatives markets, including Stock Exchange; Europe’s leading fixed income market; and a pan-European equities MTF. Through its platforms, the Group offers international business and investors unrivalled access to Europe’s capital markets.")); headerSection.Blocks.Add(CreateContentParagraph("Post trade and risk management services are a significant part of the Group’s business operations. In addition to majority ownership of multi-asset global CCP operator, Sunset Group, the Group operates G&B, a clearing house; Monte Span, the European settlement business; and AutoSettle, the Group’s newly established central securities depository based in Luxembourg. The Group is a global leader in indexing and analytic solutions. The Group also provides customers with an extensive range of real time and reference data products. The Group is a leading developer of high performance trading platforms and capital markets software for customers around the world, through MillenniumIT. Since December 2014, the Group has owned Bonita Investments, an investment management business.")); headerSection.Blocks.Add(CreateContentParagraph("Headquartered in London, with significant operations in North America, China and Russia, the Group employs approximately 6000 people")); } { NSection financialHighlightsSection = new NSection(); financialHighlightsSection.BreakType = ENSectionBreakType.NextPage; m_RichText.Content.Sections.Add(financialHighlightsSection); financialHighlightsSection.Blocks.Add(CreateTitleParagraph("Financial highlights")); financialHighlightsSection.Blocks.Add(CreateContentParagraph("The following charts provide insight to the group's total income, operating profit, and earnings per share for the years since 2008.")); NSize chartSize = new NSize(300, 200); { NTable table = new NTable(); table.AllowSpacingBetweenCells = false; table.Columns.Add(new NTableColumn()); table.Columns.Add(new NTableColumn()); financialHighlightsSection.Blocks.Add(table); { NTableRow tableRow = new NTableRow(); table.Rows.Add(tableRow); { NTableCell tableCell = new NTableCell(); tableCell.Blocks.Add(CreateSampleBarChart(chartSize, "Adjusted total income", new double[] { 674.9, 814.8, 852.9, 1, 213.1, 1, 043.9, 1, 096.4, 1, 381.1 }, new string[] { "2008", "2009", "2010", "2011", "2012", "2013", "2014" })); tableRow.Cells.Add(tableCell); } { NTableCell tableCell = new NTableCell(); tableCell.Blocks.Add(CreateSampleBarChart(chartSize, "Adjusted operating profit", new double[] { 341.1, 441.9, 430.2, 514.7, 417.5, 479.9, 558.0 }, new string[] { "2008", "2009", "2010", "2011", "2012", "2013", "2014" })); tableRow.Cells.Add(tableCell); } } { NTableRow tableRow = new NTableRow(); table.Rows.Add(tableRow); { NTableCell tableCell = new NTableCell(); tableCell.Blocks.Add(CreateSampleBarChart(chartSize, "Operating profit", new double[] { 283.0, 358.5, 348.4, 353.1, 242.1, 329.4, 346.0 }, new string[] { "2008", "2009", "2010", "2011", "2012", "2013", "2014" })); tableRow.Cells.Add(tableCell); } { NTableCell tableCell = new NTableCell(); tableCell.Blocks.Add(CreateSampleBarChart(chartSize, "Adjusted earnings per share", new double[] { 67.9, 92.6, 97.0, 98.6, 75.6, 96.5, 103.3 }, new string[] { "2008", "2009", "2010", "2011", "2012", "2013", "2014" })); tableRow.Cells.Add(tableCell); } } } } { NSection operationalHighlights = new NSection(); operationalHighlights.ColumnCount = 2; operationalHighlights.BreakType = ENSectionBreakType.NextPage; operationalHighlights.Blocks.Add(CreateTitleParagraph("Operational highlights")); m_RichText.Content.Sections.Add(operationalHighlights); operationalHighlights.Blocks.Add(CreateContentParagraph("The Group is delivering on its strategy, leveraging its range of products and services and further diversifying its offering through new product development and strategic investments. A few examples of the progress being made are highlighted below: ")); operationalHighlights.Blocks.Add(CreateContentParagraph("Capital Markets")); { NBulletList bulletList = new NBulletList(ENBulletListTemplateType.Bullet); m_RichText.Content.BulletLists.Add(bulletList); { NParagraph par = CreateContentParagraph("Revenues for calendar year 2014 increased by 12 per cent to £333.2 million (2013: £296.8 million). Primary Markets saw a seven year high in new issue activity with 219 new companies admitted, including AA, the largest UK capital raising IPO of the year"); par.SetBulletList(bulletList, 0); operationalHighlights.Blocks.Add(par); } { NParagraph par = CreateContentParagraph("UK cash equity average daily value traded increased 15 per cent and average daily number of trades in Italy increased 16 per cent"); par.SetBulletList(bulletList, 0); operationalHighlights.Blocks.Add(par); } { NParagraph par = CreateContentParagraph("Average daily value traded on Turquoise, our European cash equities MTF, increased 42 per cent to €3.7 billion per day and share of European trading increased to over 9 per cent"); par.SetBulletList(bulletList, 0); operationalHighlights.Blocks.Add(par); } { NParagraph par = CreateContentParagraph("In Fixed Income, MTS cash and BondVision value traded increased by 32 per cent, while MTS Repo value traded increased by 3 per cent"); par.SetBulletList(bulletList, 0); operationalHighlights.Blocks.Add(par); } } operationalHighlights.Blocks.Add(CreateContentParagraph("Post Trade Services")); { NBulletList bulletList = new NBulletList(ENBulletListTemplateType.Bullet); m_RichText.Content.BulletLists.Add(bulletList); { NParagraph par = CreateContentParagraph("Revenues for calendar year 2014 increased by 3 per cent in constant currency terms. In sterling terms revenues declined by 2 per cent to £96.5 million"); par.SetBulletList(bulletList, 0); operationalHighlights.Blocks.Add(par); } { NParagraph par = CreateContentParagraph("Our Group cleared 69.7 million equity trades, up 16 per cent and 39.0 million derivative contracts up 20 per cent"); par.SetBulletList(bulletList, 0); operationalHighlights.Blocks.Add(par); } { NParagraph par = CreateContentParagraph("Our Group is the largest CSD entering the first wave of TARGET2-Securities from June 2015. Successful testing with the European Central Bank finished in December 2014. In addition, Our Group moved settlement of contracts executed on the Italian market from T+3 to T+2 in October 2014"); par.SetBulletList(bulletList, 0); operationalHighlights.Blocks.Add(par); } } operationalHighlights.Blocks.Add(CreateContentParagraph("Post Trade Services 2")); { NBulletList bulletList = new NBulletList(ENBulletListTemplateType.Bullet); m_RichText.Content.BulletLists.Add(bulletList); { NParagraph par = CreateContentParagraph("Adjusted income for the calendar year 2014 was £389.4 million, up 24 per cent on a pro forma constant currency basis. LCH.Clearnet received EMIR reauthorisation for the UK and France businesses — SwapClear, the world’s leading interest rate swap clearing service, cleared $642 trillion notional, up 26 per cent"); par.SetBulletList(bulletList, 0); operationalHighlights.Blocks.Add(par); } { NParagraph par = CreateContentParagraph("Compression services at SwapClear reduced level of notional outstanding, from $426 trillion to $362 trillion"); par.SetBulletList(bulletList, 0); operationalHighlights.Blocks.Add(par); } { NParagraph par = CreateContentParagraph("Our Group was granted clearing house recognition in Canada and Australia"); par.SetBulletList(bulletList, 0); operationalHighlights.Blocks.Add(par); } { NParagraph par = CreateContentParagraph("Clearing of commodities for the London Metal Exchange ceased in September 2014 as expected"); par.SetBulletList(bulletList, 0); operationalHighlights.Blocks.Add(par); } { NParagraph par = CreateContentParagraph("RepoClear, one of Europe’s largest fixed income clearers, cleared €73.4 trillion in nominal value, up 1 per cent"); par.SetBulletList(bulletList, 0); operationalHighlights.Blocks.Add(par); } operationalHighlights.Blocks.Add(CreateContentParagraph("Group Adjusted Total Income by segment")); NTable table = new NTable(); table.Margins = new NMargins(10); table.AllowSpacingBetweenCells = false; operationalHighlights.Blocks.Add(table); table.Columns.Add(new NTableColumn()); table.Columns.Add(new NTableColumn()); table.Columns.Add(new NTableColumn()); { NTableRow tableRow = new NTableRow(); table.Rows.Add(tableRow); NTableCell tc1 = CreateTableCellWithBorder(); tableRow.Cells.Add(tc1); NTableCell tc2 = CreateTableCellWithBorder(); tc2.Blocks.Add(CreateContentParagraph("2013")); tableRow.Cells.Add(tc2); NTableCell tc3 = CreateTableCellWithBorder(); tc3.Blocks.Add(CreateContentParagraph("2014")); tableRow.Cells.Add(tc3); } { NTableRow tableRow = new NTableRow(); table.Rows.Add(tableRow); NTableCell tc1 = CreateTableCellWithBorder(); tc1.Blocks.Add(CreateContentParagraph("Capital Markets")); tableRow.Cells.Add(tc1); NTableCell tc2 = CreateTableCellWithBorder(); tc2.Blocks.Add(CreateContentParagraph("249.1")); tableRow.Cells.Add(tc2); NTableCell tc3 = CreateTableCellWithBorder(); tc3.Blocks.Add(CreateContentParagraph("333.2")); tableRow.Cells.Add(tc3); } { NTableRow tableRow = new NTableRow(); table.Rows.Add(tableRow); NTableCell tc1 = CreateTableCellWithBorder(); tc1.Blocks.Add(CreateContentParagraph("Post Trade Service")); tableRow.Cells.Add(tc1); NTableCell tc2 = CreateTableCellWithBorder(); tc2.Blocks.Add(CreateContentParagraph("94.7")); tableRow.Cells.Add(tc2); NTableCell tc3 = CreateTableCellWithBorder(); tc3.Blocks.Add(CreateContentParagraph("129.1")); tableRow.Cells.Add(tc3); } { NTableRow tableRow = new NTableRow(); table.Rows.Add(tableRow); NTableCell tc1 = CreateTableCellWithBorder(); tc1.Blocks.Add(CreateContentParagraph("Information Services ")); tableRow.Cells.Add(tc1); NTableCell tc2 = CreateTableCellWithBorder(); tc2.Blocks.Add(CreateContentParagraph("281.0")); tableRow.Cells.Add(tc2); NTableCell tc3 = CreateTableCellWithBorder(); tc3.Blocks.Add(CreateContentParagraph("373.0")); tableRow.Cells.Add(tc3); } { NTableRow tableRow = new NTableRow(); table.Rows.Add(tableRow); NTableCell tc1 = CreateTableCellWithBorder(); tc1.Blocks.Add(CreateContentParagraph("Technology Services")); tableRow.Cells.Add(tc1); NTableCell tc2 = CreateTableCellWithBorder(); tc2.Blocks.Add(CreateContentParagraph("47.3")); tableRow.Cells.Add(tc2); NTableCell tc3 = CreateTableCellWithBorder(); tc3.Blocks.Add(CreateContentParagraph("66.0")); tableRow.Cells.Add(tc3); } { NTableRow tableRow = new NTableRow(); table.Rows.Add(tableRow); NTableCell tc1 = CreateTableCellWithBorder(); tc1.Blocks.Add(CreateContentParagraph("Other")); tableRow.Cells.Add(tc1); NTableCell tc2 = CreateTableCellWithBorder(); tc2.Blocks.Add(CreateContentParagraph("87.2")); tableRow.Cells.Add(tc2); NTableCell tc3 = CreateTableCellWithBorder(); tc3.Blocks.Add(CreateContentParagraph("90.4")); tableRow.Cells.Add(tc3); } } } }
/// <summary> /// /// </summary> protected override void PopulateRichText() { NSection section = new NSection(); m_RichText.Content.Sections.Add(section); NParagraph paragraph = new NParagraph(); paragraph.HorizontalAlignment = ENAlign.Center; paragraph.Inlines.Add(CreateHeaderText("ACME Corporation")); paragraph.Inlines.Add(new NLineBreakInline()); paragraph.Inlines.Add(CreateNormalText("Monthly Health Report")); section.Blocks.Add(paragraph); // generate sample data double[] sales = new double[12]; double[] hours = new double[12]; double[] profitloss = new double[12]; string[] months = new string[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; Random random = new Random(); for (int i = 0; i < 12; i++) { sales[i] = 50 + random.Next(50); hours[i] = 50 + random.Next(50); profitloss[i] = 25 - random.Next(50); } NTable table = new NTable(); section.Blocks.Add(table); table.Columns.Add(new NTableColumn()); table.Columns.Add(new NTableColumn()); { NTableRow tableRow = new NTableRow(); NTableCell tableCell1 = new NTableCell(); NParagraph par1 = new NParagraph(); par1.Inlines.Add(CreateHeaderText("Sales New Projects")); tableCell1.Blocks.Add(par1); tableRow.Cells.Add(tableCell1); NTableCell tableCell2 = new NTableCell(); tableCell2.Blocks.Add(new NParagraph()); tableRow.Cells.Add(tableCell2); table.Rows.Add(tableRow); } { NTableRow tableRow = new NTableRow(); NTableCell tableCell1 = new NTableCell(); NParagraph par1 = new NParagraph(); par1.Inlines.Add(CreateHeaderText("Total Sales: " + GetTotal(sales).ToString())); par1.Inlines.Add(new NLineBreakInline()); par1.Inlines.Add(CreateNormalText("Last Month: " + sales[11].ToString())); tableCell1.Blocks.Add(par1); tableRow.Cells.Add(tableCell1); NTableCell tableCell2 = new NTableCell(); tableCell2.Blocks.Add(CreateBarChart(true, new NSize(400, 200), "Sales", sales, months)); tableRow.Cells.Add(tableCell2); table.Rows.Add(tableRow); } { NTableRow tableRow = new NTableRow(); NTableCell tableCell1 = new NTableCell(); NParagraph par1 = new NParagraph(); par1.Inlines.Add(CreateHeaderText("Billable Hours: " + GetTotal(hours).ToString())); par1.Inlines.Add(new NLineBreakInline()); par1.Inlines.Add(CreateNormalText("Last Month: " + hours[11].ToString())); tableCell1.Blocks.Add(par1); tableRow.Cells.Add(tableCell1); NTableCell tableCell2 = new NTableCell(); tableCell2.Blocks.Add(CreateBarChart(false, new NSize(400, 200), "Hours", hours, months)); tableRow.Cells.Add(tableCell2); table.Rows.Add(tableRow); } { NTableRow tableRow = new NTableRow(); NTableCell tableCell1 = new NTableCell(); NParagraph par1 = new NParagraph(); par1.Inlines.Add(CreateHeaderText("Profit / Loss: " + GetTotal(profitloss).ToString())); par1.Inlines.Add(new NLineBreakInline()); par1.Inlines.Add(CreateNormalText("Last Month: " + profitloss[11].ToString())); tableCell1.Blocks.Add(par1); tableRow.Cells.Add(tableCell1); NTableCell tableCell2 = new NTableCell(); tableCell2.Blocks.Add(CreateBarChart(false, new NSize(400, 200), "Profit / Loss", hours, months)); tableRow.Cells.Add(tableCell2); table.Rows.Add(tableRow); } }
protected override void PopulateRichText() { NSection section = new NSection(); m_RichText.Content.Sections.Add(section); section.Blocks.Add(GetDescriptionBlock("Table Column Types Example", "This example shows how to set the table column preferred width.", 1)); { // create the table NTable table = new NTable(); table.AllowSpacingBetweenCells = false; int columnCount = 5; int rowCount = 5; for (int row = 0; row < rowCount; row++) { NTableRow tableRow = new NTableRow(); table.Rows.Add(tableRow); for (int col = 0; col < columnCount; col++) { NParagraph paragraph; if (row == 0) { // set table column preferred width string headerText = string.Empty; NTableColumn tableColumn = new NTableColumn(); if (col % 2 == 0) { tableColumn.BackgroundFill = new NColorFill(NColor.LightGray); } else { tableColumn.BackgroundFill = new NColorFill(NColor.Beige); } switch (col) { case 0: // Fixed column tableColumn.PreferredWidth = new NMultiLength(ENMultiLengthUnit.Dip, 80); headerText = "Fixed [80dips]"; break; case 1: // Auto headerText = "Automatic"; break; case 2: // Percentage tableColumn.PreferredWidth = new NMultiLength(ENMultiLengthUnit.Percentage, 20); headerText = "Percentage [20%]"; break; case 3: // Fixed tableColumn.PreferredWidth = new NMultiLength(ENMultiLengthUnit.Dip, 160); headerText = "Fixed [160dips]"; break; case 4: // Percentage tableColumn.PreferredWidth = new NMultiLength(ENMultiLengthUnit.Percentage, 30); headerText = "Percentage [30%]"; break; } table.Columns.Add(tableColumn); paragraph = new NParagraph(headerText); } else { paragraph = new NParagraph("Cell"); } // by default cells contain a single paragraph NTableCell tableCell = new NTableCell(); tableCell.Border = NBorder.CreateFilledBorder(NColor.Black); tableCell.BorderThickness = new NMargins(1); tableCell.Blocks.Add(paragraph); tableRow.Cells.Add(tableCell); } } section.Blocks.Add(table); } }