本文整理汇总了C#中Novacode.DocX.InsertTable方法的典型用法代码示例。如果您正苦于以下问题:C# DocX.InsertTable方法的具体用法?C# DocX.InsertTable怎么用?C# DocX.InsertTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Novacode.DocX
的用法示例。
在下文中一共展示了DocX.InsertTable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateDoc
private string CreateDoc( ) {
var fileName = Seged.Seged.CreateFileName( versenyAdatok.VersenysorozatAzonosito, versenyAdatok.Azonosito,
dokumentumTipus );
document = DocX.Create( fileName );
document.AddHeaders( );
Seged.Seged.OldalSzamozas( document );
var header = document.Headers.odd;
AddHeader( header );
VersenyAdatokTablazat( header );
foreach( var ijtipus in ijtipusok._ijtipusok ) {
Table table ;
foreach( var korosztaly in ijtipus.korosztalyok.korosztalyok ) {
if( !korosztaly.eredmenyek.IsEmpty( ) ) {
var korosztalyParagraph = document.InsertParagraph();
korosztalyParagraph.Append( "Íjtípus: " );
korosztalyParagraph.Append( ijtipus.megnevezes ).Bold( );
korosztalyParagraph.AppendLine( " Korosztály: " );
korosztalyParagraph.Append( korosztaly.megnevezes ).Bold( );
if( !korosztaly.eredmenyek.Nok.Count.Equals( 0 ) ) {
var nokParagraph = document.InsertParagraph();
nokParagraph.Append( " Nők: " ).Bold( );
int helyezes = 0;
foreach( var eredmeny in korosztaly.eredmenyek.Nok ) {
helyezes++;
table = document.AddTable( 1, 7 );
table.Rows[0].Cells[1].Paragraphs[0].Append( ( helyezes ) + "." );
table.Rows[0].Cells[2].Paragraphs[0].Append( eredmeny.Sorszam.ToString( ) );
table.Rows[0].Cells[3].Paragraphs[0].Append( eredmeny.Nev );
table.Rows[0].Cells[4].Paragraphs[0].Append( eredmeny.Egyesulet );
table.Rows[0].Cells[5].Paragraphs[0].Append( eredmeny.OsszPont.ToString( ) + " pont" );
table.Rows[0].Cells[6].Paragraphs[0].Append( eredmeny.Szazalek.ToString( ) + "%" );
TablazatFormazas( table );
document.InsertTable( table );
}
}
if( !korosztaly.eredmenyek.Ferfiak.Count.Equals( 0 ) ) {
var nokParagraph = document.InsertParagraph();
nokParagraph.Append( " Férfiak: " ).Bold( );
int helyezes = 0;
foreach( var eredmeny in korosztaly.eredmenyek.Ferfiak ) {
helyezes++;
table = document.AddTable( 1, 7 );
table.Rows[0].Cells[1].Paragraphs[0].Append( ( helyezes ) + "." );
table.Rows[0].Cells[2].Paragraphs[0].Append( eredmeny.Sorszam.ToString( ) );
table.Rows[0].Cells[3].Paragraphs[0].Append( eredmeny.Nev );
table.Rows[0].Cells[4].Paragraphs[0].Append( eredmeny.Egyesulet );
table.Rows[0].Cells[5].Paragraphs[0].Append( eredmeny.OsszPont.ToString( ) + " pont" );
table.Rows[0].Cells[6].Paragraphs[0].Append( eredmeny.Szazalek.ToString( ) + "%" );
TablazatFormazas( table );
document.InsertTable( table );
}
}
if( !korosztaly.eredmenyek.Egyben.Count.Equals( 0 ) ) {
var nokParagraph = document.InsertParagraph();
nokParagraph.Append( " Egyben: " ).Bold( );
int helyezes = 0;
foreach( var eredmeny in korosztaly.eredmenyek.Egyben ) {
helyezes++;
table = document.AddTable( 1, 7 );
table.Rows[0].Cells[1].Paragraphs[0].Append( ( helyezes ) + "." );
table.Rows[0].Cells[2].Paragraphs[0].Append( eredmeny.Sorszam.ToString( ) );
table.Rows[0].Cells[3].Paragraphs[0].Append( eredmeny.Nev );
table.Rows[0].Cells[4].Paragraphs[0].Append( eredmeny.Egyesulet );
table.Rows[0].Cells[5].Paragraphs[0].Append( eredmeny.OsszPont.ToString( ) + " pont" );
table.Rows[0].Cells[6].Paragraphs[0].Append( eredmeny.Szazalek.ToString( ) + "%" );
TablazatFormazas( table );
document.InsertTable( table );
}
}
}
}
}
try { document.Save( ); } catch( Exception ) {
MessageBox.Show( "A dokumentum meg van nyitva!", "Verseny Teljes Eredménylap", MessageBoxButton.OK, MessageBoxImage.Error );
}
return fileName;
}
示例2: CreateResultsTable
//add items later
private void CreateResultsTable(DocX document2, string tableTitle, IEnumerable<ProtocolResult> data)
{
var titleStyle = new Formatting();
titleStyle.Size = 12;
titleStyle.Bold = true;
titleStyle.FontFamily = new System.Drawing.FontFamily("Times New Roman");
var title = document2.InsertParagraph(tableTitle, false, titleStyle);
title.IndentationBefore = 2;
title.InsertText(Environment.NewLine);
var table = document2.InsertTable(1, 9);
table.AutoFit = AutoFit.Window;
InsertTableHeader(table);
InsertTableNumerationRow(table);
PopulateTable(table, data);
PrepareCells(table);
}
示例3: CreateTable
private static void CreateTable(DocX doc)
{
const int TABLE_WIDTH = 3;
const int TABLE_HEIGHT = 4;
var table = doc.AddTable(TABLE_HEIGHT, TABLE_WIDTH);
table.Alignment = Alignment.center;
for (int row = 0; row < table.RowCount; row++)
{
for (int col = 0; col < table.ColumnCount; col++)
{
table.Rows[row].Cells[col].Paragraphs[0].Alignment = Alignment.center;
if (row == 0)
{
table.Rows[row].Cells[col].FillColor = System.Drawing.Color.MediumBlue;
switch (col)
{
case 0:
table.Rows[row].Cells[col].Paragraphs[0].Append("Team");
break;
case 1:
table.Rows[row].Cells[col].Paragraphs[0].Append("Game");
break;
case 2:
table.Rows[row].Cells[col].Paragraphs[0].Append("Points");
break;
}
}
else
{
table.Rows[row].Cells[col].Paragraphs[0].Append("-");
}
}
}
doc.InsertTable(table);
}
示例4: PrintRevision
private void PrintRevision(IEnumerable<BarRevisionMyClass> revision, DocX doc)
{
BarRevisionController.BarRevisionControllerInstance().InsertOrUpdateAllItemsInBar();
for (int i = 0; i < 5; i++)
{
doc.InsertParagraph();
}
doc.InsertParagraph("Ревизия:");
var barRevisionMyClasses = revision as IList<BarRevisionMyClass> ?? revision.ToList();
doc.InsertTable(barRevisionMyClasses.Count()+2, 2);
doc.PageLayout.Orientation = Orientation.Landscape;
Table revisionTable = doc.Tables[2];
revisionTable.AutoFit = AutoFit.Contents;
revisionTable.Design = TableDesign.TableGrid;
revisionTable.Rows[0].Cells[0].Paragraphs[0].InsertText("Наименование");
revisionTable.Rows[0].Cells[1].Paragraphs[0].InsertText("Продано");
for (int i = 0; i < barRevisionMyClasses.Count(); i++)
{
revisionTable.Rows[i + 1].Cells[0].Paragraphs[0].InsertText(barRevisionMyClasses[i].Наименование);
revisionTable.Rows[i + 1].Cells[1].Paragraphs[0].InsertText(barRevisionMyClasses[i].Продано.ToString(CultureInfo.InvariantCulture));
}
foreach (var si in barRevisionMyClasses)
{
}
}