本文整理汇总了C#中Table.AddBodyRow方法的典型用法代码示例。如果您正苦于以下问题:C# Table.AddBodyRow方法的具体用法?C# Table.AddBodyRow怎么用?C# Table.AddBodyRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table.AddBodyRow方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Build
/////////////////////////////////////////////////////////////////////////////
#region code
public Tuple<string, string> Build()
{
// ******
var tagList = new TagList { };
tagList.AddChild( new QuickTag( "h4" )
.SetValue( About ) );
// ******
var table = new Table( caption: "Money Flow", border: 0, id: "", attrAndStyles: "background : ivory" );
tagList.AddChild( table );
// ******
foreach( var item in AccountSummaryData.Create() ) {
table.AddBodyRow(
Content( item.Col1.ToString( "dd MMM yyyy" ), "width : 100px", "text-align : right" ),
Content( item.Col2.ToString(), "width : 100px", "text-align : right" ),
Content( item.Col3.ToString(), "width : 100px", "text-align : right" ),
Content( item.Col4.ToString(), "width : 100px", "text-align : right" ),
Content( item.Col5.ToString(), "width : 100px", "text-align : right" ),
Content( item.Col6.ToString(), "width : 100px", "text-align : right" ),
Content( item.Col7.ToString(), "width : 100px", "text-align : right", item.Col7 < 0 ? "color : red" : "" )
);
}
// ******
return new Tuple<string, string>( Render( tagList ), nameof( TableWithFormatting2 ) );
}
示例2: Build
/////////////////////////////////////////////////////////////////////////////
#region code
public Tuple<string, string> Build()
{
// ******
var tagList = new TagList { };
tagList.AddChild( new QuickTag( "h4" )
.SetValue( About )
);
// ******
var table = new Table( caption: "Checking Account", border: 0, id: "", attrAndStyles: "" );
tagList.AddChild( table );
// ******
foreach( var item in AccountSummaryData.Create() ) {
table.AddBodyRow(
item.Col1.ToString( "dd MMM yyyy" ),
item.Col2.ToString(),
item.Col3.ToString(),
item.Col4.ToString(),
item.Col5.ToString(),
item.Col6.ToString(),
item.Col7.ToString()
);
}
// ******
return new Tuple<string, string>( Render( tagList ), nameof( TableWithData ) );
}
示例3: Build
/////////////////////////////////////////////////////////////////////////////
#region code
public Tuple<string, string> Build()
{
// ******
var tagList = new TagList { };
tagList.AddChild( new QuickTag( "h4" )
.SetValue( About ) );
// ******
var table = new Table();
tagList.AddChild( table );
table.AddAttributesAndStyles(
"table-layout: fixed",
"border-collapse: collapse",
"border: 1px solid black",
"margin: 0px",
"padding : 0",
"background : ivory"
);
table.AddHeaderRow( Content( "", "colspan = 4" ), Content( $"4 month moving average", "colspan = 3" ) )
.AddHeaderRow( "Ending Date", "In", "Out", "Diff", "Moving Avg In", "Moving Avg Out", "Moving Avg Diff" );
table.AddStyleBlock( StyleBlockAddAs.Class, "td, th", "border : 1px solid black" );
table.AddBodyStyles();
//
// yet another way to set body styles; a StylesFunc allows the interception of columns as they are
// added, parameters are the column number being added and the StylesDictionary that represents that
// column, return an IEnumerable<string> of styles to merge, or manipulate the styles dictionary
// itself
//
// breaking out the StyleFunction on it's own makes this look a lot less messy and more readable than
// inserting the lambda directly into SetDefaultBodyStyles() - at least for the sake of an example
//
StylesFunc sf = ( col, sd ) => col > 3 ? Styles( "font-style : italic " ) : null;
table.SetDefaultBodyStyles( sf, 7, "width : 100px", "text-align : right" );
// ******
foreach( var item in AccountSummaryData.Create() ) {
table.AddBodyRow(
item.Col1.ToString( "dd MMM yyyy" ),
item.Col2.ToString(),
item.Col3.ToString(),
item.Col4.ToString(),
item.Col5.ToString(),
item.Col6.ToString(),
Content( item.Col7.ToString(), item.Col7 < 0 ? "color : red" : null )
);
}
// ******
return new Tuple<string, string>( Render( tagList ), nameof( TableWithFormatting3 ) );
}