public void AddTable(string tableName, params string[] headers) { var table = new Table { CellSpacing = 0, BorderThickness = new Thickness(0.5, 0.5, 0, 0), BorderBrush = Brushes.Black }; Document.Blocks.Add(table); Tables.Add(tableName, table); var lengths = ColumnLengths.ContainsKey(tableName) ? ColumnLengths[tableName] : new[] { GridLength.Auto, GridLength.Auto, new GridLength(1, GridUnitType.Star) }; for (var i = 0; i < headers.Count(); i++) { var c = new TableColumn { Width = lengths[i] }; table.Columns.Add(c); } var rows = new TableRowGroup(); table.RowGroups.Add(rows); rows.Rows.Add(CreateRow(headers, new[] { TextAlignment.Center }, true)); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.Table = ((System.Windows.Documents.Table)(target)); return; case 2: this.TBDesde = ((System.Windows.Controls.TextBox)(target)); return; case 3: this.TBPrecio = ((System.Windows.Controls.TextBox)(target)); return; case 4: #line 37 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OnAddClicked); #line default #line hidden return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.GeneralInfo = ((System.Windows.Documents.Section)(target)); return; case 2: this.OrderInfo = ((System.Windows.Documents.Section)(target)); return; case 3: this.phieuban = ((System.Windows.Controls.Label)(target)); return; case 4: this.dataTable = ((System.Windows.Documents.Table)(target)); return; case 5: this.Summary = ((System.Windows.Documents.Section)(target)); return; } this._contentLoaded = true; }
public void CreateTable(int count) { // Create the parent FlowDocument... flowDoc = new FlowDocument(); // Create the Table... table1 = new Table(); table1.BringIntoView(); // ...and add it to the FlowDocument Blocks collection. flowDoc.Blocks.Add(table1); // Set some global formatting properties for the table. table1.CellSpacing = 10; table1.Background = Brushes.White; // Create 6 columns and add them to the table's Columns collection. int numberOfColumns = 6; for (int x = 0; x < numberOfColumns; x++) { table1.Columns.Add(new TableColumn()); // Set alternating background colors for the middle colums. if (x % 2 == 0) table1.Columns[x].Background = Brushes.Beige; else table1.Columns[x].Background = Brushes.LightSteelBlue; } }
internal void ShrinkTableToLeft() { // Remove a column System.Windows.Documents.Table table = GetTableAtCaret(); if (table != null && table.Columns.Count - 1 != 0) { table.Columns.RemoveAt(table.Columns.Count - 1); // Also remove cells for each row foreach (TableRow row in table.RowGroups[0].Rows) { // Determine type of row if (row.Cells[0].ColumnSpan == table.Columns.Count + 1) { // Title row, just change span row.Cells[0].ColumnSpan = table.Columns.Count; } else { // Header or content row, just remove a cell row.Cells.RemoveAt(row.Cells.Count - 1); } } } // Otherwise don't do any thing }
internal static Table BuildTable(int rowCount, int columnCount, Brush borderBrush, Thickness borderThickness, double dLineHeight, TableType tableType) { Table table = new Table(); table.Tag = tableType; table.CellSpacing = 2; table.BorderBrush = borderBrush; table.BorderThickness = borderThickness; table.MouseEnter += new MouseEventHandler(table_MouseEnter); table.MouseLeave += new MouseEventHandler(table_MouseLeave); for (int columnIndex = 0; columnIndex < columnCount; columnIndex++) { TableColumn tableColumn = new TableColumn(); tableColumn.Width = double.IsNaN(dLineHeight) ? GridLength.Auto : new GridLength(dLineHeight); table.Columns.Add(tableColumn); } TableRowGroup rowGroup = new TableRowGroup(); for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) { TableRow row = BuildTableRow(columnCount,borderBrush,borderThickness,dLineHeight); rowGroup.Rows.Add(row); } table.RowGroups.Add(rowGroup); return table; }
public Table GetThreatTable() { var threatTable = new Table(); threatTable.CellSpacing = 0; threatTable.Columns.Add(new TableColumn()); threatTable.Columns.Add(new TableColumn()); threatTable.Columns.Add(new TableColumn()); threatTable.Columns.Add(new TableColumn()); var headerGroup = new TableRowGroup(); headerGroup.Rows.Add(new TableRow()); headerGroup.Rows[0].FontWeight = FontWeights.Bold; var headerRow = headerGroup.Rows[0]; headerRow.Cells.Add(new TableCell(new Paragraph(new Run("Skill")))); headerRow.Cells.Add(new TableCell(new Paragraph(new Run("Count")))); headerRow.Cells.Add(new TableCell(new Paragraph(new Run("Threat")))); headerRow.Cells.Add(new TableCell(new Paragraph(new Run("Threat %")))); threatTable.RowGroups.Add(headerGroup); var rowGroup = new TableRowGroup(); var totalThreat = TotalThreat; foreach (var item in ThreatRecordsBySkill.OrderByDescending(records => records.Sum(record => record.Threat))) { var row = new TableRow(); row.Cells.Add(new TableCell(new Paragraph(new Run(item.Key)))); row.Cells.Add(new TableCell(new Paragraph(new Run(item.Count().ToString())))); row.Cells.Add(new TableCell(new Paragraph(new Run(item.Sum(record => record.Threat).ToString())))); row.Cells.Add(new TableCell(new Paragraph(new Run(item.Sum(record => (double)record.Threat / totalThreat).ToString("0.##%"))))); rowGroup.Rows.Add(row); } rowGroup.Rows.Add(new TableRow()); threatTable.RowGroups.Add(rowGroup); return threatTable; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.fdcv = ((System.Windows.Controls.FlowDocumentScrollViewer)(target)); #line 11 "..\..\..\documentViewer.xaml" this.fdcv.SizeChanged += new System.Windows.SizeChangedEventHandler(this.Fdcv_SizeChanged); #line default #line hidden return; case 2: this.fdMain = ((System.Windows.Documents.FlowDocument)(target)); return; case 3: this.table = ((System.Windows.Documents.Table)(target)); return; case 4: this.row = ((System.Windows.Documents.TableRow)(target)); return; case 5: this.run = ((System.Windows.Documents.Run)(target)); return; } this._contentLoaded = true; }
internal void CancelPreviewInsertTable() { if (_previousTable != null) { flowDoc.Blocks.Remove(_previousTable); _previousTable = null; } }
private void AddTitleRow(Table table, string titleName) { table.RowGroups[0].Rows.Add(new TableRow()); var row = table.RowGroups[0].Rows[table.RowGroups[0].Rows.Count - 1]; row.Style = (Style)row.FindResource("TableHeaderStyle"); row.Cells.Add(new TableCell(new Paragraph(new Run(titleName))) {ColumnSpan = 2}); }
private void AddDescrRow(Table table, string leftCellText, string rightCellText) { table.RowGroups[0].Rows.Add(new TableRow()); var row = table.RowGroups[0].Rows[table.RowGroups[0].Rows.Count - 1]; row.Style = (Style)row.FindResource("TableTextStyle"); row.Cells.Add(new TableCell(new Paragraph(new Run(leftCellText)))); row.Cells.Add(new TableCell(new Paragraph(new Run(rightCellText)))); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.myGridPrint = ((System.Windows.Controls.Grid)(target)); return; case 2: #line 14 "..\..\WindowPrintPage.xaml" ((System.Windows.Controls.FlowDocumentScrollViewer)(target)).Loaded += new System.Windows.RoutedEventHandler(this.FlowDocument_Loaded); #line default #line hidden return; case 3: this.flowDocument = ((System.Windows.Documents.FlowDocument)(target)); return; case 4: this.datetime = ((System.Windows.Controls.TextBlock)(target)); return; case 5: this.donhangso = ((System.Windows.Controls.TextBlock)(target)); return; case 6: this.table1 = ((System.Windows.Documents.Table)(target)); return; case 7: this.tongsotien = ((System.Windows.Controls.TextBlock)(target)); return; case 8: this.khachhangtra = ((System.Windows.Controls.TextBlock)(target)); return; case 9: this.tiencondu = ((System.Windows.Controls.TextBlock)(target)); return; case 10: this.BtnPrint = ((System.Windows.Controls.Button)(target)); #line 98 "..\..\WindowPrintPage.xaml" this.BtnPrint.Click += new System.Windows.RoutedEventHandler(this.Button_Click); #line default #line hidden return; } this._contentLoaded = true; }
internal void ShrinkTableToTop() { // Remove a row System.Windows.Documents.Table table = GetTableAtCaret(); if (table != null) { table.RowGroups[0].Rows.RemoveAt(table.RowGroups[0].Rows.Count - 1); } // Otherwise don't do any thing }
internal void ExpandTableHorizontal() { // Add a column System.Windows.Documents.Table table = GetTableAtCaret(); if (table != null) { AddTableColumn(table); } // Otherwise don't do any thing }
internal void ExpandTableVertical() { // Add a row System.Windows.Documents.Table table = GetTableAtCaret(); if (table != null) { AddTableRow(table); } // Otherwise don't do any thing }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { //rtbMessages.Document.Blocks.Add(new Paragraph()); msgTable = new Table(); rtbMessages.Document.Blocks.Add(msgTable); msgTable.CellSpacing = 10; msgTable.Background = Brushes.White; msgTable.RowGroups.Add(new TableRowGroup()); TX = msgTable.RowGroups[0]; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.tableauResultats = ((System.Windows.Documents.Table)(target)); return; } this._contentLoaded = true; }
public ReporterCreator(DataBase data, ReportKind reportKind) { _reportKind = reportKind; Document = new FlowDocument { ColumnWidth = 15000 }; var mainTable = new Table { FontFamily = new FontFamily("Arial") }; BaseRows(data, ref mainTable); Document.Blocks.Add(mainTable); }
internal void RefreshTableData(FlowDocument document) { if (document.Blocks.First() is System.Windows.Documents.Table == false) { throw new InvalidOperationException("FlowDocument doesn't representat a table of data."); } // Generate a new table from document - also deduce its mode Table newTable = new Table(DataType.Table); // <Pending> Deduce its mode System.Windows.Documents.Table flowTable = document.Blocks.First() as System.Windows.Documents.Table; // Our flow document table will have a header row and then content rows // Header row TableRow headerRow = flowTable.RowGroups[0].Rows[0]; foreach (TableCell cell in headerRow.Cells) { TextRange textRange = new TextRange(cell.ContentStart, cell.ContentEnd); newTable.Headers.Add(textRange.Text); } // Content rows for (int i = 1; i < flowTable.RowGroups[0].Rows.Count; i++) { TableRow contentRow = flowTable.RowGroups[0].Rows[i]; string[] values = contentRow.Cells.Select(item => new TextRange(item.ContentStart, item.ContentEnd).Text).ToArray(); newTable.AddNewRow(values); } // Deduce its mode bool bContainsRepeat = newTable.Rows.Count - newTable.Rows.Select(row => row[0]).Distinct().Count() > 0; if (bContainsRepeat) { newTable.Type = DataType.Table; } else { if (newTable.Headers.Count > 2) { newTable.Type = DataType.Value; } else { newTable.Type = DataType.Dictionary; } } // Assign Data = newTable; bDirty = true; SaveDocument(); // Update bookkeeping DistributedClonesForCurrentFlowDocument.Clear(); }
private static IEnumerable<string> ReadTable(Table table) { var result = new List<string> { " " }; var colLenghts = new int[table.Columns.Count]; var colAlignments = new TextAlignment[table.Columns.Count]; foreach (var row in table.RowGroups[0].Rows) { for (var i = 0; i < row.Cells.Count; i++) { if (row == table.RowGroups[0].Rows[1]) colAlignments[i] = (row.Cells[i].Blocks.First()).TextAlignment; var value = string.Join(" ", ReadBlocks(row.Cells[i].Blocks)); if (value.Length > colLenghts[i] && row.Cells[0].ColumnSpan == 1) colLenghts[i] = value.Length; } } foreach (var row in table.RowGroups[0].Rows) { if (row == table.RowGroups[0].Rows[0]) result.Add("<EB>"); var rowValue = ""; for (var i = 0; i < row.Cells.Count; i++) { var values = ReadBlocks(row.Cells[i].Blocks); if (i == row.Cells.Count - 1 && row != table.RowGroups[0].Rows[0]) rowValue += " | " + string.Join(" ", values); else { var value = string.Join(" ", values); if (i < row.Cells.Count) { value = colAlignments[i] == TextAlignment.Right ? value.PadLeft(colLenghts[i] + 1) : value.PadRight(colLenghts[i] + 1); } rowValue += value; } } if (row == table.RowGroups[0].Rows[0]) { result.Add("<C00>" + rowValue); result.Add("<DB>"); } else result.Add("<J00>" + rowValue); } return result; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.flowDoc = ((System.Windows.Controls.FlowDocumentScrollViewer)(target)); return; case 2: this.table1 = ((System.Windows.Documents.Table)(target)); return; case 3: this.seq1TextBox = ((System.Windows.Controls.TextBox)(target)); return; case 4: this.seq2TextBox = ((System.Windows.Controls.TextBox)(target)); return; case 5: this.startButton = ((System.Windows.Controls.Button)(target)); #line 50 "..\..\MainWindow.xaml" this.startButton.Click += new System.Windows.RoutedEventHandler(this.startButton_Click); #line default #line hidden return; case 6: this.globalAlignmentRB = ((System.Windows.Controls.RadioButton)(target)); return; case 7: this.localAlignmentRB = ((System.Windows.Controls.RadioButton)(target)); return; case 8: this.topAlignmentLable = ((System.Windows.Controls.Label)(target)); return; case 9: this.pairwiseBarsLable = ((System.Windows.Controls.Label)(target)); return; case 10: this.leftAlignmentLable = ((System.Windows.Controls.Label)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.filter_combo = ((System.Windows.Controls.ComboBox)(target)); return; case 2: this.search_text = ((System.Windows.Controls.TextBox)(target)); #line 38 "..\..\..\ItemsControl.xaml" this.search_text.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.search_event); #line default #line hidden return; case 3: this.itemsDoc = ((System.Windows.Documents.FlowDocument)(target)); return; case 4: this.itemsTable = ((System.Windows.Documents.Table)(target)); return; case 5: this.navigation_grid = ((System.Windows.Controls.Grid)(target)); return; case 6: #line 90 "..\..\..\ItemsControl.xaml" ((System.Windows.Controls.Image)(target)).PreviewMouseDown += new System.Windows.Input.MouseButtonEventHandler(this.previous_event); #line default #line hidden return; case 7: #line 91 "..\..\..\ItemsControl.xaml" ((System.Windows.Controls.Image)(target)).PreviewMouseDown += new System.Windows.Input.MouseButtonEventHandler(this.next_event); #line default #line hidden return; } this._contentLoaded = true; }
private void FillTableWithEmptyCells(Table t) { foreach(TableRowGroup trg in t.RowGroups) { foreach(TableRow tr in trg.Rows) { int addcells = maxc - tr.Cells.Count ; for (int i = 0; i < addcells;i++ ) { tr.Cells.Add(new TableCell()); } } } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.MyGrid = ((System.Windows.Controls.Grid)(target)); return; case 2: this.ULSTable = ((System.Windows.Documents.Table)(target)); return; } this._contentLoaded = true; }
public void InsertTable(int x, int y, bool bTitle = true, bool bHeader = true) // X for num of columns, Y for num of rows (excluding title and header row, which is created by default) { // Create a table System.Windows.Documents.Table newTable = CreateTable(x, y, bTitle, bHeader); // Insert Paragraph paragraph = GetFirstLevelParagraphAtCaret(); if (paragraph != null) // Can be null if we are just inserting a table withoout any other content { DocumentText.Document.Blocks.InsertAfter(paragraph, newTable); } else { DocumentText.Document.Blocks.Add(newTable); } }
// Build a table with a given number of rows and columns internal static Table UpdateTable(Table table, int rowCount, int columnCount, Brush borderBrush, Thickness borderThickness, double dLineHeight, TableType tableType) { table.Tag = tableType; table.CellSpacing = 2; table.BorderBrush = borderBrush; table.BorderThickness = borderThickness; table.MouseEnter += new MouseEventHandler(table_MouseEnter); table.MouseLeave += new MouseEventHandler(table_MouseLeave); if (0 >= table.Columns.Count) { for (int columnIndex = 0; columnIndex < columnCount; columnIndex++) { TableColumn tableColumn = new TableColumn(); tableColumn.Width = double.IsNaN(dLineHeight) ? GridLength.Auto : new GridLength(dLineHeight); table.Columns.Add(tableColumn); } } else { foreach (TableColumn tableColumn in table.Columns) { tableColumn.Width = double.IsNaN(dLineHeight) ? GridLength.Auto : new GridLength(dLineHeight); } } foreach(TableRowGroup rowGroup in table.RowGroups) { foreach (TableRow row in rowGroup.Rows) { foreach (TableCell cell in row.Cells) { cell.BorderBrush = borderBrush; cell.BorderThickness = borderThickness; } } } return table; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.WorkerShown = ((System.Windows.Controls.ComboBox)(target)); #line 11 "..\..\TableauResNumTravailleurs.xaml" this.WorkerShown.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.WorkerShown_SelectionChanged); #line default #line hidden return; case 2: this.tableauResultats = ((System.Windows.Documents.Table)(target)); return; } this._contentLoaded = true; }
// With style public static void AddTableRow(System.Windows.Documents.Table table, List <List <string> > rows) { TableRow currentRow; foreach (List <string> row in rows) { table.RowGroups[0].Rows.Add(new TableRow()); currentRow = table.RowGroups[0].Rows[table.RowGroups[0].Rows.Count - 1]; // Global formatting for the row. FormatContentRow(currentRow); foreach (string content in row) { currentRow.Cells.Add(new TableCell(new Paragraph(new Run(content)))); } // Global formatting for first row cell if (currentRow.Cells.Count > 0) { FormatCell(currentRow.Cells[0]); } } }
internal static System.Windows.Documents.Table CreateTable(MULTITUDE.Class.DocumentTypes.Table table) { System.Windows.Documents.Table newTable = new System.Windows.Documents.Table(); #region Column Definitions // Generate columns int numberOfColumns = table.Headers.Count; for (int i = 0; i < numberOfColumns; i++) { AddTableColumn(newTable); } #endregion // Generate Rows // Create and add an empty TableRowGroup to hold the table's Rows. newTable.RowGroups.Add(new TableRowGroup()); TableRow currentRow; // Alias the current working row for easy reference. #region Header Row Definition // Add the header row if (table.Headers.Count > 0) { newTable.RowGroups[0].Rows.Add(new TableRow()); currentRow = newTable.RowGroups[0].Rows[newTable.RowGroups[0].Rows.Count - 1]; // Global formatting for the header row. FormatHeaderRow(currentRow); foreach (string header in table.Headers) { currentRow.Cells.Add(new TableCell(new Paragraph(new Run(header)))); } #endregion } #region Content Rows Definition // Add content rows AddTableRow(newTable, table.Rows); #endregion return(newTable); }
// With style public static void AddTableRow(System.Windows.Documents.Table table) { TableRow currentRow; table.RowGroups[0].Rows.Add(new TableRow()); currentRow = table.RowGroups[0].Rows[table.RowGroups[0].Rows.Count - 1]; // Global formatting for the row. FormatContentRow(currentRow); // Add cells with content to this row for (int j = 0; j < table.Columns.Count; j++) { currentRow.Cells.Add(new TableCell(new Paragraph(new Run(TableContentRowDefaultText)))); } // Global formatting for first row cell if (currentRow.Cells.Count > 0) { FormatCell(currentRow.Cells[0]); } }
// With style public static void AddTableColumn(System.Windows.Documents.Table table) { table.Columns.Add(new TableColumn()); // Set alternating background colors for the middle colums. if ((table.Columns.Count - 1) % 2 == 0) { table.Columns[table.Columns.Count - 1].Background = TableColumnsBackground1; } else { table.Columns[table.Columns.Count - 1].Background = TableColumnsBackground2; } // Add cells to existing rows if (table.RowGroups.Count != 0) { foreach (TableRow row in table.RowGroups[0].Rows) { // Determine type of row if (row.Cells[0].ColumnSpan == table.Columns.Count - 1) { // Title row, just expand span row.Cells[0].ColumnSpan = table.Columns.Count; } else if (row.FontSize == TableHeaderRowFontSize) { // Header row, add header row cell row.Cells.Add(new TableCell(new Paragraph(new Run(TableHeaderRowDefaultText)))); } else { // Add content Row Cell row.Cells.Add(new TableCell(new Paragraph(new Run(TableContentRowDefaultText)))); } } } }
public Action AddToFlowDocument(IResumeDataObject rdo, IResumeFormatObject rfo, Win.FlowDocument flowDoc) { return(() => { var table = new Win.Table(); table.RowGroups.Add(new Win.TableRowGroup()); var rg = table.RowGroups[0]; rg.Rows.Add(new Win.TableRow()); rg.Rows.Add(new Win.TableRow()); Win.TableCell add1Cell = new Win.TableCell(new Win.Paragraph(new Win.Run(rdo.AddressLine1))); Win.TableCell add2Cell = new Win.TableCell(new Win.Paragraph(new Win.Run(rdo.AddressLine2))); Win.TableCell phoneCell = new Win.TableCell(new Win.Paragraph(new Win.Run(rdo.Email))); Win.TableCell emailCell = new Win.TableCell(new Win.Paragraph(new Win.Run(rdo.PhoneNumber))); rg.Rows[0].Cells.Add(add1Cell); rg.Rows[1].Cells.Add(add2Cell); rg.Rows[0].Cells.Add(emailCell); rg.Rows[1].Cells.Add(phoneCell); add1Cell.TextAlignment = TextAlignment.Left; add2Cell.TextAlignment = TextAlignment.Left; phoneCell.TextAlignment = TextAlignment.Right; emailCell.TextAlignment = TextAlignment.Right; foreach (var row in rg.Rows) { foreach (var cell in row.Cells) { cell.FontFamily = new FontFamily(rfo.BodyFontName); cell.FontSize = rfo.BodyFontSizeWindows; } } flowDoc.Blocks.Add(table); }); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 14 "..\..\History.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.MainMenu_Click); #line default #line hidden return; case 2: this.Playername = ((System.Windows.Controls.TextBox)(target)); return; case 3: this.ButtonHistory = ((System.Windows.Controls.Button)(target)); #line 19 "..\..\History.xaml" this.ButtonHistory.Click += new System.Windows.RoutedEventHandler(this.ButtonHistory_Click); #line default #line hidden return; case 4: this.Table = ((System.Windows.Documents.Table)(target)); return; case 5: this.gameshistory = ((System.Windows.Documents.TableRowGroup)(target)); return; } this._contentLoaded = true; }
private void AddSmallContainers(Table tab, List<Container> tempList, int i, int i2) { //печатаем заголовок var i3 = 1; tab.RowGroups[0].Rows.Add(new TableRow()); var currentRow = tab.RowGroups[0].Rows[i2 + i3]; currentRow.Background = Brushes.White; currentRow.FontSize = 18; currentRow.FontWeight = FontWeights.Normal; currentRow.Cells.Add(new TableCell(new Paragraph(new Run("Шаг " + i + ": Загрузите следующие контейнеры:")))); currentRow.Cells[0].ColumnSpan = 2; foreach (var c in tempList) { i3++; tab.RowGroups[0].Rows.Add(new TableRow()); currentRow = tab.RowGroups[0].Rows[i2 + i3]; currentRow.Background = Brushes.White; currentRow.FontSize = 14; currentRow.FontWeight = FontWeights.Normal; currentRow.Cells.Add( new TableCell(new Paragraph(new Run(c.Name + ": " + c.Vgh + "; " + c.Mass + " кг.")))); currentRow.Cells[0].ColumnSpan = 2; } }
public static Table FormatFragmentsList(IEnumerable<Fragment> fragments) { var thetable = new Table(); var tableRowGroup = new TableRowGroup(); var headerRow = new TableRow { Background = new SolidColorBrush(Colors.LightGray) }; headerRow.Cells.Add(new TableCell(new Paragraph(new Run("Déplacement"))) { BorderBrush = new SolidColorBrush(Colors.Gray) }); headerRow.Cells.Add(new TableCell(new Paragraph(new Run("Taille"))) { BorderBrush = new SolidColorBrush(Colors.Gray) }); headerRow.Cells.Add(new TableCell(new Paragraph(new Run("Bit More Fragments"))) { BorderBrush = new SolidColorBrush(Colors.Gray) }); tableRowGroup.Rows.Add(headerRow); foreach (var fragment in fragments) { var row = new TableRow(); row.Cells.Add(new TableCell(new Paragraph(new Run(fragment.Offset.ToString()))) { BorderBrush = new SolidColorBrush(Colors.Gray), BorderThickness = new Thickness(0, 0, 0, 0.2) }); row.Cells.Add(new TableCell(new Paragraph(new Run(fragment.Length.ToString()))) { BorderBrush = new SolidColorBrush(Colors.Gray), BorderThickness = new Thickness(0, 0, 0, 0.2) }); row.Cells.Add(new TableCell(new Paragraph(new Run(fragment.MoreFragments.ToString()))) { BorderBrush = new SolidColorBrush(Colors.Gray), BorderThickness = new Thickness(0, 0, 0, 0.2) }); tableRowGroup.Rows.Add(row); } thetable.RowGroups.Add(tableRowGroup); return thetable; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 10 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Grid)(target)).MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.Border_MouseLeftButtonDown); #line default #line hidden return; case 2: this.CloseButton = ((System.Windows.Controls.Button)(target)); #line 16 "..\..\..\MainWindow.xaml" this.CloseButton.PreviewMouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(this.Button_PreviewMouseLeftButtonUp); #line default #line hidden return; case 3: this.DrawCanvas = ((System.Windows.Controls.Canvas)(target)); #line 20 "..\..\..\MainWindow.xaml" this.DrawCanvas.Initialized += new System.EventHandler(this.DrawCanvas_OnInitialized); #line default #line hidden #line 20 "..\..\..\MainWindow.xaml" this.DrawCanvas.PreviewMouseDown += new System.Windows.Input.MouseButtonEventHandler(this.DrawCanvas_OnPreviewMouseDown); #line default #line hidden #line 20 "..\..\..\MainWindow.xaml" this.DrawCanvas.PreviewMouseMove += new System.Windows.Input.MouseEventHandler(this.DrawCanvas_OnPreviewMouseMove); #line default #line hidden #line 20 "..\..\..\MainWindow.xaml" this.DrawCanvas.MouseUp += new System.Windows.Input.MouseButtonEventHandler(this.DrawCanvas_OnPreviewMouseUp); #line default #line hidden return; case 4: this.LineMethodRadioButton = ((System.Windows.Controls.RadioButton)(target)); #line 26 "..\..\..\MainWindow.xaml" this.LineMethodRadioButton.Checked += new System.Windows.RoutedEventHandler(this.LineMethodRadioButton_OnChecked); #line default #line hidden return; case 5: this.RecursiveMethodRadioButton = ((System.Windows.Controls.RadioButton)(target)); #line 27 "..\..\..\MainWindow.xaml" this.RecursiveMethodRadioButton.Checked += new System.Windows.RoutedEventHandler(this.RecursiveMethodRadioButton_OnChecked); #line default #line hidden return; case 6: this.ClearCanvasButton = ((System.Windows.Controls.Button)(target)); #line 28 "..\..\..\MainWindow.xaml" this.ClearCanvasButton.PreviewMouseUp += new System.Windows.Input.MouseButtonEventHandler(this.ClearCanvasButton_OnPreviewMouseDown); #line default #line hidden return; case 7: this.CalculateButton = ((System.Windows.Controls.Button)(target)); #line 29 "..\..\..\MainWindow.xaml" this.CalculateButton.PreviewMouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.CalculateButton_PreviewMouseLeftButtonDown); #line default #line hidden return; case 8: this.DataTable = ((System.Windows.Documents.Table)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 19 "..\..\MainWindow.xaml" ((SolarSolution.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Loaded_Windows); #line default #line hidden return; case 2: #line 29 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ContactBtn); #line default #line hidden return; case 3: #line 30 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.marshousebtn); #line default #line hidden return; case 4: #line 31 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.databtn); #line default #line hidden return; case 5: #line 32 "..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ExistBtn); #line default #line hidden return; case 6: this.TabControlGeneral = ((System.Windows.Controls.TabControl)(target)); #line 37 "..\..\MainWindow.xaml" this.TabControlGeneral.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.TabSelectionChanged); #line default #line hidden return; case 7: this.tab1 = ((System.Windows.Controls.TabItem)(target)); return; case 8: #line 111 "..\..\MainWindow.xaml" ((System.Windows.Controls.RadioButton)(target)).Checked += new System.Windows.RoutedEventHandler(this.RadioButton_Checked); #line default #line hidden return; case 9: #line 112 "..\..\MainWindow.xaml" ((System.Windows.Controls.RadioButton)(target)).Checked += new System.Windows.RoutedEventHandler(this.RadioButton_Checked); #line default #line hidden return; case 10: #line 113 "..\..\MainWindow.xaml" ((System.Windows.Controls.RadioButton)(target)).Checked += new System.Windows.RoutedEventHandler(this.RadioButton_Checked); #line default #line hidden return; case 11: this.RankTable = ((System.Windows.Documents.Table)(target)); return; case 12: this.TenKhachHangtxt = ((System.Windows.Controls.TextBox)(target)); return; case 13: this.DiaChiTxt = ((System.Windows.Controls.TextBox)(target)); return; case 14: this.tab2 = ((System.Windows.Controls.TabItem)(target)); return; case 15: this.VNDtxt1 = ((System.Windows.Controls.TextBlock)(target)); return; case 16: this.thapdiemtxt = ((System.Windows.Controls.TextBox)(target)); return; case 17: this.VNDtxt2 = ((System.Windows.Controls.TextBlock)(target)); return; case 18: this.trungbinhtxt = ((System.Windows.Controls.TextBox)(target)); return; case 19: this.VNDtxt3 = ((System.Windows.Controls.TextBlock)(target)); return; case 20: this.caodiemtxt = ((System.Windows.Controls.TextBox)(target)); return; case 21: this.thapdiemlb = ((System.Windows.Controls.TextBlock)(target)); return; case 22: this.trungbinhlb = ((System.Windows.Controls.TextBlock)(target)); return; case 23: this.Caodiemlb = ((System.Windows.Controls.TextBlock)(target)); return; case 24: this.tab3 = ((System.Windows.Controls.TabItem)(target)); return; case 25: this.SoKWpLapDatTextBox = ((System.Windows.Controls.TextBox)(target)); return; case 26: this.kinhphitxt = ((System.Windows.Controls.TextBox)(target)); return; case 27: this.khuvucComboBox = ((System.Windows.Controls.ComboBox)(target)); #line 200 "..\..\MainWindow.xaml" this.khuvucComboBox.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.khuvuctxtbox_Changed); #line default #line hidden return; case 28: this.SogioNangTxt = ((System.Windows.Controls.TextBlock)(target)); return; case 29: this.tab4 = ((System.Windows.Controls.TabItem)(target)); return; case 30: this.giabantxt = ((System.Windows.Controls.TextBox)(target)); return; case 31: this.tanggiatxt = ((System.Windows.Controls.TextBox)(target)); return; case 32: this.suygiamcongsuat1txt = ((System.Windows.Controls.TextBox)(target)); return; case 33: this.suygiamcongsuattxt = ((System.Windows.Controls.TextBox)(target)); return; case 34: this.tuoithotxt = ((System.Windows.Controls.TextBox)(target)); return; case 35: this.tab5 = ((System.Windows.Controls.TabItem)(target)); return; case 36: this.XemBaoCaoBtn = ((System.Windows.Controls.Button)(target)); #line 501 "..\..\MainWindow.xaml" this.XemBaoCaoBtn.Click += new System.Windows.RoutedEventHandler(this.XemBaoCaoBtn_Click); #line default #line hidden return; case 37: this.PreviousBtn = ((System.Windows.Controls.Button)(target)); #line 524 "..\..\MainWindow.xaml" this.PreviousBtn.Click += new System.Windows.RoutedEventHandler(this.PreviousBtn_clicked); #line default #line hidden return; case 38: this.NextBtn = ((System.Windows.Controls.Button)(target)); #line 531 "..\..\MainWindow.xaml" this.NextBtn.Click += new System.Windows.RoutedEventHandler(this.NextBtn_clicked); #line default #line hidden return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 23 "..\..\..\MainWindow.xaml" ((GUI.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden return; case 2: this.Connect = ((System.Windows.Controls.TabItem)(target)); #line 46 "..\..\..\MainWindow.xaml" this.Connect.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.connectTabClick); #line default #line hidden return; case 3: #line 48 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Label)(target)).MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.connectTabClick); #line default #line hidden return; case 4: this.Client_Machine_Addr = ((System.Windows.Controls.TextBox)(target)); return; case 5: this.Client_Port_Addr = ((System.Windows.Controls.TextBox)(target)); return; case 6: this.Server_Machine_Addr = ((System.Windows.Controls.TextBox)(target)); return; case 7: this.Server_Port_Addr = ((System.Windows.Controls.TextBox)(target)); return; case 8: #line 68 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.connect); #line default #line hidden return; case 9: this.Comm_Messages = ((System.Windows.Controls.TextBox)(target)); return; case 10: this.browse = ((System.Windows.Controls.TabItem)(target)); return; case 11: #line 79 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Label)(target)).MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.browseTabClick); #line default #line hidden return; case 12: this.clientback = ((System.Windows.Controls.Button)(target)); #line 90 "..\..\..\MainWindow.xaml" this.clientback.Click += new System.Windows.RoutedEventHandler(this.clientbackButton_Click); #line default #line hidden return; case 13: this.serverback = ((System.Windows.Controls.Button)(target)); #line 92 "..\..\..\MainWindow.xaml" this.serverback.Click += new System.Windows.RoutedEventHandler(this.serverbackButton_Click); #line default #line hidden return; case 14: this.clientLB = ((System.Windows.Controls.ListBox)(target)); #line 99 "..\..\..\MainWindow.xaml" this.clientLB.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.ClientfilesLB_MouseDoubleClick); #line default #line hidden return; case 15: this.serverLB = ((System.Windows.Controls.ListBox)(target)); #line 100 "..\..\..\MainWindow.xaml" this.serverLB.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.ServerfilesLB_MouseDoubleClick); #line default #line hidden return; case 16: this.sendBrowseMsg = ((System.Windows.Controls.Button)(target)); #line 103 "..\..\..\MainWindow.xaml" this.sendBrowseMsg.Click += new System.Windows.RoutedEventHandler(this.sendBrowseMsg_Click); #line default #line hidden return; case 17: this.checkin = ((System.Windows.Controls.TabItem)(target)); return; case 18: #line 110 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Label)(target)).MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.checkinTabClick); #line default #line hidden return; case 19: #line 117 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.ComboBox)(target)).Loaded += new System.Windows.RoutedEventHandler(this.ComboBox_Loaded); #line default #line hidden #line 117 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.ComboBox)(target)).SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.ComboBox_SelectionChanged); #line default #line hidden return; case 20: this.selectedCkInFiles = ((System.Windows.Controls.TextBox)(target)); return; case 21: this.dstnpath = ((System.Windows.Controls.TextBox)(target)); return; case 22: this.selected_dir = ((System.Windows.Controls.ListBox)(target)); #line 126 "..\..\..\MainWindow.xaml" this.selected_dir.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.dstn_SelectionChanged); #line default #line hidden return; case 23: this.checkin_childNames = ((System.Windows.Controls.ListBox)(target)); return; case 25: this.descr = ((System.Windows.Controls.TextBox)(target)); return; case 26: this.child = ((System.Windows.Controls.TextBox)(target)); return; case 27: this.ChkInButton = ((System.Windows.Controls.Button)(target)); #line 145 "..\..\..\MainWindow.xaml" this.ChkInButton.Click += new System.Windows.RoutedEventHandler(this.ChkInButton_Click); #line default #line hidden return; case 28: this.checkinBox = ((System.Windows.Controls.CheckBox)(target)); return; case 29: this.checkout = ((System.Windows.Controls.TabItem)(target)); return; case 30: #line 155 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Label)(target)).MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.checkoutTabClick); #line default #line hidden return; case 31: this.back = ((System.Windows.Controls.Button)(target)); #line 160 "..\..\..\MainWindow.xaml" this.back.Click += new System.Windows.RoutedEventHandler(this.backButton_Click); #line default #line hidden return; case 32: this.dependent = ((System.Windows.Controls.Button)(target)); #line 162 "..\..\..\MainWindow.xaml" this.dependent.Click += new System.Windows.RoutedEventHandler(this.dependentButton_Click); #line default #line hidden return; case 33: this.fileslist = ((System.Windows.Controls.ListBox)(target)); #line 169 "..\..\..\MainWindow.xaml" this.fileslist.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.fileslist_SelectionChanged); #line default #line hidden #line 169 "..\..\..\MainWindow.xaml" this.fileslist.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.ChkOutFilesListBox_MouseDoubleClick); #line default #line hidden return; case 34: this.depenlist = ((System.Windows.Controls.ListBox)(target)); return; case 35: this.ChkOutButton = ((System.Windows.Controls.Button)(target)); #line 173 "..\..\..\MainWindow.xaml" this.ChkOutButton.Click += new System.Windows.RoutedEventHandler(this.ChkOutButton_Click); #line default #line hidden return; case 36: this.ChkOutDesc = ((System.Windows.Controls.CheckBox)(target)); return; case 37: this.viewfile = ((System.Windows.Controls.TabItem)(target)); return; case 38: #line 183 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Label)(target)).MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.viewfileTabClick); #line default #line hidden return; case 39: this.foldInRepo = ((System.Windows.Controls.ListBox)(target)); #line 193 "..\..\..\MainWindow.xaml" this.foldInRepo.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.fold_MouseDoubleClick); #line default #line hidden return; case 40: this.filesInRepo = ((System.Windows.Controls.ListBox)(target)); #line 198 "..\..\..\MainWindow.xaml" this.filesInRepo.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.files_MouseDoubleClick); #line default #line hidden return; case 41: this.viewmetadata = ((System.Windows.Controls.TabItem)(target)); return; case 42: #line 206 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.Label)(target)).MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.viewMetadataTabClick); #line default #line hidden return; case 43: this.metadataTB = ((System.Windows.Documents.Table)(target)); return; case 44: this.viewMData = ((System.Windows.Controls.Button)(target)); #line 262 "..\..\..\MainWindow.xaml" this.viewMData.Click += new System.Windows.RoutedEventHandler(this.MDataButton_Click); #line default #line hidden return; case 45: this.status = ((System.Windows.Controls.Primitives.StatusBarItem)(target)); return; case 46: this.statusLabel = ((System.Windows.Controls.TextBlock)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.hometxt = ((System.Windows.Controls.TextBlock)(target)); #line 13 "..\..\UC0104-SS03.xaml" this.hometxt.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.gotoHome); #line default #line hidden return; case 2: this.txt = ((System.Windows.Controls.TextBlock)(target)); return; case 3: this.typetxt = ((System.Windows.Controls.TextBlock)(target)); #line 15 "..\..\UC0104-SS03.xaml" this.typetxt.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.gotoType); #line default #line hidden return; case 4: this.txt1 = ((System.Windows.Controls.TextBlock)(target)); return; case 5: this.tabletxt = ((System.Windows.Controls.TextBlock)(target)); return; case 6: this.homeim = ((System.Windows.Controls.Image)(target)); #line 19 "..\..\UC0104-SS03.xaml" this.homeim.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.gotoHome); #line default #line hidden return; case 7: this.logouttxt = ((System.Windows.Controls.TextBlock)(target)); return; case 8: this.logoutim = ((System.Windows.Controls.Image)(target)); return; case 9: this.table = ((System.Windows.Documents.Table)(target)); return; case 10: this.tablerowgroup = ((System.Windows.Documents.TableRowGroup)(target)); return; case 11: this.UC0104_3 = ((System.Windows.Controls.Frame)(target)); return; } this._contentLoaded = true; }
internal object BuildObjectTree() { IAddChild root; switch (_type) { case ElementType.Table: root = new Table(); break; case ElementType.TableRowGroup: root = new TableRowGroup(); break; case ElementType.TableRow: root = new TableRow(); break; case ElementType.TableCell: root = new TableCell(); break; case ElementType.Paragraph: root = new Paragraph(); break; case ElementType.Hyperlink: Hyperlink link = new Hyperlink(); link.NavigateUri = GetValue(NavigateUriProperty) as Uri; link.RequestNavigate += new RequestNavigateEventHandler(ClickHyperlink); AutomationProperties.SetHelpText(link, (String)this.GetValue(HelpTextProperty)); AutomationProperties.SetName(link, (String)this.GetValue(NameProperty)); root = link; break; default: Debug.Assert(false); root = null; break; } ITextPointer pos = ((ITextPointer)_start).CreatePointer(); while (pos.CompareTo((ITextPointer)_end) < 0) { TextPointerContext tpc = pos.GetPointerContext(LogicalDirection.Forward); if (tpc == TextPointerContext.Text) { root.AddText(pos.GetTextInRun(LogicalDirection.Forward)); } else if (tpc == TextPointerContext.EmbeddedElement) { root.AddChild(pos.GetAdjacentElement(LogicalDirection.Forward)); } else if (tpc == TextPointerContext.ElementStart) { object obj = pos.GetAdjacentElement(LogicalDirection.Forward); if (obj != null) { root.AddChild(obj); pos.MoveToNextContextPosition(LogicalDirection.Forward); pos.MoveToElementEdge(ElementEdge.BeforeEnd); } } pos.MoveToNextContextPosition(LogicalDirection.Forward); } return root; }
private void DrawTab() { ImageBrush One = new ImageBrush { ImageSource = new BitmapImage( new Uri(@"pack://*****:*****@"pack://application:,,,/Images/ChordBG.png", UriKind.RelativeOrAbsolute) ) }; tbl.CellSpacing = 2; tbl.Margin = new Thickness(0, 10, 0, 0); // tbl.Background = new Brush("Images/ChordBG.png"); for (int x = 0; x < 7; x++) { tbl.Columns.Add(new TableColumn()); tbl.Columns[tbl.Columns.Count - 1].Width = new GridLength(23); } tbl.Columns[0].Width = new GridLength(18); // Create and add an empty TableRowGroup to hold the table's Rows. tbl.RowGroups.Add(new TableRowGroup()); // Add the first (title) row. for (int i = 0; i < 7; i++) { TableRow currentRow = new TableRow(); tbl.RowGroups[0].Rows.Add(currentRow); for (int j = 0; j < 7; j++) { TableCell cell = new TableCell(); currentRow.Cells.Add(cell); cell.BorderThickness = new Thickness(0); cell.Padding = new Thickness(0, 0, 0, 0); } } // Fill table with fingering values string[] vals = Fingering.Split('/'); string b = vals.Where(a => !a.Contains("-1") && a.Split(',')[0] != "0").Last(); int MinFrett = Convert.ToInt32(b.Split(',')[0]); // Showing the starting Frett Paragraph paragraph2 = new Paragraph(); paragraph2.Inlines.Add(new Run(MinFrett.ToString())); tbl.RowGroups[0].Rows[1].Cells[0].Blocks.Add(paragraph2); // Showing finger positions foreach (string val in vals) { string[] points = val.Split(','); if (points.Length == 2) { int ColumnIndex = Math.Abs(Convert.ToInt32(points[1]) - 6); if (points[0] == "-1") { Paragraph paragraph = new Paragraph(); paragraph.Inlines.Add(new Run("X")); tbl.RowGroups[0].Rows[0].Cells[ColumnIndex].Blocks.Add(paragraph); } else { Paragraph paragraph = new Paragraph(); paragraph.Inlines.Add(new Run("O")); tbl.RowGroups[0].Rows[0].Cells[ColumnIndex].Blocks.Add(paragraph); } } else { int RowIndex = Convert.ToInt32(points[0]) - MinFrett + 1; int ColumnIndex = Math.Abs(Convert.ToInt32(points[1]) - 6); Paragraph paragraph = new Paragraph(); paragraph.Inlines.Add(new Run(points[2])); tbl.RowGroups[0].Rows[RowIndex].Cells[ColumnIndex].Blocks.Add(paragraph); } } fig.Blocks.Add(tbl); Paragraph MainParag = new Paragraph(fig); doc1.Blocks.Add(MainParag); } }
private void AddRow(Table tab, RowBlock rowBlock, Vehicle currentVehicle, int i, int i2) { //MessageBox.Show("Количество вертикальных блоков " + rowBlock.Blocks.Count.ToString()); var b = new BlockUIContainer(); var canvas = new Canvas(); canvas.Width = currentVehicle.Width / scale; canvas.Height = currentVehicle.Height / scale + 20; //Рисуем рамку вокруг canvas var r = new Rectangle(); r.Width = currentVehicle.Width / scale; r.Height = currentVehicle.Height / scale; Brush brush = new SolidColorBrush(); brush = Brushes.White; r.Stroke = new SolidColorBrush(Colors.Red); r.Fill = brush; Canvas.SetLeft(r, 0); Canvas.SetTop(r, 20); canvas.Children.Add(r); //пишем заголовок tab.RowGroups[0].Rows.Add(new TableRow()); var currentRow = tab.RowGroups[0].Rows[i2 - 1]; currentRow.Background = Brushes.White; currentRow.FontSize = 18; currentRow.FontWeight = FontWeights.Normal; currentRow.Cells.Add( new TableCell( new Paragraph( new Run("Шаг " + i + ": " + rowBlock.Name + "контейнеров: " + rowBlock.Count + ", вес: " + rowBlock.Mass + ", плотность: " + rowBlock.Fullness + "(" + rowBlock.FullnessWidth + ")")))); currentRow.Cells[0].ColumnSpan = 2; //пишем схему ряда var t2 = new TextBlock(); t2.FontSize = 14; var t = new TextBlock(); //рисуем контейнеры foreach (var v in rowBlock.Blocks) { //MessageBox.Show("Количество ящиков в вертикальном блоке " + v.Blocks.Count.ToString()); foreach (Object p in v.Blocks) { var c = (Container)p; r = new Rectangle(); r.Width = c.Length / scale; r.Height = c.Height / scale; brush = new SolidColorBrush(); brush = Brushes.White; r.Stroke = new SolidColorBrush(Colors.Black); r.Fill = brush; Canvas.SetLeft(r, (c.FirstPoint.Y - currentVehicle.FirstPoint.Y) / scale); Canvas.SetTop(r, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale); canvas.Children.Add(r); t = new TextBlock(); t.Text = c.Name; if (c.Kind == "VerticalPallet") { t.FontSize = 14; } else { t.FontSize = 20; } Canvas.SetLeft(t, (c.FirstPoint.Y - currentVehicle.FirstPoint.Y) / scale + 2); var delta = 2; Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + 2); canvas.Children.Add(t); t = new TextBlock(); t.Text = "Габ: " + c.Vgh; t.FontSize = 14; Canvas.SetLeft(t, (c.FirstPoint.Y - currentVehicle.FirstPoint.Y) / scale + 2); delta = delta + 22; Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + delta); canvas.Children.Add(t); t = new TextBlock(); t.Text = "Вес:" + c.Mass; t.FontSize = 14; Canvas.SetLeft(t, (c.FirstPoint.Y - currentVehicle.FirstPoint.Y) / scale + 2); delta = delta + 22; Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + delta); canvas.Children.Add(t); if (p is VerticalBlock) { t2.Text = t2.Text + "\n" + c.Name + "\n"; t2.Text = t2.Text + " Габариты:" + c.Vgh + "\n"; t2.Text = t2.Text + " Вес:" + c.Mass + "\n"; var vB = (VerticalBlock)p; foreach (var cont in vB.Blocks) { t2.Text = t2.Text + " * " + cont.Name + " (" + cont.ContainerType + ")" + " \n"; t = new TextBlock(); t.Text = cont.Name; t.FontSize = 16; Canvas.SetLeft(t, (c.FirstPoint.Y - currentVehicle.FirstPoint.Y) / scale + 2); delta = delta + 22; Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + delta); canvas.Children.Add(t); } } else if (p is HorizontalBlock) { t2.Text = t2.Text + "\n" + c.Name + " \n"; t2.Text = t2.Text + " Габариты:" + c.Vgh + "\n"; t2.Text = t2.Text + " Вес:" + c.Mass + "\n"; var vB = (HorizontalBlock)p; foreach (var cont in vB.Blocks) { t2.Text = t2.Text + " * " + cont.Name + " (" + cont.ContainerType + ")" + " \n"; t = new TextBlock(); t.Text = cont.Name; t.FontSize = 16; Canvas.SetLeft(t, (c.FirstPoint.Y - currentVehicle.FirstPoint.Y) / scale + 2); delta = delta + 22; Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + delta); canvas.Children.Add(t); } } else { t2.Text = t2.Text + "\n" + c.Name + " (" + c.ContainerType + ")" + "\n"; t2.Text = t2.Text + " Габариты:" + c.Vgh + "\n"; t2.Text = t2.Text + " Вес:" + c.Mass + "\n"; } } } b.Child = canvas; tab.RowGroups[0].Rows.Add(new TableRow()); currentRow = tab.RowGroups[0].Rows[i2]; currentRow.Background = Brushes.White; currentRow.FontSize = 14; currentRow.FontWeight = FontWeights.Normal; currentRow.Cells.Add(new TableCell(new Paragraph(new Run(t2.Text)))); currentRow.Cells[0].ColumnSpan = 1; currentRow.Cells.Add(new TableCell(b)); currentRow.Cells[1].ColumnSpan = 1; }
private FlowDocument ShowVehicles() { var doc = new FlowDocument(); foreach (var v in vehicles) { AddMainHeader(doc, "Схема загрузки автомобиля " + v.Name + " (" + v.Count + " контейнеров; общий вес груза " + v.Mass + " кг.)"); if (v.Blocks.Count == 0) { AddHeader(doc, "Автомобиль загружать не нужно"); } else { var i = 0; var i2 = 0; var table1 = new Table(); // ...and add it to the FlowDocument Blocks collection. doc.Blocks.Add(table1); // Set some global formatting properties for the table. table1.CellSpacing = 10; table1.Background = Brushes.White; // Create 6 columns and add them to the table's Columns collection. const int numberOfColumns = 2; for (var x = 0; x < numberOfColumns; x++) { table1.Columns.Add(new TableColumn()); // Set alternating background colors for the middle colums. table1.Columns[x].Background = x % 2 == 0 ? Brushes.Beige : Brushes.LightSteelBlue; } table1.Columns[0].Width = new GridLength(300); //Добавляем заголовок таблицы table1.RowGroups.Add(new TableRowGroup()); table1.RowGroups.Add(new TableRowGroup()); // AddContainer the first (title) row. table1.RowGroups[0].Rows.Add(new TableRow()); var currentRow = table1.RowGroups[0].Rows[0]; currentRow.Background = Brushes.Silver; currentRow.FontSize = 14; currentRow.FontWeight = FontWeights.Bold; currentRow.Cells.Add(new TableCell(new Paragraph(new Run("Контейнеры")))); currentRow.Cells.Add(new TableCell(new Paragraph(new Run("Схема загрузки ряда")))); //получаем список заказов var orderList = DistinctOrdersInRow(v.Blocks); orderList.OrderBy(o => o); foreach (var order in orderList) { foreach (var r in v.Blocks) { if (r.Order == order) { i++; i2 = i2 + 2; AddRow(table1, r, v, i, i2); } } var tempList = v.SmallBlocks.Where(c => c.Order == order).ToList(); if (tempList.Any()) { i++; AddSmallContainers(table1, tempList, i, i2); i2 = i2 + 1 + tempList.Count(); } } } } return doc; }
public static System.Windows.Documents.Table CreateTable(int x, int y, bool bTitle = true, bool bHeader = true) { System.Windows.Documents.Table newTable = new System.Windows.Documents.Table(); // Notice it's not possible to let tables auto-fit to content width, but it will always stretch to whole width by design // Ref: https://social.msdn.microsoft.com/Forums/vstudio/en-US/98348085-a1cb-414f-b082-5a9342ed174c/flowdocument-table-columns-autowidth?forum=wpf // Ref: https://stackoverflow.com/questions/1491285/wpf-flowdocument-table-autofit-option -- Using grid obviously doesn't solve the problem since that just makes things complicated // Ref: https://msdn.microsoft.com/en-us/library/system.windows.documents.flowdocument.columnwidth(v=vs.110).aspx -- Not related... #region Column Definitions // Generate columns int numberOfColumns = x; for (int i = 0; i < numberOfColumns; i++) { AddTableColumn(newTable); } #endregion // Generate Rows // Create and add an empty TableRowGroup to hold the table's Rows. newTable.RowGroups.Add(new TableRowGroup()); TableRow currentRow; // Alias the current working row for easy reference. #region Title Row Definition // Add the first (title) row. if (bTitle) { newTable.RowGroups[0].Rows.Add(new TableRow()); currentRow = newTable.RowGroups[0].Rows[newTable.RowGroups[0].Rows.Count - 1]; // Well we could use index 0 for that's the only possibility // Global formatting for the title row. FormatTitleRow(currentRow); // Add the header row with content, currentRow.Cells.Add(new TableCell(new Paragraph(new Run(TableTitleRowDefaultText)))); // and set the row to span all columns. currentRow.Cells[0].ColumnSpan = newTable.Columns.Count; } #endregion #region Header Row Definition // Add the second (header) row. if (bHeader) { newTable.RowGroups[0].Rows.Add(new TableRow()); currentRow = newTable.RowGroups[0].Rows[newTable.RowGroups[0].Rows.Count - 1]; // Global formatting for the header row. FormatHeaderRow(currentRow); // Add cells with content to the second row for (int i = 0; i < newTable.Columns.Count; i++) { currentRow.Cells.Add(new TableCell(new Paragraph(new Run(TableHeaderRowDefaultText)))); } } #endregion #region Content Rows Definition // Add content rows for (int i = 0; i < y; i++) { AddTableRow(newTable); } #endregion return(newTable); }
/// <summary> /// Returns a cellinfo class for a point that may be inside of a cell /// </summary> /// <param name="paragraphs"> /// Paras to hit test into /// </param> /// <param name="floatingElements"> /// Floating elements to hit test into /// </param> /// <param name="point"> /// Point to hit test /// </param> /// <param name="tableFilter"> /// Filter out all results not specific to a given table /// </param> private CellInfo GetCellInfoFromPoint(ReadOnlyCollection<ParagraphResult> paragraphs, ReadOnlyCollection<ParagraphResult> floatingElements, Point point, Table tableFilter) { CellInfo cellInfo = null; Invariant.Assert(paragraphs != null, "Paragraph collection is empty."); Invariant.Assert(floatingElements != null, "Floating element collection is empty."); // Figure out which paragraph is the closest to the input pixel position. // Search floating elements first, then paragraphs collection. Do not snap to text in either floating elements or // main flow when searching for cell info. int paragraphIndex = GetParagraphFromPointInFloatingElements(floatingElements, point, false); ParagraphResult paragraph = null; if (paragraphIndex >= 0) { Invariant.Assert(paragraphIndex < floatingElements.Count); paragraph = floatingElements[paragraphIndex]; } else { paragraphIndex = GetParagraphFromPoint(paragraphs, point, false); if (paragraphIndex >= 0) { Invariant.Assert(paragraphIndex < paragraphs.Count); paragraph = paragraphs[paragraphIndex]; } } if (paragraph != null) { cellInfo = GetCellInfoFromPoint(paragraph, point, tableFilter); } return cellInfo; }
/// <summary> /// Returns a cellinfo class for a point that may be inside of a cell /// </summary> /// <param name="point"> /// Point to hit test /// </param> /// <param name="tableFilter"> /// Filter out all results not specific to a given table /// </param> /// <returns> /// Returns cellinfo structure. /// </returns> internal CellInfo GetCellInfoFromPoint(Point point, Table tableFilter) { // Verify that layout information is valid. Cannot continue if not valid. if (!IsValid) { throw new InvalidOperationException(SR.Get(SRID.TextViewInvalidLayout)); } return GetCellInfoFromPoint(Columns, FloatingElements, point, tableFilter); }
/// <summary> /// Retrieves a CellInfo from a given point, traversing through columns. /// </summary> private CellInfo GetCellInfoFromPoint(ReadOnlyCollection<ColumnResult> columns, ReadOnlyCollection<ParagraphResult> floatingElements, Point point, Table tableFilter) { Invariant.Assert(floatingElements != null); int columnIndex = GetColumnFromPoint(columns, point, false); CellInfo cellInfo; // If no column is hit, return null CellInfo. // Otherwise hittest column content. if (columnIndex < 0 && floatingElements.Count == 0) { cellInfo = null; } else { // Retrieve position from column. ReadOnlyCollection<ParagraphResult> paragraphs = (columnIndex < columns.Count && columnIndex >= 0) ? columns[columnIndex].Paragraphs : _emptyParagraphCollection; cellInfo = GetCellInfoFromPoint(paragraphs, floatingElements, point, tableFilter); } return cellInfo; }
/// <summary> /// Returns a cellinfo class for a point that may be inside of a cell /// </summary> /// <param name="paragraph"> /// Para to hit test into /// </param> /// <param name="point"> /// Point to hit test /// </param> /// <param name="tableFilter"> /// Filter out all results not specific to a given table /// </param> private CellInfo GetCellInfoFromPoint(ParagraphResult paragraph, Point point, Table tableFilter) { // Figure out which paragraph is the closest to the input pixel position. CellInfo cellInfo = null; if (paragraph is ContainerParagraphResult) { // a) ContainerParagraph - hittest colleciton of nested paragraphs. ReadOnlyCollection<ParagraphResult> nestedParagraphs = ((ContainerParagraphResult)paragraph).Paragraphs; // Paragraphs collection may be empty, but should never be null Invariant.Assert(nestedParagraphs != null, "Paragraph collection is null"); if (nestedParagraphs.Count > 0) { cellInfo = GetCellInfoFromPoint(nestedParagraphs, _emptyParagraphCollection, point, tableFilter); } } else if (paragraph is TableParagraphResult) { ReadOnlyCollection<ParagraphResult> nestedParagraphs = ((TableParagraphResult)paragraph).GetParagraphsFromPoint(point, false); Invariant.Assert(nestedParagraphs != null, "Paragraph collection is null"); if (nestedParagraphs.Count > 0) { cellInfo = GetCellInfoFromPoint(nestedParagraphs, _emptyParagraphCollection, point, tableFilter); } if (cellInfo == null) { cellInfo = ((TableParagraphResult)paragraph).GetCellInfoFromPoint(point); } } else if (paragraph is SubpageParagraphResult) { // Subpage implies new coordinate system. SubpageParagraphResult subpageParagraphResult = (SubpageParagraphResult)paragraph; point.X -= subpageParagraphResult.ContentOffset.X; point.Y -= subpageParagraphResult.ContentOffset.Y; // WOOT! COLUMNS! cellInfo = GetCellInfoFromPoint(subpageParagraphResult.Columns, subpageParagraphResult.FloatingElements, point, tableFilter); if (cellInfo != null) { cellInfo.Adjust(new Point(subpageParagraphResult.ContentOffset.X, subpageParagraphResult.ContentOffset.Y)); } } else if (paragraph is FigureParagraphResult) { // Subpage implies new coordinate system. FigureParagraphResult figureParagraphResult = (FigureParagraphResult)paragraph; TransformToSubpage(ref point, figureParagraphResult.ContentOffset); cellInfo = GetCellInfoFromPoint(figureParagraphResult.Columns, figureParagraphResult.FloatingElements, point, tableFilter); if (cellInfo != null) { cellInfo.Adjust(new Point(figureParagraphResult.ContentOffset.X, figureParagraphResult.ContentOffset.Y)); } } else if (paragraph is FloaterParagraphResult) { // Subpage implies new coordinate system. FloaterParagraphResult floaterParagraphResult = (FloaterParagraphResult)paragraph; TransformToSubpage(ref point, floaterParagraphResult.ContentOffset); cellInfo = GetCellInfoFromPoint(floaterParagraphResult.Columns, floaterParagraphResult.FloatingElements, point, tableFilter); if (cellInfo != null) { cellInfo.Adjust(new Point(floaterParagraphResult.ContentOffset.X, floaterParagraphResult.ContentOffset.Y)); } } if (tableFilter != null && cellInfo != null && cellInfo.Cell.Table != tableFilter) { cellInfo = null; // Clear out result if not matching input filter } return cellInfo; }
Table Render(HTMLTableElement element) { var table = new Table(); return table; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.work = ((System.Windows.Controls.Button)(target)); #line 11 "..\..\MainWindow.xaml" this.work.Click += new System.Windows.RoutedEventHandler(this.work_Click); #line default #line hidden return; case 2: this.exit = ((System.Windows.Controls.Button)(target)); #line 12 "..\..\MainWindow.xaml" this.exit.Click += new System.Windows.RoutedEventHandler(this.exit_Click); #line default #line hidden return; case 3: this.rah = ((System.Windows.Controls.Button)(target)); #line 13 "..\..\MainWindow.xaml" this.rah.Click += new System.Windows.RoutedEventHandler(this.Button_Click); #line default #line hidden return; case 4: this.od = ((System.Windows.Controls.ComboBox)(target)); return; case 5: this.name = ((System.Windows.Controls.TextBox)(target)); return; case 6: this.price = ((System.Windows.Controls.TextBox)(target)); return; case 7: this.lab_name = ((System.Windows.Controls.Label)(target)); return; case 8: this.lab_od = ((System.Windows.Controls.Label)(target)); return; case 9: this.lab_p = ((System.Windows.Controls.Label)(target)); return; case 10: this.add = ((System.Windows.Controls.Button)(target)); #line 24 "..\..\MainWindow.xaml" this.add.Click += new System.Windows.RoutedEventHandler(this.Button_Click_1); #line default #line hidden return; case 11: this._return = ((System.Windows.Controls.Button)(target)); #line 25 "..\..\MainWindow.xaml" this._return.Click += new System.Windows.RoutedEventHandler(this._return_Click); #line default #line hidden return; case 12: this.zam = ((System.Windows.Controls.ComboBox)(target)); return; case 13: this.list = ((System.Windows.Controls.ComboBox)(target)); return; case 14: this.count = ((System.Windows.Controls.TextBox)(target)); return; case 15: this.add_work = ((System.Windows.Controls.Button)(target)); #line 33 "..\..\MainWindow.xaml" this.add_work.Click += new System.Windows.RoutedEventHandler(this.add_work_Click); #line default #line hidden return; case 16: this._return_Copy = ((System.Windows.Controls.Button)(target)); #line 34 "..\..\MainWindow.xaml" this._return_Copy.Click += new System.Windows.RoutedEventHandler(this._return_Copy_Click); #line default #line hidden return; case 17: this.box = ((System.Windows.Controls.FlowDocumentReader)(target)); return; case 18: this.table = ((System.Windows.Documents.Table)(target)); return; } this._contentLoaded = true; }
private void CreateAndShowMainWindow() { // Create the application's main window mainWindow = new System.Windows.Window(); // <Snippet_TableCreate> // Create the parent FlowDocument... flowDoc = new FlowDocument(); // Create the Table... table1 = new Table(); // ...and add it to the FlowDocument Blocks collection. flowDoc.Blocks.Add(table1); // Set some global formatting properties for the table. table1.CellSpacing = 10; table1.Background = Brushes.White; // </Snippet_TableCreate> // <Snippet_TableCreateColumns> // Create 6 columns and add them to the table's Columns collection. int numberOfColumns = 6; for (int x = 0; x < numberOfColumns; x++) { table1.Columns.Add(new TableColumn()); // Set alternating background colors for the middle colums. if (x % 2 == 0) { table1.Columns[x].Background = Brushes.Beige; } else { table1.Columns[x].Background = Brushes.LightSteelBlue; } } // </Snippet_TableCreateColumns> // <Snippet_TableAddTitleRow> // Create and add an empty TableRowGroup to hold the table's Rows. table1.RowGroups.Add(new TableRowGroup()); // Add the first (title) row. table1.RowGroups[0].Rows.Add(new TableRow()); // Alias the current working row for easy reference. TableRow currentRow = table1.RowGroups[0].Rows[0]; // Global formatting for the title row. currentRow.Background = Brushes.Silver; currentRow.FontSize = 40; currentRow.FontWeight = System.Windows.FontWeights.Bold; // Add the header row with content, currentRow.Cells.Add(new TableCell(new Paragraph(new Run("2004 Sales Project")))); // and set the row to span all 6 columns. currentRow.Cells[0].ColumnSpan = 6; // </Snippet_TableAddTitleRow> // <Snippet_TableAddHeaderRow> // Add the second (header) row. table1.RowGroups[0].Rows.Add(new TableRow()); currentRow = table1.RowGroups[0].Rows[1]; // Global formatting for the header row. currentRow.FontSize = 18; currentRow.FontWeight = FontWeights.Bold; // Add cells with content to the second row. currentRow.Cells.Add(new TableCell(new Paragraph(new Run("Product")))); currentRow.Cells.Add(new TableCell(new Paragraph(new Run("Quarter 1")))); currentRow.Cells.Add(new TableCell(new Paragraph(new Run("Quarter 2")))); currentRow.Cells.Add(new TableCell(new Paragraph(new Run("Quarter 3")))); currentRow.Cells.Add(new TableCell(new Paragraph(new Run("Quarter 4")))); currentRow.Cells.Add(new TableCell(new Paragraph(new Run("TOTAL")))); // </Snippet_TableAddHeaderRow> // <Snippet_TableAddDataRow> // Add the third row. table1.RowGroups[0].Rows.Add(new TableRow()); currentRow = table1.RowGroups[0].Rows[2]; // Global formatting for the row. currentRow.FontSize = 12; currentRow.FontWeight = FontWeights.Normal; // Add cells with content to the third row. currentRow.Cells.Add(new TableCell(new Paragraph(new Run("Widgets")))); currentRow.Cells.Add(new TableCell(new Paragraph(new Run("$50,000")))); currentRow.Cells.Add(new TableCell(new Paragraph(new Run("$55,000")))); currentRow.Cells.Add(new TableCell(new Paragraph(new Run("$60,000")))); currentRow.Cells.Add(new TableCell(new Paragraph(new Run("$65,000")))); currentRow.Cells.Add(new TableCell(new Paragraph(new Run("$230,000")))); // Bold the first cell. currentRow.Cells[0].FontWeight = FontWeights.Bold; // </Snippet_TableAddDataRow> // <Snippet_TableAddFooterRow> table1.RowGroups[0].Rows.Add(new TableRow()); currentRow = table1.RowGroups[0].Rows[3]; // Global formatting for the footer row. currentRow.Background = Brushes.LightGray; currentRow.FontSize = 18; currentRow.FontWeight = System.Windows.FontWeights.Normal; // Add the header row with content, currentRow.Cells.Add(new TableCell(new Paragraph(new Run("Projected 2004 Revenue: $810,000")))); // and set the row to span all 6 columns. currentRow.Cells[0].ColumnSpan = 6; // </Snippet_TableAddFooterRow> mainWindow.Content = flowDoc; mainWindow.Show(); }
// Write columns related to the given table cell range. private static void WriteTableColumnsInformation(ITextRange range, Table table, XmlWriter xmlWriter, XamlTypeMapper xamlTypeMapper) { TableColumnCollection columns = table.Columns; int startColumn; int endColumn; if (!TextRangeEditTables.GetColumnRange(range, table, out startColumn, out endColumn)) { startColumn = 0; endColumn = columns.Count - 1; } Invariant.Assert(startColumn >= 0, "startColumn index is supposed to be non-negative"); if(columns.Count > 0) { // Build an appropriate name for the complex property string complexPropertyName = table.GetType().Name + ".Columns"; // Write the start element for the complex property. xmlWriter.WriteStartElement(complexPropertyName); for (int i = startColumn; i <= endColumn && i < columns.Count; i++) { WriteXamlAtomicElement(columns[i], xmlWriter, /*reduceElement:*/false); } // Close the element for the complex property xmlWriter.WriteEndElement(); } }
internal TableElementContentContainer(Table table, PropertyRecord []localValues, ContentContainer childContainer) : base(table.GetType(), localValues, table.Resources, childContainer) { _cpTable = table.TextContainer.Start.GetOffsetToPosition(table.ContentStart); _columns = SaveColumns(table); }
static void WritePage(FlowDocument doc, IList<Lessee> lessees, Project project, bool overview, bool lastpage) { var result = project.Result; double scale = overview ? 0.8 : 1; var llv = overview && lastpage;// print landlord and vacancy columns // create some useful fonts and brushes var heading = CreateStyle(20.0 * scale, FontWeights.Bold); var big = CreateStyle(16 * scale, FontWeights.Bold); var bold = CreateStyle(11 * scale, FontWeights.Bold); var normal = CreateStyle(11 * scale); var small = CreateStyle(9 * scale); var red = CreateStyle(11 * scale, FontWeights.Bold, Brushes.Red); // Nebenkostenabrechnung <jahr>/<jahr+1> // <name mietpartei/Übersicht> // Vom <abrechnungszeitraum anfang> bis zum <abrechnungszeitraum ende> var r = doc.Blocks; r.Add(Text("Nebenkostenabrechnung " + project.StartYear + " / " + project.EndDate.Year, heading)); if ( r.Count != 1 ) r.LastBlock.BreakPageBefore = true;// unless this is the first page, insert a page break r.Add(Text(overview ? "Übersicht" : lessees[0].Name, big)); var start = overview ? project.StartDate : result.Lessees[lessees[0]].StartDate; var end = overview ? project.EndDate : result.Lessees[lessees[0]].EndDate; r.Add(Text("Zeitraum: " + start.ToShortDateString() + " bis " + end.ToShortDateString(), bold)); /* Kostenart Schlüssel Gesamtkosten _______ * Mieter Mieter i * Personen/Firmen i.count * Mietfläche i.room.size * Mietdauer n Monate _______ * Kostenpunkt j j.type j.value k(i, j) _______ * Nebenkosten gesamt in Euro K(false) K(i) * Vorauszahlungen in Euro P() P(i) * Nachzahlung/Erstattung in Euro Z(false) Z(i) *\____________________|_______________|______________|_/ \_____________/ * same for single leccee and overview single first */ var t = new Table(); t.CellSpacing = 0; for ( var i = 0; i < 3 + lessees.Count; ++i ) { t.Columns.Add(new TableColumn() { Width = i == 0 ? new GridLength(160 * scale) : new GridLength(110 * scale) }); } if ( overview && lastpage ) { t.Columns.Add(new TableColumn() { Width = new GridLength(110 * scale) }); t.Columns.Add(new TableColumn() { Width = new GridLength(110 * scale) }); } var headgroup = new TableRowGroup(); headgroup.Rows.Add(Row( Text("Kostenart", bold), Text("Schlüssel", bold), Text("Gesamtkosten", bold), lessees, l => Text(), llv ? Text() : null, llv ? Text() : null, true)); headgroup.Rows.Add(Row( Text(), Text("Mieter", normal), Text(), lessees, l => Text(l.Name, normal), llv ? Text("Leerstand", normal) : null, llv ? Text("Vermieter", normal) : null)); headgroup.Rows.Add(Row( Text(), Text("Personen", normal), Text(), lessees, l => Text(l.Members.ToString(), normal), llv ? Text() : null, llv ? Text() : null)); headgroup.Rows.Add(Row( Text(), Text("Mietfläche", normal), Text(), lessees, l => Text(result.Lessees[l].AverageFlatSize.ToString("F") + " m²", normal), llv ? Text(result.Vacancy.AverageFlatSize.ToString("F") + "~ m²", normal) : null, llv ? Text() : null)); headgroup.Rows.Add(Row( Text(), Text("Mietdauer", normal), Text(), lessees, l => Text(result.Lessees[l].Months + " Monate", normal), llv ? Text(result.Vacancy.Months + " Monate", normal) : null, llv ? Text() : null, true)); t.RowGroups.Add(headgroup); var costgroup = new TableRowGroup(); for ( var i = 0; i < project.Costs.Count; ++i ) { var cost = project.Costs[i]; if ( !overview && !result.Lessees[lessees[0]].Costs.ContainsKey(cost) ) continue; costgroup.Rows.Add(Row( Text(cost.Name, normal), Text(ResultView.CostModeToString(cost.Mode), normal), /* Total */ Text(cost.Amount.ToString("F"), normal), lessees, /* Lessee */ l => result.Lessees[l].Costs.ContainsKey(cost) ? Text(result.Lessees[l].Costs[cost].ToString("F"), normal) : Text(), /* Vacancy */ llv ? (result.Vacancy.Costs.ContainsKey(cost) ? Text(result.Vacancy.Costs[cost].ToString("F"), normal) : Text()) : null, /* Landlord */ llv && result.Landlord.Costs.ContainsKey(cost) ? Text(result.Landlord.Costs[cost].ToString("F"), normal) : null, /* HasBorder */ i == project.Costs.Count - 1)); } t.RowGroups.Add(costgroup); var sumgroup = new TableRowGroup(); double costssum = project.Costs.Sum(c => c.Amount); double paymentsum = result.Lessees.Sum(p => p.Value.AdvancePayment); double vacancysum = result.Vacancy.Costs.Sum(v => v.Value); double landlordsum = result.Landlord.Costs.Sum(l => l.Value); sumgroup.Rows.Add(Row( Text("Nebenkosten gesamt", bold), Text("in Euro", normal), Text(costssum.ToString("F"), bold), lessees, l => Text(result.Lessees[l].Costs.Sum(p => p.Value).ToString("F"), bold), llv ? Text(vacancysum.ToString("F"), bold) : null, llv ? Text(landlordsum.ToString("F"), bold) : null)); sumgroup.Rows.Add(Row( Text("Vorrauszahlungen", bold), Text("in Euro", normal), Text(paymentsum.ToString("F"), bold), lessees, l => Text(result.Lessees[l].AdvancePayment.ToString("F"), bold), llv ? Text() : null, llv ? Text() : null)); sumgroup.Rows.Add(Row( Text("Nachzahlung/Erstattung", bold), Text("in Euro", normal), Text((paymentsum - costssum).ToString("F"), bold), lessees, l => { var sum = result.Lessees[l].AdvancePayment - result.Lessees[l].Costs.Sum(p => p.Value); return Text(sum.ToString("F"), sum < 0 ? red : bold); }, llv ? Text((-vacancysum).ToString("F"), red) : null, llv ? Text((-landlordsum).ToString("F"), red) : null)); t.RowGroups.Add(sumgroup); r.Add(t); }
/// <summary> /// Renders DOM text elements recursively, i.e. including their childs. /// </summary> /// <param name="e">The root DOM text element.</param> /// <returns>The corresponding Wpf element.</returns> /// <exception cref="System.InvalidOperationException"> /// </exception> /// <exception cref="System.NotImplementedException"></exception> public object RenderRecursively(TextElement e) { object wpf = null; switch (e) { case BlockUIContainer buc: { wpf = new swd.BlockUIContainer(); } break; case FlowDocument flowDocument: { // make sure the standard colors were set flowDocument.Foreground = ExCSS.Color.Black; flowDocument.Background = ExCSS.Color.White; var flowDocumente = new swd.FlowDocument() { Name = NameOfFlowDocument }; if (TemplateBindingViewportWidth is null) { TemplateBindingViewportWidth = new Binding("ColumnWidth") { Source = flowDocumente } } ; if (TemplateBindingViewportHeight is null) { TemplateBindingViewportHeight = new Binding("ColumnWidth") { Source = flowDocumente } } ; // Binding to ColumnWidth is not optimal, but better than nothing! if (flowDocument.Background.HasValue) { flowDocumente.Background = GetBrushFromColor(flowDocument.Background.Value); } if (flowDocument.Foreground.HasValue) { flowDocumente.Foreground = GetBrushFromColor(flowDocument.Foreground.Value); } wpf = flowDocumente; } break; case Hyperlink hl: { var hle = new swd.Hyperlink(); if (!string.IsNullOrEmpty(hl.NavigateUri)) { if (System.Uri.TryCreate(hl.NavigateUri, UriKind.RelativeOrAbsolute, out var uri)) { hle.NavigateUri = uri; } } if (!string.IsNullOrEmpty(hl.TargetName)) { hle.TargetName = hl.TargetName; } wpf = hle; } break; case Image image: { var imagee = new System.Windows.Controls.Image(); if (!string.IsNullOrEmpty(image.Source)) { imagee.SetBinding(System.Windows.Controls.Image.SourceProperty, $"ImageProvider[{image.Source}]"); } if (image.Width == null && image.Height == null) { imagee.Stretch = System.Windows.Media.Stretch.Uniform; var binding = new Binding() { RelativeSource = RelativeSource.Self, Path = new System.Windows.PropertyPath("Source") }; binding.Converter = ImageToImageWidthConverter.Instance; imagee.SetBinding(System.Windows.Controls.Image.WidthProperty, binding); } else { imagee.Stretch = System.Windows.Media.Stretch.Uniform; } if (image.Width != null) { if (image.Width.IsPurelyAbsolute(out var widthPx)) { imagee.Width = widthPx; } else { var multibinding = new MultiBinding(); multibinding.Bindings.Add(new Binding() { Source = TemplateBindingViewportWidth.Source, Path = TemplateBindingViewportWidth.Path }); multibinding.Bindings.Add(new Binding() { Source = TemplateBindingViewportHeight.Source, Path = TemplateBindingViewportHeight.Path }); multibinding.Converter = CompoundLengthConverter.Instance; multibinding.ConverterParameter = GetCompoundLengthConverterParameters(image.Width); imagee.SetBinding(System.Windows.Controls.Image.WidthProperty, multibinding); } } if (image.Height != null) { if (image.Height.IsPurelyAbsolute(out var heightPx)) { imagee.Height = heightPx; } else { var multibinding = new MultiBinding(); multibinding.Bindings.Add(new Binding() { Source = TemplateBindingViewportWidth.Source, Path = TemplateBindingViewportWidth.Path }); multibinding.Bindings.Add(new Binding() { Source = TemplateBindingViewportHeight.Source, Path = TemplateBindingViewportHeight.Path }); multibinding.Converter = CompoundLengthConverter.Instance; multibinding.ConverterParameter = GetCompoundLengthConverterParameters(image.Height); imagee.SetBinding(System.Windows.Controls.Image.HeightProperty, multibinding); } } // set max-width and max-height if (image.MaxWidth != null && image.MaxWidth.Value.IsAbsolute) { imagee.MaxWidth = image.MaxWidth.Value.ToPixel(); } else if (image.MaxWidth == null || image.MaxWidth.Value.Type == ExCSS.Length.Unit.Vw) { double vwValue = image.MaxWidth.HasValue ? image.MaxWidth.Value.Value : 100; var binding = new Binding() { Source = TemplateBindingViewportWidth.Source, Path = TemplateBindingViewportWidth.Path }; binding.Converter = RelativeSizeConverter.Instance; binding.ConverterParameter = vwValue; imagee.SetBinding(System.Windows.Controls.Image.MaxWidthProperty, binding); } else { throw new InvalidProgramException(); } if (image.MaxHeight != null && image.MaxHeight.Value.IsAbsolute) { imagee.MaxHeight = image.MaxHeight.Value.ToPixel(); } else if (image.MaxHeight == null || image.MaxHeight.Value.Type == ExCSS.Length.Unit.Vh) { double vhValue = image.MaxHeight.HasValue ? image.MaxHeight.Value.Value : 100; var binding = new Binding() { Source = TemplateBindingViewportWidth.Source, Path = TemplateBindingViewportWidth.Path }; binding.Converter = RelativeSizeConverter.Instance; binding.ConverterParameter = vhValue; imagee.SetBinding(System.Windows.Controls.Image.MaxHeightProperty, binding); } else { throw new InvalidProgramException(); } wpf = imagee; } break; case InlineUIContainer iuc: { var inlineuiContainere = new swd.InlineUIContainer(); wpf = inlineuiContainere; } break; case LineBreak lb: { wpf = new swd.LineBreak(); } break; case List list: { var liste = new swd.List(); if (list.MarkerStyle.HasValue) { liste.MarkerStyle = ToMarkerStyle(list.MarkerStyle.Value); } wpf = liste; } break; case ListItem li: { wpf = new swd.ListItem(); } break; case Paragraph p: { var pe = new swd.Paragraph(); if (p.TextDecorations.HasValue) { pe.TextDecorations = ToTextDecorations(p.TextDecorations.Value); } if (p.TextIndent.HasValue) { pe.TextIndent = p.TextIndent.Value.IsAbsolute ? p.TextIndent.Value.ToPixel() : 0; } wpf = pe; } break; case Run run: { if (SplitIntoWords) { wpf = CreateTextElement_SeparateWords(run.Text); } else if (SplitIntoSentences) { wpf = CreateTextElement_SeparateSentences(run.Text); } else { wpf = new swd.Run(run.Text); } } break; case Section s: { wpf = new swd.Section(); } break; case Span span: { wpf = new swd.Span(); } break; case Table tb: { var tbe = new swd.Table(); foreach (var c in tb.Columns) { if (c.Width.HasValue) { tbe.Columns.Add(new swd.TableColumn() { Width = new System.Windows.GridLength(c.Width.Value) }); } else { tbe.Columns.Add(new swd.TableColumn()); } } wpf = tbe; } break; case TableCell tc: { var tce = new swd.TableCell(); if (1 != tc.ColumnSpan) { tce.ColumnSpan = tc.ColumnSpan; } if (1 != tc.RowSpan) { tce.RowSpan = tc.RowSpan; } if (tc.BorderBrush.HasValue) { tce.BorderBrush = new System.Windows.Media.SolidColorBrush(ToColor(tc.BorderBrush.Value)); } if (tc.BorderThickness.HasValue) { tce.BorderThickness = ToThickness(tc.BorderThickness.Value); } wpf = tce; } break; case TableRow trow: { wpf = new swd.TableRow(); } break; case TableRowGroup trg: { wpf = new swd.TableRowGroup(); } break; default: { wpf = null; } break; } // Render TextElement properties if (wpf is swd.TextElement te) { if (!string.IsNullOrEmpty(e.FontFamily)) { te.FontFamily = GetFontFamily(e.FontFamily); } if (e.FontSize.HasValue) { var fs = e.FontSize.Value; fs = Math.Max(0.004, fs); te.FontSize = fs; } if (e.FontStyle.HasValue) { te.FontStyle = ToFontStyle(e.FontStyle.Value); } if (e.FontWeight.HasValue) { te.FontWeight = ToFontWeight(e.FontWeight.Value); } if (e.Foreground.HasValue && e.Foreground != e.ForegroundInheritedOnly) { te.Foreground = GetBrushFromColor(e.Foreground.Value); } if (e.Background.HasValue && e.Background != e.BackgroundInheritedOnly) { te.Background = GetBrushFromColor(e.Background.Value); } } // now special properties if (e is Block b && wpf is swd.Block be) { if (b.Margin.HasValue) { be.Margin = ToThickness(b.Margin.Value); } if (b.Padding.HasValue) { be.Padding = ToThickness(b.Padding.Value); } if (b.BorderBrush.HasValue) { be.BorderBrush = new System.Windows.Media.SolidColorBrush(ToColor(b.BorderBrush.Value)); } if (b.BorderThickness.HasValue) { be.BorderThickness = ToThickness(b.BorderThickness.Value); } if (b.TextAlignment.HasValue) { be.TextAlignment = ToTextAlignment(b.TextAlignment.Value); } if (b.LineHeight.HasValue) { be.LineHeight = b.LineHeight.Value; } } if (e is Inline i && wpf is swd.Inline ie) { if (i.VerticalAlignment.HasValue) { ie.BaselineAlignment = ToBaselineAlignment(i.VerticalAlignment.Value); } } // finished rendering the attributes // now, render all children foreach (var child in e.Childs) { var childe = RenderRecursively(child); switch (wpf) { case swd.Figure figure: figure.Blocks.Add((swd.Block)childe); break; case swd.Floater floater: floater.Blocks.Add((swd.Block)childe); break; case swd.FlowDocument flowDocument: flowDocument.Blocks.Add((swd.Block)childe); break; case swd.List list: list.ListItems.Add((swd.ListItem)childe); break; case swd.ListItem listItem: listItem.Blocks.Add((swd.Block)childe); break; case swd.Section section: section.Blocks.Add((swd.Block)childe); break; case swd.Table table: table.RowGroups.Add((swd.TableRowGroup)childe); break; case swd.TableCell tableCell: tableCell.Blocks.Add((swd.Block)childe); break; case swd.TableRow tableRow: tableRow.Cells.Add((swd.TableCell)childe); break; case swd.TableRowGroup tableRowGroup: tableRowGroup.Rows.Add((swd.TableRow)childe); break; // now elements that can contain inlines case swd.Paragraph paragraph: paragraph.Inlines.Add((swd.Inline)childe); break; case swd.Span span: span.Inlines.Add((swd.Inline)childe); break; // now some specialties case swd.InlineUIContainer inlineUIContainer: if (inlineUIContainer.Child != null) { throw new InvalidOperationException($"{nameof(swd.InlineUIContainer)} can not contain more than one child"); } inlineUIContainer.Child = (System.Windows.UIElement)childe; break; case swd.BlockUIContainer blockUIContainer: if (blockUIContainer.Child != null) { throw new InvalidOperationException($"{nameof(swd.BlockUIContainer)} can not contain more than one child"); } blockUIContainer.Child = (System.Windows.UIElement)childe; break; default: throw new NotImplementedException(); } } if (AttachDomAsTags) { if (wpf is System.Windows.FrameworkContentElement conEle) { conEle.Tag = e; } else if (wpf is System.Windows.FrameworkElement uiEle) { uiEle.Tag = e; } } return(wpf); }
internal TableChildrenCollectionEnumeratorSimple(Table table) { Debug.Assert(table != null); _table = table; _version = _table._version; _columns = ((IEnumerable)_table._columns).GetEnumerator(); _rowGroups = ((IEnumerable)_table._rowGroups).GetEnumerator(); }
//------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods // Used also in TextTreeExtractElementUndoUnit internal static TableColumn[] SaveColumns(Table table) { TableColumn[] savedColumns; if (table.Columns.Count > 0) { savedColumns = new TableColumn[table.Columns.Count]; for (int columnIndex = 0; columnIndex < table.Columns.Count; columnIndex++) { savedColumns[columnIndex] = CopyColumn(table.Columns[columnIndex]); } } else { savedColumns = null; } return savedColumns; }
public Table GetHealTable() { var threatTable = new Table(); threatTable.CellSpacing = 0; threatTable.Columns.Add(new TableColumn()); threatTable.Columns.Add(new TableColumn()); threatTable.Columns.Add(new TableColumn()); threatTable.Columns.Add(new TableColumn()); var headerGroup = new TableRowGroup(); headerGroup.Rows.Add(new TableRow()); headerGroup.Rows[0].FontWeight = FontWeights.Bold; var headerRow = headerGroup.Rows[0]; headerRow.Cells.Add(new TableCell(new Paragraph(new Run("Skill")))); headerRow.Cells.Add(new TableCell(new Paragraph(new Run("Count")))); headerRow.Cells.Add(new TableCell(new Paragraph(new Run("Heal")))); headerRow.Cells.Add(new TableCell(new Paragraph(new Run("Total Heal %")))); headerRow.Cells.Add(new TableCell(new Paragraph(new Run("Overheal")))); headerRow.Cells.Add(new TableCell(new Paragraph(new Run("Overheal %")))); threatTable.RowGroups.Add(headerGroup); var rowGroup = new TableRowGroup(); var totalHeal = HealsGiven; var totalOverheal = Overheal; foreach (var item in HealRecordsBySkill.OrderByDescending(records => records.Sum(record => record.CalculateOverheal()))) { var row = new TableRow(); row.Cells.Add(new TableCell(new Paragraph(new Run(item.Key)))); row.Cells.Add(new TableCell(new Paragraph(new Run(item.Count().ToString())))); row.Cells.Add(new TableCell(new Paragraph(new Run(item.Sum(record => record.Quantity.Value).ToString())))); row.Cells.Add(new TableCell(new Paragraph(new Run(item.Sum(record => (double)record.Quantity.Value / totalHeal).ToString("0.##%"))))); row.Cells.Add(new TableCell(new Paragraph(new Run(item.Sum(record => record.CalculateOverheal()).ToString())))); row.Cells.Add(new TableCell(new Paragraph(new Run( (item.Sum(record => (double)record.CalculateOverheal())/item.Sum(record => record.Quantity.Value)).ToString("0.##%"))))); rowGroup.Rows.Add(row); } rowGroup.Rows.Add(new TableRow()); threatTable.RowGroups.Add(rowGroup); return threatTable; }
// Used also in TextTreeExtractElementUndoUnit internal static void RestoreColumns(Table table, TableColumn[] savedColumns) { if (savedColumns != null) { for (int columnIndex = 0; columnIndex < savedColumns.Length; columnIndex++) { if (table.Columns.Count <= columnIndex) { table.Columns.Add(CopyColumn(savedColumns[columnIndex])); } } } }